/// <summary> /// Constructor of base rectangle /// </summary> /// <param name="_owner">Game object which owns the base rectangle</param> /// <param name="_game">Game which the base rectangle is set in</param> public BaseRectangle(GameObject _owner, WarGame _game, MainScene _scene) : base(_game) { owner = _owner; scene = _scene; DrawOrder = (int)WarGame.DrawingOrder.GameObject; Hide(); }
/// <summary> /// Constructor of the bounding box /// </summary> /// <param name="_owner">Game object which owns the bounding box</param> /// <param name="_game">Game which the bounding box i set in</param> public Bbox(GameObject _owner, WarGame _game, MainScene _scene) : base(_game) { scene = _scene; owner = _owner; baseBox = (BoundingBox)_owner.GameObjectModel.Tag; Visible = false; DrawOrder = (int)WarGame.DrawingOrder.GameObject; }
/// <summary> /// Constructor of the health points bar /// </summary> /// <param name="_owner">Owner of the health points bar</param> /// <param name="_game">Game which the health points bar is set in</param> public HealthPointsBar(GameObject _owner, WarGame _game, MainScene _scene) : base(_game) { owner = _owner; scene = _scene; Hide(); DrawOrder = (int)WarGame.DrawingOrder.Sprite; }
/// <summary> /// Flee steering behavior /// </summary> /// <param name="caller">Game object which calls the flee SB</param> /// <param name="target">Target from which the caller flies</param> /// <returns>Force acting at the caller</returns> public static Vector3 Flee(GameObject caller, Vector3 target) { return V3Extensions.V3fromV2(Vector2.Normalize(V3Extensions.V2fromV3(caller.Position) - V3Extensions.V2fromV3(target)) * caller.MaxSpeed - V3Extensions.V2fromV3(caller.Velocity)); }
/// <summary> /// Separation stering behavior /// </summary> /// <param name="caller">Game object which calls the wander SB</param> /// <param name="objects">List of alien crafts that we want to separate from</param> /// <returns>Force acting at the caller</returns> public static Vector3 Separation(GameObject caller, List<AlienCraft> objects) { Vector3 separationForce = Vector3.Zero; if (objects != null) { foreach (GameObject o in objects) { if (caller != o && Vector3.Distance(caller.Position, o.Position) < 1) { Vector3 distanceVector = V3Extensions.V3fromV2(V3Extensions.V2fromV3(caller.Position) - V3Extensions.V2fromV3(o.Position)); separationForce += Vector3.Normalize(distanceVector); // distanceVector.Length(); } } } return separationForce * caller.MaxSpeed; }