public override bool ValidateAction() { if (Action != null && Action.IsFailed() == true) { return(false); } return(Owner.IsAlive); }
protected void Melee(E_MeleeType meleeType, uLink.NetworkViewID viewID, uLink.NetworkMessageInfo info) { if (Owner.BlackBoard.DontUpdate) { return; } uLink.NetworkView view = uLink.NetworkView.Find(viewID); if (null == view) { // target was just destroyed return; } Agent targetAgent = view.GetComponent <Agent>(); if (targetAgent == null) { return; // wtf ? } #if !DEADZONE_CLIENT if (Owner.IsServer) { if (!ServerAnticheat.ReportAndValidateMelee(Owner.NetworkView.owner, Owner, targetAgent, info)) { // Ignore the action when it is not valid. This may happen even in a regular/fair game when // an attacking playerexperiences a lag. return; } } #endif AgentActionMelee a = AgentActionFactory.Create(AgentActionFactory.E_Type.Melee) as AgentActionMelee; a.Target = targetAgent; a.MeleeType = meleeType; Owner.BlackBoard.ActionAdd(a); if (a.IsFailed()) { return; // wtf ? } if (Owner.IsServer) { //send to proxies Owner.NetworkView.RPC("Melee", uLink.RPCMode.OthersExceptOwner, meleeType, viewID); //knockdown target immediatly, its player, we dont have time wait .... Vector3 direction = (a.Target.Position - Owner.Position).normalized; a.Target.KnockDown(Owner, meleeType, direction); } //Debug.Log(Time.timeSinceLevelLoad + " " + "Melee " + a.MeleeType + " " + a.Target.name); }