Esempio n. 1
0
    public void ChangeWeapon(Transform weapon, out Color color)
    {
        Transform tmpWpn = weapon;

        if (leftOn)
        {
            if (LeftSlot.activeWeapon != null && RightSlot.activeWeapon == tmpWpn)
            {
                RightSlot.activeWeapon = LeftSlot.activeWeapon;
                WeaponHandler.instance.SetColorByObject(Color.red, RightSlot.activeWeapon.gameObject);
            }
            else
            {
                LeftSlot.EmptySlot();
            }
            if (RightSlot.activeWeapon != null)
            {
                RightSlot.activeWeapon.gameObject.SetActive(false);
            }
            LeftSlot.activeWeapon = weapon;
            color           = Color.blue;
            sprite.material = Blue;
        }
        else
        {
            if (LeftSlot.activeWeapon == tmpWpn)
            {
                LeftSlot.activeWeapon = RightSlot.activeWeapon;
                WeaponHandler.instance.SetColorByObject(Color.blue, LeftSlot.activeWeapon.gameObject);
            }
            else
            {
                RightSlot.EmptySlot();
            }
            if (LeftSlot.activeWeapon != null)
            {
                LeftSlot.activeWeapon.gameObject.SetActive(false);
            }
            RightSlot.activeWeapon = weapon;
            color           = Color.red;
            sprite.material = Red;
        }
    }