Пример #1
0
    // Use this for initialization
    void Start()
    {
        if (!(Application.platform == RuntimePlatform.WindowsPlayer ||
              Application.platform == RuntimePlatform.LinuxPlayer ||
              Application.platform == RuntimePlatform.WindowsEditor ||
              Application.platform == RuntimePlatform.LinuxEditor))
        {
            joystick       = FindObjectOfType <Joystick> ();
            buttonFireball = GameObject.FindWithTag("Fireball").GetComponent <Joybutton>();
            buttonDash     = GameObject.FindWithTag("Dash").GetComponent <Joybutton>();
            buttonSpecial  = GameObject.FindWithTag("Special").GetComponent <Joybutton>();
            buttonFireball.setCooldown(fireballCooldown);
            buttonDash.setCooldown(dashCooldown);
        }
        canFire         = true;
        canDash         = true;
        canSpecial      = true;
        cameraOffset    = new Vector3(0f, 35f, -25f);
        spellSpawnPoint = this.transform.GetChild(1);

        playerHealth = GetComponent <PlayerHealth> ();

        playerRigidBody          = GetComponent <Rigidbody>();
        mainCamera               = Camera.main.transform;
        playerHealthBar          = this.transform.Find("Healthbar");
        playerHealthBar.rotation = mainCamera.transform.rotation;
    }