void CycleWeapons() { if (m_currentWeaponTime < m_weaponChangeTime) { m_currentWeaponTime += Time.deltaTime; } if (m_currentWeaponTime >= m_weaponChangeTime) { int type = -1; type = UnityEngine.Random.Range(0, (int)WeaponMgr.WeaponType.WEAPON_COUNT); if (type == (int)WeaponMgr.ACTIVE_WEAPON_TYPE) { if (type > 0) { type -= 1; } else { type += 1; } } //Debug.Log("Weapon taaaaaaip: " + type); WeaponMgr.ChangeWeapon((WeaponMgr.WeaponType)type); // re-init weapon bs m_currentWeaponTime = 0; m_weaponChangeTime = UnityEngine.Random.Range(minRange, maxRange); //Debug.Log("Weapon cycle time: " + m_weaponChangeTime); } }
private void Awake() { actCtrl = GetComponent <Actor_Controller>(); GameObject model = actCtrl.model; GameObject sensor = null; try { sensor = transform.Find("sensor").gameObject; } catch (System.Exception) { // // if there is no sensor object // } btlMgr = Bind <BattleMgr>(sensor); wpnMrg = Bind <WeaponMgr>(model); staMgr = Bind <StateMgr>(gameObject); dirMgr = Bind <DirectorMgr>(gameObject); intMgr = Bind <InterationMgr>(sensor); actCtrl.OnAction += DoAction; }
public Collider CreateWeapon(string weaponName, string side, WeaponMgr wpnMgr) { WeaponCtrl weaponCtrl; if (side == "L") { weaponCtrl = wpnMgr.wpnCtrlL; } else if (side == "R") { weaponCtrl = wpnMgr.wpnCtrlR; Debug.Log("weaponCtrl:" + weaponCtrl + ",WeaponMgr:" + wpnMgr + ",weaponCtrlR:" + wpnMgr.wpnCtrlR); } else { return(null); } GameObject prefab = Resources.Load(weaponName) as GameObject; GameObject obj = GameObject.Instantiate(prefab); obj.transform.parent = weaponCtrl.transform; obj.transform.localPosition = Vector3.zero; obj.transform.localRotation = Quaternion.identity; WeaponData wpnDat = obj.AddComponent <WeaponData>(); wpnDat.ATK = weaponDB.WeaponDatabase[weaponName]["ATK"].f; weaponCtrl.wData = wpnDat; Collider result = obj.GetComponent <Collider>(); return(result); }
private void Awake() { if (_instance == null) { _instance = this; } if (_instance != this) { Destroy(_instance); } }
protected override void InitDamage() { ItemItem weaponItem = Global.gApp.gGameData.GetItemDataByName(GameConstVal.WTank_turret); m_DtTime = weaponItem.dtime; WeaponMgr weaponMgr = Global.gApp.gSystemMgr.GetWeaponMgr(); GunsPass_dataItem weaponLevelData = Global.gApp.CurScene.GetGunPassDataItem(); double atk = weaponLevelData.Tank_turret[(int)MWeapon.Atk]; m_Damage = atk; }
public override void OnStart() { this.m_type = WeaponMgr.WeaponType.Horse; WeaponMgr.AddWeapon(this); if (WeaponMgr.ACTIVE_WEAPON) { WeaponMgr.ACTIVE_WEAPON.gameObject.SetActive(false); } WeaponMgr.ACTIVE_WEAPON = this; WeaponMgr.ACTIVE_WEAPON.gameObject.SetActive(true); MuzzleFlash.SetActive(false); m_anim = transform.GetComponent <Animator>(); }
protected override void InitDamage() { ItemItem weaponItem = Global.gApp.gGameData.GetItemDataByName(GameConstVal.WBounceGun); m_DtTime = weaponItem.dtime / Global.gApp.gSystemMgr.GetSkillMgr().GetHitTimeSkillParam(); WeaponMgr weaponMgr = Global.gApp.gSystemMgr.GetWeaponMgr(); int gunLevel = weaponMgr.GetWeaponLevel(GameConstVal.WBounceGun); Guns_dataItem weaponLevelData = Global.gApp.gGameData.GunDataConfig.Get(gunLevel); double atk = weaponLevelData.weapon_bouncegun[(int)MWeapon.Atk]; if (GetRealQuality(weaponItem) > 0) { atk = weaponLevelData.weapon_bouncegun_super[(int)MWeapon.Atk]; } SetDamage(atk); }
public override void OnStart() { this.m_type = WeaponMgr.WeaponType.Automatic; WeaponMgr.AddWeapon(this); if (WeaponMgr.ACTIVE_WEAPON) { WeaponMgr.ACTIVE_WEAPON.gameObject.SetActive(false); } WeaponMgr.ACTIVE_WEAPON = this; WeaponMgr.ACTIVE_WEAPON.gameObject.SetActive(true); Debug.Log("AKK"); if (MuzzleFlash != null) { MuzzleFlash.SetActive(false); } m_anim = transform.GetComponent <Animator>(); }
void ListenToWeaponCycle() { WeaponMgr.WeaponType type = WeaponMgr.ACTIVE_WEAPON.GetWeaponType(); if (OVRGamepadController.GPC_GetButtonDown(OVRGamepadController.Button.LeftShoulder)) { Debug.Log("CYCLE LEFT WPN"); // cycle weapon left if (type > 0) { WeaponMgr.ChangeWeapon(type - 1); } } else if (OVRGamepadController.GPC_GetButtonDown(OVRGamepadController.Button.RightShoulder)) { Debug.Log("CYCLE RIGHT WPN"); // cycle weapon right if (type < (WeaponMgr.WeaponType.WEAPON_COUNT - 1)) { WeaponMgr.ChangeWeapon(type + 1); } } }
public SubWeaponItemStrategy(WeaponMgr subWeaponMgr) { this.subWeaponMgr = subWeaponMgr; }
public ChipItemStrategy(WeaponMgr weaponMgr) { this.weaponMgr = weaponMgr; }
public PetItemStrategy(WeaponMgr petMgr) { this.petMgr = petMgr; }
private void Start() { weaponMgr = GetComponent <WeaponMgr>(); }