private void Awake() { PlayerHP = MaxHp; Playertr = Playertr.GetComponent <Joystick2>(); joystick = GameObject.Find("JoystickBackground"); r2d = GetComponent <Rigidbody2D>(); PlayerHpUi = PlayerHpUi.GetComponent <Image>(); PlayerSkillUi = PlayerSkillUi.GetComponent <Image>(); PlayerHeroModeAttackbtn = PlayerHeroModeAttackbtn.GetComponent <Image>(); audi = gameObject.GetComponent <AudioSource>(); Camera = GameObject.FindWithTag("MainCamera").GetComponent <CameraShake>(); MainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>(); Attackcount = 1; NextAttack = false; }
public override void Start() { base.Start(); // Check if Joystick exists if (Input.GetJoystickNames().Length > 0) { if (!switchControls) { connectedController = new Joystick2(); } else { connectedController = new Joystick1(); } } }
public override void Start() { base.Start(); CalculateRayCastPoints(); gravity = (2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2) * 0.2f; jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; scale = transform.localScale; // Check if Joystick exists if (Input.GetJoystickNames().Length > 0) { if (!switchControls) { connectedController = new Joystick1(); } else { connectedController = new Joystick2(); } } footStepInstance = FMODUnity.RuntimeManager.CreateInstance(footStepEvent); }