public DropResources() { Name = AIActions.DropResources; target = GameObject.FindGameObjectWithTag("Village"); Goto = new GoToTarget(target.transform.position); distanceToDrop = 5.0f; preConditions = new List <string> { Elements.HAS_RESOURCES }; postConditions = new List <string> { Elements.VILLAGE_INCREASED_RESOURCES, Elements.IS_IN_VILLAGE }; }
public AttackTarget(GameObject self, GameObject tar) { target = tar; this.self = self; Name = AIActions.Attack; Goto = new GoToTarget(tar.transform.position); attackDistance = 5.0f; preConditions = new List <string> { Elements.ORC_IN_SIGHT, Elements.IS_HEALTHY }; postConditions = new List <string> { Elements.ORC_IS_DEAD }; }
public GatherResource(GameObject tar) { target = tar; Name = AIActions.GatherResources; if (tar == null) { Goto = null; } else { Goto = new GoToTarget(tar.transform.position); } gatherDistance = 5.0f; preConditions = new List <string> { Elements.RESOURCE_IN_SIGHT }; postConditions = new List <string> { Elements.HAS_RESOURCES }; }
public override void Execute(GameObject go) { // Can't gather what there no longer is if (TargetResVars().currentResource < 10) { return; } if (Vector3.Distance(go.transform.position, target.transform.position) < gatherDistance) { TargetResVars().currentResource -= 10; go.GetComponent <CharacterVars> ().currentResource += 10; } else { if (Goto == null) { Goto = new GoToTarget(target.transform.position); } Goto.Execute(go); } }