/// <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; }
/// <summary> /// the external execution of the behavior, can be overridden. Default implementation sets the /// new CurrentDirection into VelocityComp of the Entity /// </summary> /// <param name="context">BT Entity/processing information</param> protected virtual void OnExecute(BTAIContext context) { context.Entity.GetComponent<VelocityComp>().Velocity = new Vector2(CurrentDirection.X, CurrentDirection.Y); }