/// <summary>
 /// Copy all fields from another instance to the current one. 
 /// (e.g. for re-use of object, avoiding new object creation)
 /// </summary>
 public void CopyFrom(BTAIContext other)
 {
     SimTime = other.SimTime;
     BTComp = other.BTComp;
     Dt = other.Dt;
     Entity = other.Entity;
 }
Exemple #2
0
        public override void Create()
        {
            var ball = Factory.CreateBall(1);
            ball.GetComponent<PositionComp>().Position = new Vector2(300f, 300f);
            ball.GetComponent<VelocityComp>().Velocity2D = new Vector2(25f, 25f);

            // Behavior Tree AI
            BTAIComp ai = new BTAIComp();
            var randomWanderBehavior = new RandomWanderBehavior(1, 6);
            ai.rootNode = new PrioritySelector(randomWanderBehavior);
            ball.AddComponent(ai);
        }