void Start() { Selector TreeRoot = new Selector(); Sequence Patrol = new Sequence(); MoveTo MoveToWP = new MoveTo(); PlayerChangeLane playerChangeLane = new PlayerChangeLane(); SelectNextGameObject PickNextWP = new SelectNextGameObject(); //TurnSpeed = 2.0f; //Speed = 5.0f; //Accuracy = 1.5f; SetValue("TurnSpeed", TurnSpeed); SetValue("Speed", Speed); SetValue("Accuracy", Accuracy); SetValue("Direction", 1); MoveToWP.TargetName = "Waypoint"; PickNextWP.ArrayKey = "Waypoints"; PickNextWP.GameObjectKey = "Waypoint"; PickNextWP.IndexKey = "Index"; PickNextWP.DirectionKey = "Direction"; Patrol.children.Add(MoveToWP); Patrol.children.Add(PickNextWP); Patrol.children.Add(playerChangeLane); TreeRoot.children.Add(Patrol); Patrol.tree = this; TreeRoot.tree = this; MoveToWP.tree = this; playerChangeLane.tree = this; PickNextWP.tree = this; root = TreeRoot; }
// Start is called before the first frame update void Start() { Selector TreeRoot = new Selector(); Sequence TrackRace = new Sequence(); SelectNextGameObject SelectNextPoint = new SelectNextGameObject(); MoveTo MoveToObject = new MoveTo(); PlayerChangeLane ChangeLange = new PlayerChangeLane(); SetValue("Catmul", catmul.sp); SetValue("CurrentPoint", catmul.sp[0]); SetValue("CurrentPointIndex", 0); //Default is going forwards along the path SetValue("Direction", 1); SetValue("TrackManager", trackManager); SetValue("TrackIndex", trackIndex); SetValue("TurnRequested", Turning.STRAIGHT); SetValue("Speed", 5.0f); SetValue("TurnSpeed", 2.0f); SetValue("Accuracy", 1.5f); SelectNextPoint.ArrayKey = "Catmul"; SelectNextPoint.GameObjectKey = "CurrentPoint"; SelectNextPoint.IndexKey = "CurrentPointIndex"; SelectNextPoint.DirectionKey = "Direction"; MoveToObject.TargetName = "CurrentPoint"; ChangeLange.IndexKey = "CurrentPointIndex"; ChangeLange.GameObjectKey = "CurrentPoint"; ChangeLange.ArrayKey = "Catmul"; TrackRace.children.Add(SelectNextPoint); TrackRace.children.Add(MoveToObject); TrackRace.children.Add(ChangeLange); TreeRoot.children.Add(TrackRace); TrackRace.tree = this; SelectNextPoint.tree = this; MoveToObject.tree = this; ChangeLange.tree = this; TreeRoot.tree = this; root = TreeRoot; }