/*************************************** * 匹配是否可以攻击怪物 * * *************************************/ public static bool MatchEnemyAttack(PeEntity npc, PeEntity target) { if (npc == null || target == null) { return(false); } //NPC 不攻击 ragdoll状态怪物 if (target.isRagdoll) { return(false); } //外星人NPC不做检测,都默认为可以攻击 if (npc.IsMotorNpc) { return(true); } bool hasRangeEquip = HasCanEquip(npc, EeqSelect.combat, AttackType.Ranged); //bool hasCloseEquip = HasCanEquip(npc,EeqSelect.combat,AttackType.Melee); bool isBoss = target.IsBoss; float hpNpc = npc.GetAttribute(AttribType.Hp); float hpNpcMax = npc.GetAttribute(AttribType.HpMax); //float atkNpc = npc.GetAttribute(AttribType.Atk); //float defNpc = npc.GetAttribute(AttribType.Def); //float enemyAtk = target.GetAttribute(AttribType.Atk); bool hpEnough = hpNpc > hpNpcMax * NPCConstNum.ATK_MIN_HP; //enemyAtk - defNpc < hpNpc * 0.3f; MovementField mFeild = target.Field; switch (mFeild) { case MovementField.Land: case MovementField.water: { if (hasRangeEquip) { return(true); } if (isBoss) { return(false); } return(hpEnough); } case MovementField.Sky: { return(hasRangeEquip); } default: break; } return(true); }
private void SetNewModel(int modelID) { if (modelID == m_CurMonsterID) { return; } this.m_CurAnimator = null; this.m_MovementField = MovementField.None; DestoryCurModel(); this.m_PeViewCtrl.viewCam.enabled = false; this.m_CurMonsterGo = SpeciesViewStudio.LoadMonsterModelByID(modelID, ref m_MovementField); this.m_CurMonsterID = modelID; if (null == m_CurMonsterGo) { return; } this.m_CurAnimator = m_CurMonsterGo.GetComponent <Animator>(); this.m_PeViewCtrl.SetTarget(this.m_CurMonsterGo.transform); this.m_OpCameraStep = 1; }
/*************************************** * 匹配是否有合适的武器 *************************************/ public static bool MatchEnemyEquip(PeEntity npc, PeEntity target) { if (npc == null || target == null) { return(false); } //外星人NPC不做检测,都默认为可以攻击 if (npc.IsMotorNpc) { return(true); } if (target.IsBoss) { return(HasCanEquip(npc, EeqSelect.combat, AttackType.Ranged)); } MovementField mFeild = target.Field; switch (mFeild) { case MovementField.Land: return(true); case MovementField.Sky: return(HasCanEquip(npc, EeqSelect.combat, AttackType.Ranged)); case MovementField.water: return(true); case MovementField.Amphibian: return(true); default: break; } return(false); }
public MovementLimiter(Motion_Move_Motor motor, MovementField movementField) { m_MotionMove = motor; m_Trans = m_MotionMove.GetComponent <PeTrans>(); m_MovementField = movementField; }