using System; using System.Collections.Generic; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Input; namespace EvilSatellites.Objects { public abstract class AbstractGameObject : IGameObject { private Vector3 _Position; public Vector3 Position { get => _Position; set => _Position = value; } private Vector3 _Dimensions; public Vector3 Dimensions { get => _Dimensions; set => _Dimensions = value; } public Vector3 Movement; private Vector3 _Orientation; public Vector3 Orientation { get => _Orientation; set => _Orientation = value; } public float Theta { get; set; } private Matrix _Rotation; public Matrix Rotation { get => _Rotation; set => _Rotation = value; } public IScreen Screen; public ObjectType Type { get; set; } public bool IsDynamic { get => true; } public AbstractGameObject(IScreen screen) { Screen = screen; Type = ObjectType.Generic; } public void RotateX(float angle) { Matrix rotate = Matrix.CreateFromAxisAngle(_Rotation.Right, angle); _Rotation *= rotate; Orientation = _Rotation.Forward; } public void RotateY(float angle) { Matrix rotate = Matrix.CreateFromAxisAngle(_Rotation.Up, angle); _Rotation *= rotate; Orientation = _Rotation.Forward; } public void RotateZ(float angle) { Matrix rotate = Matrix.CreateFromAxisAngle(_Rotation.Forward, angle); _Rotation *= rotate; Orientation = _Rotation.Forward; } public void Pitch(Single pitch) { Matrix rotate = Matrix.CreateFromYawPitchRoll(0, pitch, 0); _Rotation *= rotate; Orientation = _Rotation.Forward; } public void Move(Vector3 pose) { var move = Vector3.Transform(pose, _Rotation); // move.Normalize(); _Position += move; } public abstract void Update(GameTime gameTime); public abstract void Activate(); public abstract void Destroy(); public virtual void OnCollision(IGameObject obj) { return; } } }