/// <summary> /// Process the current /// </summary> /// <param name="game_time" >Reference to the current game time</param> /// <param name="world" >Reference to the current world</param> /// <param name="processor_manager" >Reference to the current game processor manager</param> public void Process(ref GameTime game_time, ref GameWorld world, ref GameProcessorManager processor_manager) { while (this.GetNext( )) { this.Sound = this.AudioManager.GetSound(this.Current.SoundID); this.Sound.Play(this.Current.Volume, this.Current.Pitch, this.Current.Pan); } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize( ) { this.GraphicManager = new GraphicManager(this.Content); this.AudioManager = new AudioManager(this.Content); this.Renderer = new GameRenderer( ); this.GameProcessorManager = new GameProcessorManager( ); base.Initialize( ); }
/// <summary> /// Create a new game object. /// </summary> /// <typeparam name="Type" >Type of the new game object</typeparam> /// <param name="x" >Default game object x value</param> /// <param name="y" >Default game object y value</param> /// <param name="processor_manager" >Reference to the current game processor manager</param> /// <returns>The new game object</returns> public virtual int Create <Type>(float x, float y, ref GameProcessorManager processor_manager) where Type : GameObject, new() { if (this.Pointer < this.Size) { int temp = this.Pointer++; this.Content[temp] = new Type( ); this.Content[temp].Setup(x, y, 0f, 1f, 1f); this.Content[temp].Init(temp, ref this.MyRef, ref processor_manager); return(temp); } return(-1); }
/// <summary> /// Process the current game AI processor. /// </summary> /// <param name="game_time" >Reference to the current game time</param> /// <param name="world" >Reference to the current world</param> /// <param name="processor_manager" >Reference to the current game processor manager</param> public void Process(ref GameTime game_time, ref GameWorld world, ref GameProcessorManager processor_manager) { while (this.GetNext( )) { if (!this.Current.HasChanged) { this.States[this.Current.CurrentState].Process(this.CurrentID, ref this.MyRef, ref game_time, ref world, ref processor_manager); } else { this.Current.HasChanged = false; this.States[this.Current.CurrentState].OnEnter(this.CurrentID, ref this.MyRef, ref game_time, ref world, ref processor_manager); } } }
/// <summary> /// Process the current game world. /// </summary> /// <param name="processor_manager" >Reference to the current game processor manager</param> /// <param name="renderer" >Reference to the current game renderer</param> /// <param name="audio_manager" >Reference to the current game audio manager</param> public virtual void Process(ref GameProcessorManager processor_manager, ref GameRenderer renderer, ref AudioManager audio_manager) { this.Current = 0; while (this.Current < this.Size) { if (this.Content[this.Current].IsActive) { if (this.Content[this.Current].UseProcess) { this.Content[this.Current].Process(this.Current, ref this.MyRef, ref processor_manager, ref renderer, ref audio_manager); } } this.Current++; } }
/// <summary> /// Process the current game animation processor. /// </summary> /// <param name="renderer" >Reference to the current game renderer</param> /// <param name="world" >Reference to the current game world</param> /// <param name="processor_manager" >Reference to the current game processor manager</param> public void Process(ref GameRenderer renderer, ref GameWorld world, ref GameProcessorManager processor_manager) { while (this.GetNext( )) { this.Current.Time++; if (this.Current.Time == this.Current.Duration) { this.Current.Time = 0; this.Current.Current++; if (this.Current.Current == this.Current.FrameCount) { this.Current.Current = 0; } processor_manager.GetComponenOf <Skin>(this.CurrentID).Sprite = this.Current.Frame; } } }
/// <summary> /// Process the transform processor. /// </summary> /// <param name="game_time" >Reference to the current game time</param> /// <param name="world" >Reference to the current world</param> /// <param name="processor_manager" >Reference to the current game processor manager</param> public void Process(ref GameTime game_time, ref GameWorld world, ref GameProcessorManager processor_manager) { while (this.GetNext( )) { this.Position = world.FastGet(this.CurrentID).Position; this.Position.X = this.GetTransform(this.Current.TransformX, this.Current.TimerX, this.Position.X, this.Current.Target.X, this.Current.DurationX); this.Position.Y = this.GetTransform(this.Current.TransformY, this.Current.TimerY, this.Position.Y, this.Current.Target.Y, this.Current.DurationY); if (this.Current.TimerX == this.Current.DurationX) { this.Current.TransformX = ETransformTypes.NONE; } if (this.Current.TimerY == this.Current.DurationY) { this.Current.TransformY = ETransformTypes.NONE; } world.Move(this.CurrentID, ref this.Position); } }
/// <summary> /// Process the current game skin processor. /// </summary> /// <param name="renderer" >Reference to the current game renderer</param> /// <param name="world" >Reference to the current game world</param> /// <param name="processor_manager" >Reference to the current game processor manager</param> public void Process(ref GameRenderer renderer, ref GameWorld world, ref GameProcessorManager processor_manager) { while (this.GetNext( )) { this.Position = world.GetPosition(this.CurrentID); this.Scale = world.GetScale(this.CurrentID); if (this.Position.X > this.MinX && this.Position.Y > this.MinY && this.Position.X < this.MaxX && this.Position.Y < this.MaxY && this.Scale != Vector2.Zero) { renderer.Push( this.Current.Shader, this.Current.SpriteSheet, ref this.Position, this.Current.Sprite, this.Current.Filter, world.GetRotation(this.CurrentID), ref this.Scale, this.Current.Depth ); } } }
/// <summary> /// Cleanup the game object. /// </summary> /// <param name="me" >Index of the game object on the world</param> /// <param name="world" >Reference to the current game world</param> /// <param name="processor_manager" >Reference to the current game processor manager</param> public virtual void Cleanup(int me, ref GameWorld world, ref GameProcessorManager processor_manager) { this.IsActive = false; }
/// <summary> /// Process the game object. /// </summary> /// <param name="me" >Index of the current game object on the game world</param> /// <param name="world" >Reference to the current game world</param> /// <param name="processor_manager" >Reference to the current game processor manager</param> /// <param name="renderer" >Reference to the current game renderer</param> /// <param name="audio_manager" >Reference to the current game audio manager</param> public virtual void Process(int me, ref GameWorld world, ref GameProcessorManager processor_manager, ref GameRenderer renderer, ref AudioManager audio_manager) { // NOTING BY DEFAULT }
/// <summary> /// Initialize the game object. /// </summary> /// <param name="me" >Index of the current game object on the game world</param> /// <param name="world" >Reference of the current game world</param> /// <param name="processor_manager" >Reference to the current game processor manager</param> /// <returns>The current game object</returns> public virtual GameObject Init(int me, ref GameWorld world, ref GameProcessorManager processor_manager) { // NOTING BY DEFAULT return(this); }
/// <summary> /// Awake the current game world. /// </summary> /// <param name="processor_manager" >Reference to the current game processor manager</param> public abstract void Awake(ref GameProcessorManager processor_manager);
/// <summary> /// Remove game object from the game world. /// </summary> /// <param name="game_object" >Index of the game object</param> /// <param name="processor_manager" >Reference to the current game processor manager</param> public virtual void Remove(int game_object, ref GameProcessorManager processor_manager) { this.Content[game_object].Cleanup(game_object, ref this.MyRef, ref processor_manager); this.Remove(game_object); processor_manager.DeleteComponentOf(game_object); }
/// <summary> /// Switch the current state of a state machine. /// </summary> /// <param name="target" >The new state of the state machine</param> /// <param name="owner" >Index of the game oject who "own" the state machine component</param> /// <param name="ai_processor" >Reference to the current A.I. processor</param> /// <param name="game_time" >Reference to the current game time</param> /// <param name="world" >Reference to the current game world</param> /// <param name="processor_manager" >Reference to the current game processor manager</param> public void SwitchState(string target, int owner, ref AIProcessor ai_processor, ref GameTime game_time, ref GameWorld world, ref GameProcessorManager processor_manager) { var machine = this.Content[owner]; this.States[machine.CurrentState].OnQuit(owner, ref ai_processor, ref game_time, ref world, ref processor_manager); machine.CurrentState = target; this.States[target].OnEnter(owner, ref ai_processor, ref game_time, ref world, ref processor_manager); }
/// <summary> /// Process the current game collider processor. /// </summary> /// <param name="game_time" >Reference to the current game time</param> /// <param name="world" >Reference to the current world</param> /// <param name="processor_manager" >Reference to the current game processor manager</param> public void Process(ref GameTime game_time, ref GameWorld world, ref GameProcessorManager processor_manager) { #region TEMPORARY COLLISION DETECTION BLOCK while (this.GetNext( )) { this.Offset = world.GetPosition(this.CurrentID); this.MakeCollider(this.Offset.X, this.Offset.Y, ref this.Current, ref this.ColliderOne); for (int id = this.CurrentID + 1; id < this.Size; id++) { if (!this.Content[id].IsEnable) { continue; } this.Offset = world.GetPosition(id); this.MakeCollider(this.Offset.X, this.Offset.Y, ref this.Content[id], ref this.ColliderTwo); this.Offset.X = 0f; this.Offset.Y = 0f; switch (this.Current.Type) { case EColliderTypes.POINT: switch (this.Content[id].Type) { case EColliderTypes.RECTANGLE: if (this.PointRectangle(ref this.ColliderOne, ref this.ColliderTwo)) { world.Move(this.CurrentID, ref this.Offset); } break; case EColliderTypes.CIRCLE: if (this.PointCircle(ref this.ColliderOne, ref this.ColliderTwo)) { world.Move(this.CurrentID, ref this.Offset); } break; } break; case EColliderTypes.RECTANGLE: switch (this.Content[id].Type) { case EColliderTypes.POINT: if (this.PointRectangle(ref this.ColliderTwo, ref this.ColliderOne)) { world.Move(this.CurrentID, ref this.Offset); } break; case EColliderTypes.RECTANGLE: if (this.RectangleRectangle(ref this.ColliderOne, ref this.ColliderTwo)) { world.Move(this.CurrentID, ref this.Offset); } break; case EColliderTypes.CIRCLE: if (this.RectangleCircle(ref this.ColliderOne, ref this.ColliderTwo)) { world.Move(this.CurrentID, ref this.Offset); } break; } break; case EColliderTypes.CIRCLE: switch (this.Content[id].Type) { case EColliderTypes.POINT: if (this.PointCircle(ref this.ColliderTwo, ref this.ColliderOne)) { world.Move(this.CurrentID, ref this.Offset); } break; case EColliderTypes.RECTANGLE: if (this.RectangleCircle(ref this.ColliderTwo, ref this.ColliderOne)) { world.Move(this.CurrentID, ref this.Offset); } break; case EColliderTypes.CIRCLE: if (this.PointCircle(ref this.ColliderOne, ref this.ColliderTwo)) { world.Move(this.CurrentID, ref this.Offset); } break; } break; } } } #endregion }
/// <summary> /// On quit the current state. /// </summary> /// <param name="owner" >Index of the game object who "own" the state machine component</param> /// <param name="ai_processor" >Reference to the current A.I. processor</param> /// <param name="game_time" >Reference to the current game time</param> /// <param name="world" >Reference to the current game world</param> /// <param name="processor_manager" >Reference to the current game processor manager</param> public abstract void OnQuit(int owner, ref AIProcessor ai_processor, ref GameTime game_time, ref GameWorld world, ref GameProcessorManager processor_manager);