Esempio n. 1
0
    private void Update()
    {
        //light up each hand in turn
        foreach (PlayerID id in System.Enum.GetValues(typeof(PlayerID)))
        {
            if ((int)id > 1)
            {
                continue;
            }
            Ready ready = FindCorrectReady(id);
            if (InputManager.GetButtonDown("Shoot1", id) && InputManager.GetButtonDown("Shoot2", id))
            {
                ready.ToggleReady();
            }
            if (ready.IsReady())
            {
                continue;
            }

            foreach (HandType hand in System.Enum.GetValues(typeof(HandType)))
            {
                if (InputManager.GetButtonDown(hand.ToString(), id))
                {
                    weapons.ChangeWeapon(id, (int)hand);
                    SetKeyAndSprite(id, hand);
                    keyText.color = changeColor;
                    GameObject weapon = weapons.weapons[weapons.GetWeaponIndex(hand, id)];
                    weaponSprite.sprite = weapon.transform.Find("Gun").GetComponent <SpriteRenderer>().sprite;
                    weaponSprite.color  = weapon.transform.Find("Gun").GetComponent <SpriteRenderer>().color;
                    weaponText.text     = weapon.name;
                }
                else if (InputManager.GetButtonUp(hand.ToString(), id))
                {
                    SetKeyAndSprite(id, hand);
                    keyText       = key.GetComponent <Graphic>();
                    keyText.color = initialColor;
                }
            }
        }

        bool readyCheck = true;

        foreach (GameObject readyIcon in ReadyIcons)
        {
            readyCheck &= readyIcon.GetComponent <Ready>().IsReady();
        }
        if (readyCheck)
        {
            SceneManager.LoadScene("MediumMap");
        }
    }