public override void OnEnable() { s_Initialize_p.Begin(); mAgent = GetComponent <UrbAgent>(); mPathfinder = GetComponent <UrbPathfinder>(); mMovement = GetComponent <UrbMovement>(); mPerception = GetComponent <UrbPerception>(); BreedUrge = 0; HungerUrge = 0; RestUrge = 0; SafetyUrge = 0; base.OnEnable(); s_Initialize_p.End(); }
public override float Execute(UrbAgent Instigator, UrbAgent Target, float Modifier = 0) { s_MoveAction_p.Begin(Instigator); float Result = Test(Instigator, Modifier); Result = Instigator.mBody.UtilizeBody(Result); if (Result > 0) { s_MoveAction_p_e.Begin(); UrbPathfinder Pathfinder = Instigator.GetComponent <UrbPathfinder>(); UrbMovement Movement = Instigator.GetComponent <UrbMovement>(); UrbTile Goal = null; if (!Pathfinder.WasDestroyed && Pathfinder.isActiveAndEnabled) { Goal = Pathfinder.GetNextGoal(); } if (!Movement.WasDestroyed && Movement.isActiveAndEnabled) { if (Goal != null && Goal != Instigator.CurrentTile) { DisplayActionIcon(Instigator, Instigator.Location); float AdjustedResult = Result / 10; Movement.Speed = AdjustedResult; Movement.EnergyCost = AdjustedResult; Movement.MoveTo(Goal); } s_MoveAction_p_e.End(); } else { s_MoveAction_p_e.End(); s_MoveAction_p.End(); //Debug.LogWarning("Illegal Action: Move Action Called on " + Instigator.name + " this Agent has no UrbMovement Component"); return(0); } } s_MoveAction_p.End(); return(Result); }