Esempio n. 1
0
        void ChangeArmsState(ItemEnum.ItemType itemType)
        {
            switch (itemType)
            {
            case ItemEnum.ItemType.missile:
                PlayerPropertyInstance.armsFsm.ToMissileState();
                break;

            case ItemEnum.ItemType.pistol:
                PlayerPropertyInstance.armsFsm.ToPistolState();
                break;

            case ItemEnum.ItemType.rifle:
                PlayerPropertyInstance.armsFsm.ToRifleState();
                break;

            case ItemEnum.ItemType.grenade:
                PlayerPropertyInstance.armsFsm.ToGrenadeState();
                break;

            default:
                break;
            }
            PlayerPropertyInstance.playerAmination.PlaySwitchAnimation(PlayerPropertyInstance.armsFsm.CurrentState.StateName);
        }
Esempio n. 2
0
 int GetOrder(ItemEnum.ItemType itemType)
 {
     foreach (var item in order)
     {
         if (item.Value == itemType)
         {
             return(item.Key);
         }
     }
     return(0);
 }
Esempio n. 3
0
        public GameObject CreateItem(ItemEnum.ItemType itemType)
        {
            GameObject go;

            switch (itemType)
            {
            case ItemEnum.ItemType.missile:
                go = GameObjectPool.instance.GetGameObject("rocket");
                if (!go)
                {
                    go = GameObject.Instantiate(rocket);
                }
                break;

            case ItemEnum.ItemType.pistol:
                go = GameObjectPool.instance.GetGameObject("bullet");
                if (!go)
                {
                    go = GameObject.Instantiate(bullet);
                }
                break;

            case ItemEnum.ItemType.rifle:
                go = GameObjectPool.instance.GetGameObject("rifleBullet");
                if (!go)
                {
                    go = GameObject.Instantiate(rifleBullet);
                }
                break;

            case ItemEnum.ItemType.grenade:
                go = GameObjectPool.instance.GetGameObject("grenade");
                if (!go)
                {
                    go = GameObject.Instantiate(grenade);
                }
                break;

            default:
                go = GameObjectPool.instance.GetGameObject("rocket");
                if (!go)
                {
                    go = GameObject.Instantiate(rocket);
                }
                break;
            }
            if (NetMgr.instance)
            {
                NetMgr.instance.SpawnGameObject(go);
            }
            return(go);
        }
Esempio n. 4
0
        // Update is called once per frame
        void KeyQDown()
        {
            if (!PlayerPropertyInstance.canSwitchWeapon)
            {
                return;
            }
            int orderIndex = GetOrder(PlayerPropertyInstance.arms) + 1;

            orderIndex = orderIndex > 4 ? 1 : orderIndex;
            ItemEnum.ItemType itemType = order[orderIndex];
            PlayerPropertyInstance.arms = itemType;
            ChangeArmsState(itemType);
        }
Esempio n. 5
0
 private void Awake()
 {
     canMove             = true;
     canShoot            = true;
     canSwitchWeapon     = true;
     skeletonAnimation   = GetComponent <SkeletonAnimation>();
     playerAmination     = GetComponent <PlayerAmination>();
     playerFsm           = GetComponent <PlayerFSM>();
     armsFsm             = GetComponent <ArmsFSM>();
     EventCenterInstance = GetComponent <EventCenter>();
     playerDamage        = GetComponent <PlayerDamage>();
     _inputMgr           = GetComponent <InputMgr>();
     playerDamage.PlayerPropertyInstance                         = this;
     playerAmination.PlayerPropertyInstance                      = this;
     GetComponent <PlayerAim>().PlayerPropertyInstance           = this;
     GetComponent <PlayerMove>().PlayerPropertyInstance          = this;
     GetComponent <PlayerShoot>().PlayerPropertyInstance         = this;
     GetComponent <PlayerSwitchWeapons>().PlayerPropertyInstance = this;
     GetComponent <SpineboyBodyTilt>().PlayerPropertyInstance    = this;
     GetComponent <PlayerCamera>().PlayerPropertyInstance        = this;
     arms    = ItemEnum.ItemType.missile;
     healthy = 100;
 }
Esempio n. 6
0
 private void RpcShoow(Iitem item, int faceHorizontal, float angle, float powerValue, ItemEnum.ItemType arms)
 {
     if (item.transform.parent)
     {
         ItemMgr.instance.CreateItem(arms);
     }
     item.Shoot(transform, faceHorizontal, angle, powerValue);
 }