public static aiBehaviorNode attackTarget(baseRtsAI rabbit, IRtsUnit target) { return new Node_PrioritySelector (new aiBehaviorNode[] {//change to seletor nested ina sequence new Node_Invert(new Node_Succeeder(new Node_SetVariable(rabbit.blackBoard,"Target",target.GetGameObject()))), new Node_Invert ( new Node_Repeat_Until_Fail ( pierBehaviorsubTrees.killTarget(rabbit,"Target") ) ), new Node_MoveTo_With_Astar(rabbit.gameObject, rabbit.m_unit,rabbit.SeekarriveRadius,target.GetGameObject().transform.position) } ); }
void OnEnable() { stats = this.gameObject.GetComponent<IRtsUnit>(); RTSUnitManager.Register(this); }
public static void giveOrder(baseRtsAI unit, OrderType type, IRtsUnit target) { if (unit.stats != target) { EnqueueComand(unit, attackTarget(unit, target)); } }
public static void giveOrders(List<baseRtsAI> Selection, OrderType type, IRtsUnit target) { foreach (baseRtsAI rabbit in Selection) { //aiBehaviorNode commande = UnitOrders.moveComand(rabbit,hit.point); if (rabbit != null) { giveOrder(rabbit, type, target); } } }
// Use this for initialization void Awake() { stats = this.gameObject.GetComponent<IRtsUnit>(); builder = this.gameObject.GetComponent<UnitBuilder>(); }