public override void Init() { Debug.Log("S"); _rootNode = new BTPrioritySelector(null); ValueCondition vc = new ValueCondition(10, true); ValueCondition vd = new ValueCondition(10, false); DieCondition die = new DieCondition(); EnemyInSight sight = new EnemyInSight(); CheckSelfToTargetDistance CTD = new CheckSelfToTargetDistance(vo.AttackDistance, false); CheckSelfToTargetDistance CTD2 = new CheckSelfToTargetDistance(vo.AttackDistance, true); AiTestAction1 first = new AiTestAction1(vc); AiTestAction2 second = new AiTestAction2(vd); BTDieAction dieAction = new BTDieAction(3); BTPortalAction portalAction = new BTPortalAction(); BTAttackAction attackAction = new BTAttackAction(vo.AttackCD); BTChaseAction ChaseAction = new BTChaseAction(); BTParallel p = new BTParallel(die); _rootNode.AddChild(p); p.AddChild(dieAction); p.AddChild(new PlayAnimatorAction("Die")); BTPrioritySelector Select = new BTPrioritySelector(null); BTPrioritySelector Select2 = new BTPrioritySelector(null); BTParallel p2 = new BTParallel(ParallelFunction.And, sight); _rootNode.AddChild(Select); Select.AddChild(p2); p2.AddChild(portalAction); p2.AddChild(new PlayAnimatorAction("Run")); Select.AddChild(Select2); BTParallel p3 = new BTParallel(ParallelFunction.And, CTD); p3.AddChild(attackAction); p3.AddChild(new PlayAnimatorAction("attack1")); BTParallel p4 = new BTParallel(ParallelFunction.Or, null); p4.AddChild(ChaseAction); p4.AddChild(new PlayAnimatorAction("Run")); Select2.AddChild(p3); Select2.AddChild(p4); }
public static List <int> DiceRoller(int numberOfDice, int sidesOnDie, DieCondition conditioner) { var diceList = new List <int>(); for (int i = 0; i < numberOfDice; i++) { diceList.Add(RandomGenerator(1, sidesOnDie + 1)); } diceList.Sort(); switch (conditioner) { case DieCondition.None: break; case DieCondition.KeepLowest: diceList.RemoveRange(1, diceList.Count - 1); break; case DieCondition.KeepHighest: diceList.RemoveRange(0, diceList.Count - 2); break; case DieCondition.DropLowest: diceList.RemoveAt(0); break; case DieCondition.DropHighest: diceList.RemoveAt(diceList.Count - 1); break; default: break; } return(diceList); }