public void ResetWeaponOnly(int[] usables) { deltaTime = 0f; ClearAllWeapons(); for (int i = 0; i < usables.Length; i++) { string empty = string.Empty; if (usables[i] != 4) { TItem.SLOT slot = (TItem.SLOT)(2 + usables[i]); Item currentWeaponBySlot = MyInfoManager.Instance.GetCurrentWeaponBySlot(slot); empty = currentWeaponBySlot.Code; } else { empty = RoomManager.Instance.ModeSpecificWeaponCode; } equipments[usables[i]] = null; if (empty.Length > 0) { equipments[usables[i]] = Equip(empty); } } prevWeaponType = -1; currentWeaponType = (int)RoomManager.Instance.DefaultWeaponType; VerifyNextWeapon(); WeaponChanger component = GetComponent <WeaponChanger>(); if (null != component) { component.Initialize(equipments); } SwapWeapon(initiallyDrawn: true); }
public void catchBuildGun(int[] usables) { deltaTime = 0f; ClearAllWeapons(); for (int i = 0; i < usables.Length; i++) { string empty = string.Empty; if (usables[i] != 4) { TItem.SLOT slot = (TItem.SLOT)(2 + usables[i]); empty = MyInfoManager.Instance.GetUsingBySlot(slot); } else { empty = "Composer3"; } equipments[usables[i]] = null; if (empty.Length > 0) { equipments[usables[i]] = Equip(empty); } } prevWeaponType = -1; currentWeaponType = 4; VerifyNextWeapon(); WeaponChanger component = GetComponent <WeaponChanger>(); if (null != component) { component.Initialize(equipments); } SwapWeapon(initiallyDrawn: true); }
public bool SetCurrent(int slot) { if (slot < 0 || slot >= equipments.Length) { return(false); } if (equipments[slot] == null) { return(false); } WeaponFunction component = equipments[slot].GetComponent <WeaponFunction>(); if (null == component) { return(false); } if (slot == currentWeaponType) { return(false); } if (component.weaponBy == Weapon.BY.CLOCKBOMB && !MyInfoManager.Instance.AmIBlasting()) { return(false); } prevWeaponType = currentWeaponType; currentWeaponType = slot; WeaponChanger component2 = GetComponent <WeaponChanger>(); if (null != component2) { component2.Swap(); } return(true); }
public void Attack(WeaponChanger ws) { if (timeAttack <= 0) { ws.Attack(); timeAttack = behavior.btwAttack; } }
public void Initialize(int[] usables) { deltaTime = 0f; HideDummyMesh(); firstPerson = base.transform.Find(firstPersonBody); if (null == firstPerson) { Debug.LogError("Fail to find first person body "); } else { firstPerson.localPosition = firstPersonOffsetOnEmptyHand; } rightHand = base.transform.Find(rightHandBone); if (null == rightHand) { Debug.LogError("Fail to find right hand bone"); } leftHand = base.transform.Find(leftHandBone); if (null == leftHand) { Debug.LogError("Fail to find left hand bone"); } equipments = new GameObject[5]; for (int i = 0; i < 5; i++) { equipments[i] = null; } for (int j = 0; j < usables.Length; j++) { string empty = string.Empty; if (usables[j] != 4) { TItem.SLOT slot = (TItem.SLOT)(2 + usables[j]); empty = MyInfoManager.Instance.GetUsingBySlot(slot); } else { empty = RoomManager.Instance.ModeSpecificWeaponCode; } equipments[usables[j]] = null; if (empty.Length > 0) { equipments[usables[j]] = Equip(empty); } } prevWeaponType = -1; currentWeaponType = (int)RoomManager.Instance.DefaultWeaponType; VerifyNextWeapon(); WeaponChanger component = GetComponent <WeaponChanger>(); if (null != component) { component.Initialize(equipments); } SwapWeapon(initiallyDrawn: true); disableWingEffect(); }
public void GiveGuns() { var persistentScript = GameObject.Find("PlayerSettings").GetComponent <PlayerSettings>(); persistentScript.DisableAssaultRifle = false; persistentScript.DisableRocketLauncher = false; persistentScript.DisableShotgun = false; persistentScript.DisableMouse = false; WeaponChanger.changeWeapon("assaultrifle", GameObject.FindGameObjectWithTag("Player")); persistentScript.currentWeapon = "assaultrifle"; var text = GameObject.Find("TextBoxManager").GetComponent <TextBoxManager>(); text.DialogueTalk(10, 0); }
public bool PickupFromFromInstance(long itemSeq) { Item itemBySequence = MyInfoManager.Instance.GetItemBySequence(itemSeq); if (itemBySequence == null) { return(false); } TWeapon tWeapon = (TWeapon)itemBySequence.Template; if (tWeapon == null) { return(false); } Weapon.TYPE weaponType = tWeapon.GetWeaponType(); string code = tWeapon.code; HideWeapon(equipments[(int)weaponType]); Object.DestroyImmediate(equipments[(int)weaponType]); if (weaponType == Weapon.TYPE.MAIN && WeaponLeft != null) { Object.DestroyImmediate(WeaponLeft); WeaponLeft = null; } GameObject gameObject = Equip(code); if (null == gameObject) { return(false); } WeaponFunction component = gameObject.GetComponent <WeaponFunction>(); if (null == component) { return(false); } component.ItemSeq = itemSeq; equipments[(int)weaponType] = gameObject; prevWeaponType = -1; currentWeaponType = (int)weaponType; WeaponChanger component2 = GetComponent <WeaponChanger>(); if (null != component2) { component2.Initialize(equipments); } return(true); }
public void SwapWeapon(long itemSeq,string itemCode,int ammo,int ammo2) { TWeapon tWeapon = TItemManager.Instance.Get <TWeapon>(itemCode); if (tWeapon != null) { int weaponType = (int)tWeapon.GetWeaponType(); GlobalVars.Instance.DropWeapon(weaponType); HideWeapon(equipments[weaponType]); Object.DestroyImmediate(equipments[weaponType]); equipments[weaponType] = null; if (weaponType == 2 && WeaponLeft != null) { Object.DestroyImmediate(WeaponLeft); WeaponLeft = null; } GameObject gameObject = Equip(itemCode); WeaponFunction component = gameObject.GetComponent <WeaponFunction>(); if (!(null == component)) { component.ItemSeq = itemSeq; equipments[weaponType] = gameObject; prevWeaponType = -1; currentWeaponType = weaponType; WeaponChanger component2 = GetComponent <WeaponChanger>(); if (null != component2) { component2.Initialize(equipments); component2.Swap(); } GetComponent <LocalController>().SwitchWeapon(); GetComponent <LocalController>().ToIdle(); Gun component3 = equipments[weaponType].GetComponent <Gun>(); if (component3 != null) { component3.PickedAmmo = ammo; component3.PickedAmmo2 = ammo2; } } } }
public override void Inititialize() { ammoCounter = WorldState.AmmoCounter; weaponChanger = WorldState.WeaponChanger; }