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); }
int GetOrder(ItemEnum.ItemType itemType) { foreach (var item in order) { if (item.Value == itemType) { return(item.Key); } } return(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); }
// 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); }
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; }
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); }