public void ChangeDefaultWeapon() { SkillWeaponInfo info = new SkillWeaponInfo(); info.Operate = WeaponCmd.HoldDefault; ChangeWeapon(info); }
public SkillWeaponInfo GetCurMainWeaponInfo(MasterWeaponType masterType = MasterWeaponType.Master) { int weaponId = GetCurWeaponId(masterType); SkillWeaponInfo info = TriggerImpl.GetWeaponInfoById(this.gameObject, weaponId); return(info); }
public void ChangeWeapon(SkillWeaponInfo info) { if (info.IsCurWeapon) { #if SHOOTER_LOG Debug.Log("CurWeapon:" + info.Id); #endif m_CurWeaponId = info.Id; } else if (info.IsCurSubWeapon) { #if SHOOTER_LOG Debug.Log("CurWeapon:" + info.Id); #endif m_CurSubWeaponId = info.Id; } WeaponCmd operate = info.Operate; if (WeaponCmd.Hold == operate) { DropWeapon(info.HoldType); HoldWeapon(info.HoldType, info); } else if (WeaponCmd.HoldOnly == operate) { DropWeapon(WeaponHand.LeftHand); DropWeapon(WeaponHand.RightHand); HoldWeapon(info.HoldType, info); } else if (WeaponCmd.Drop == operate) { DropWeapon(info.HoldType); } else if (WeaponCmd.DropAll == operate) { DropWeapon(WeaponHand.LeftHand); DropWeapon(WeaponHand.RightHand); } else if (WeaponCmd.HoldDefault == operate) { SkillWeaponInfo defaltInfo = TriggerImpl.GetWeaponInfoById(this.gameObject, DefaultWeaponId); if (defaltInfo != null && defaltInfo.Operate != WeaponCmd.HoldDefault) { ChangeWeapon(defaltInfo); } } else if (WeaponCmd.HoldMain == operate) { SkillWeaponInfo masterWeaponInfo = TriggerImpl.GetCurWeaponInfo(this.gameObject, MasterWeaponType.Master); SkillWeaponInfo subMasterWeaponInfo = TriggerImpl.GetCurWeaponInfo(this.gameObject, MasterWeaponType.SubMaster); if (masterWeaponInfo != null && masterWeaponInfo.Operate != WeaponCmd.HoldMain) { TriggerImpl.ChangeWeapon(this.gameObject, masterWeaponInfo); } if (subMasterWeaponInfo != null && masterWeaponInfo.Operate != WeaponCmd.HoldMain) { TriggerImpl.ChangeWeapon(this.gameObject, subMasterWeaponInfo); } } }
public static void GetWeaponInfoByCategory(GameObject target, int id) { SkillWeaponInfo info = GetWeaponInfoById(target, id); if (info != null) { ChangeWeapon(target, info); } }
public static void ChangeWeapon(GameObject target, SkillWeaponInfo param) { WeaponControl control = target.GetComponent <WeaponControl>(); if (control == null) { LogicSystem.GfxLog("ShooterSkillExecutor WeaponControl Script miss!"); } control.ChangeWeapon(param); }
public GameObject GetCurMainWeapon(MasterWeaponType masterType = MasterWeaponType.Master) { SkillWeaponInfo info = GetCurMainWeaponInfo(masterType); if (info == null) { return(null); } return(GetWeaponByHand(info.HoldType)); }
private void HoldWeapon(WeaponHand type, SkillWeaponInfo info) { GameObject newWeapon = CreateNewWeapon(info); if (newWeapon != null) { #if SHOOTER_LOG Debug.Log("HoldWeapon:" + newWeapon.name); #endif m_Weapons.Add(info.HoldType, newWeapon); Script_Util.AttachGameObject(this.gameObject, newWeapon, GetBoneName(info.HoldType)); } }
private GameObject CreateNewWeapon(SkillWeaponInfo info) { GameObject tWeaponObj = null; if (info.WeaponAsset != null) { tWeaponObj = Script_Util.CreateGameObjectByAsset(info.WeaponAsset); } else { tWeaponObj = Script_Util.CreateGameObjectByName(info.WeaponName); } return(tWeaponObj); }
public SkillWeaponInfo Clone() { SkillWeaponInfo newData = new SkillWeaponInfo(); newData.IsValid = IsValid; newData.Id = Id; newData.WeaponName = WeaponName; newData.WeaponAsset = WeaponAsset; newData.Operate = Operate; newData.HoldType = HoldType; newData.IsCurWeapon = IsCurWeapon; newData.IsCurSubWeapon = IsCurSubWeapon; newData.SpriteName = SpriteName; return(newData); }
/// param:Id[对应到SkillSceneObjManager中的WeaponInfo Id] /// example:1 public void Trigger_ChangeMainWeapon() { #if SHOOTER_LOG Debug.Log("Trigger_ChangeWeapon param:" + param); #endif SkillWeaponInfo masterWeaponInfo = TriggerImpl.GetCurWeaponInfo(this.gameObject, MasterWeaponType.Master); SkillWeaponInfo subMasterWeaponInfo = TriggerImpl.GetCurWeaponInfo(this.gameObject, MasterWeaponType.SubMaster); if (masterWeaponInfo != null) { TriggerImpl.ChangeWeapon(this.gameObject, masterWeaponInfo); } if (subMasterWeaponInfo != null) { TriggerImpl.ChangeWeapon(this.gameObject, subMasterWeaponInfo); } }
/// param:Id[对应到SkillSceneObjManager中的WeaponInfo Id] /// example:1 public void Trigger_ChangeWeapon(string param) { #if SHOOTER_LOG Debug.Log("Trigger_ChangeWeapon param:" + param); #endif if (m_SceneObjMgr != null) { SkillSceneObjInfo sobjInfo = new SkillSceneObjInfo(param); SkillWeaponInfo moveInfo = m_SceneObjMgr.TryGetSkillWeaponInfo(sobjInfo.Id); if (moveInfo != null) { TriggerImpl.ChangeWeapon(this.gameObject, moveInfo); } else { Debug.Log("Trigger_ChangeWeapon null!"); } } }
void OnClick() { if (LogicSystem.PlayerSelf != null) { IShooterSkill curSkill = TriggerImpl.GetCurSkill(LogicSystem.PlayerSelf); if (curSkill != null && curSkill.IsExecuting()) { return; } TriggerImpl.SwitchNextWeapon(LogicSystem.PlayerSelf); SkillWeaponInfo info = TriggerImpl.GetCurWeaponInfo(LogicSystem.PlayerSelf); if (info != null) { UISprite sp = this.GetComponent <UISprite>(); if (null != sp) { sp.spriteName = info.SpriteName; } } } }