Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (isMainMenu)
     {
         if (TCKInput.GetButtonDown("btnFps"))
         {
             Application.LoadLevel("FirstPerson");
         }
         //
         if (TCKInput.GetButtonDown("btnPlatf"))
         {
             Application.LoadLevel("2DPlatformer");
         }
         //
         if (TCKInput.GetButtonDown("btnBal"))
         {
             Application.LoadLevel("TiltBallDemo");
         }
         //
         if (TCKInput.GetButtonDown("btnCar"))
         {
             Application.LoadLevel("WheelCarDemo");
         }
     }
     else
     {
         //
         if (TCKInput.GetButtonUp("mButton"))
         {
             Application.LoadLevel("mainMenu");
         }
     }
 }
Exemplo n.º 2
0
        // Update
        void Update()
        {
            grounded = Physics2D.Linecast(transform.position, groundCheck.position, 1 << LayerMask.NameToLayer("Default"));

            if (TCKInput.GetButtonDown("jumpButton") && grounded)
            {
                jump = true;
            }
        }
Exemplo n.º 3
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (!this.killed)
        {
            //Attack
            if (TCKInput.GetButtonDown("Button0") && Time.time > nextFire)
            {
                attack = true;
            }

            // Store the input axes.
    #if UNITY_EDITOR
            // h = Input.GetAxisRaw("Horizontal");
            // v = Input.GetAxisRaw("Vertical");
    #endif
    #if UNITY_ANDROID
            h = TCKInput.GetAxis("Joystick0", AxisType.X);
            v = TCKInput.GetAxis("Joystick0", AxisType.Y);
    #endif

            // Move the player around the scene.
            Move(h, v);

            // Turn the player to face the mouse cursor.
            Turning(h, v);

            if (attack)
            {
                Shoot();
                attack = false;
            }
        }
        else
        {
            // Player is dead, play dead sound once...
            if (!cried)
            {
                audio.PlayOneShot(cry);
                cried = true;
            }
            // ... and make it smaller until is almost invisble and destroy it.
            GetComponent <Animator>().enabled = false;
            Vector3 scale    = transform.localScale;
            Vector3 newScale = new Vector3(scale.x * 0.95f, scale.y * 0.95f, scale.z * 0.95f);
            transform.localScale = newScale;
            if (newScale.x < 0.1f)
            {
                gameController.GameOver();
            }
        }
    }
Exemplo n.º 4
0
        // Update
        void Update()
        {
            if (TCKInput.GetButtonDown("shootButton"))
            {
                anim.SetTrigger("Shoot");

                if (playerCtrl.facingRight)
                {
                    Rigidbody2D bulletInstance = Instantiate(rocket, transform.position, Quaternion.Euler(Vector3.zero)) as Rigidbody2D;
                    bulletInstance.velocity = new Vector2(speed, 0f);
                }
                else
                {
                    Rigidbody2D bulletInstance = Instantiate(rocket, transform.position, Quaternion.Euler(new Vector3(0f, 0f, 180f))) as Rigidbody2D;
                    bulletInstance.velocity = new Vector2(-speed, 0f);
                }
            }
        }