Skip to content

Instantly share code, notes, and snippets.

//DIALOGUE TRIGGER IN PLAYER
//all dialogues and NPC data is made on scriptable objects
if ((Input.GetButtonDown(inp.interact)|| Input.GetButtonDown(inp.c_interact)) && !ui.inDialogue)
{
pl.isonevent = true; //we prevent the character of doing actions
ui.ClearText(); //quits all the information that could be from the last dialogue
ui.SetCharNameAndColor(); //set the values for npc name, colors and dialogues
ui.inDialogue = true;
ui.currentVillager = currentVillager;
/*TOWN PROTOTYPE CODE*/
//PLAYER CONTROLLER GAMEPAD DETECTION
//Get Joystick Names
string[] temp = Input.GetJoystickNames();
//Check whether array contains anything
if (temp.Length > 0)
{
//cameratilt.cs added to the main camera so in the Title Scene we can control it rotating the phone, also added some camera tilt
float camtiltx;
float camtiltz;
float camtilty;
public float rotationspeed;
void Start()
{
Input.gyro.enabled = true;
}
private void FixedUpdate()
{
//writing in what situation we have to recover stamina, walking or idle while we are not making effort
//the only mechanic that need to quit stamina gradually is running, every other action is done in GetKeyDown
if (stamina < staminamax && fallend && !momentofdeath && canroll && !isrunning && !isattacking && !quitthestam && !stoprec)
{
StartCoroutine("addstamina");
}
else
void tasks()
{
//in this if parameter we declare the range where the enemy starts following or not
if (Mathf.Abs(transform.position.x - target.transform.position.x) > vision_range && !attackmode)
{
calm = true;
}
else
{
if (Mathf.Abs(transform.position.x - target.transform.position.x) < attack_range && !attackmode)
void Start()
{
pl = FindObjectOfType<playercontroller>();
currentscene = SceneManager.GetActiveScene().buildIndex; //get scene int for save
m_Scene = SceneManager.GetActiveScene(); //get scene name for zone text
sceneName = m_Scene.name;
}