Пример #1
0
        private void FixedUpdate()
        {
            if (invItem != null)
            {
                if (invItem is ConsumableItem)
                {
                    ConsumableItem it = (invItem as ConsumableItem);
                    
                    if (Text != null)
                    {
                        Text.text = it.Units + "/" + it.getConsumableStats().MaxUnits;
                    }

                    countDown.fillAmount = it.GetActualUseState();
                } 
                else if (invItem is GunController)
                {
                    GunController it = (invItem as GunController);
                    if (Text != null)
                    {
                        Text.text = it.FireState.mode + "\n" + it.ActualAmmo + "/" + it.getGunStats().maxClip;
                    }

                }
            }

           
        }
Пример #2
0
        public void GunControl()
        {
            ItemController selectedWeapon = inventary.GetSelectedAt("PrimaryWeapon");

            if (selectedWeapon != null)
            {
                selectedWeapon.Show();
                if (selectedWeapon is GunController)
                {
                    states.Armed = true;
                    GunController GUN = (selectedWeapon as GunController);
                    this.SetHandState(GUN.getGunStats().HandsState);

                    ik.LeftHandPosition  = GUN.leftHandPosition;
                    ik.LeftElbowPosition = GUN.leftElbowPosition;

                    if (Player)
                    {
                        GUN.DrawCrossHair(cam);

                        if (!states.Inventary)
                        {
                            if (states.Shooting)
                            {
                                if (!GUN.Attack(this))
                                {
                                    notShooting = false;
                                }
                            }
                            else if (states.Reloading)
                            {
                                GUN.Use(this);
                            }
                            else if (states.FireMode)
                            {
                                GUN.NextFireState();
                            }
                        }
                    }
                }
                else
                {
                    states.Armed = false;
                }
            }
            else
            {
                states.Armed = false;
            }



            InventaryGroup weaponGroup = inventary.GetGroup("PrimaryWeapon");

            if (weaponGroup != null)
            {
                if (states.W1)
                {
                    weaponGroup.Select(0);
                }
                if (states.W2)
                {
                    weaponGroup.Select(1);
                }
                if (states.W3)
                {
                    weaponGroup.Select(2);
                }
            }
        }