Exemplo n.º 1
0
    void Update()
    {
        if (Input.GetMouseButton(0) && IsGrounded)
        {
            body.velocity = Vector2.up * tapforce;
            SoundCTRL.PlaySound("Jump");
        }

        /*if(Input.GetMouseButton(1))
         * {
         *  body.velocity = Vector2.right * tapforce;
         * }*/
    }
Exemplo n.º 2
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (soundEffects == null)
        {
            soundEffects = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <SoundEffectsManager>();
        }
        if (!WindowsCTRL.activeSelf)
        {
            if (Input.GetKeyDown(KeyCode.UpArrow) && lookAt > 0)
            {
                if (soundEffects != null)
                {
                    soundEffects.playPositiveSound();
                }
                --lookAt;
                GetComponent <RectTransform>().anchoredPosition = stuff[lookAt].GetComponent <RectTransform>().anchoredPosition;
            }
            else if (Input.GetKeyDown(KeyCode.DownArrow) && lookAt < (stuff.Length - 1))
            {
                if (soundEffects != null)
                {
                    soundEffects.playPositiveSound();
                }
                ++lookAt;
                GetComponent <RectTransform>().anchoredPosition = stuff[lookAt].GetComponent <RectTransform>().anchoredPosition;
            }
            if (Input.GetKeyDown(KeyCode.Return))
            {
                if (soundEffects != null)
                {
                    soundEffects.playPositiveSound();
                }
                switch (lookAt)
                {
                case 0:
                {
                    WindowsCTRL.SetActive(!WindowsCTRL.activeSelf);
                    break;
                }

                case 1:
                {
                    //some other things
                    SoundCTRL.SetActive(!SoundCTRL.activeSelf);
                    break;
                }
                }
            }
        }
    }
Exemplo n.º 4
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.gameObject.tag == "ScoreZone")
     {
         SoundCTRL.PlaySound("Coin");
         OnPlayerScored();
     }
     if (collider.gameObject.tag == "DeadZone")
     {
         SoundCTRL.PlaySound("Dead");
         body.simulated = false;
         OnPlayerDied();
     }
 }