コード例 #1
0
ファイル: Unit.cs プロジェクト: fakkoweb/AsTKoids
 public Unit(string id, StaticModel staticModel, float maxRotSpeed, float viewDistance, float maxSpeed, float maxAcceleration, int health)
     : base(id, staticModel, maxRotSpeed, viewDistance, maxSpeed, maxAcceleration)
 {
     _damage = 0;
     _health = health;
     _isDead = false;
 }
コード例 #2
0
ファイル: Movable.cs プロジェクト: fakkoweb/AsTKoids
 public Movable(string id, StaticModel staticModel, float maxRotSpeed, float viewDistance, float maxSpeed, float maxAcceleration)
     : base(id, staticModel, maxRotSpeed, viewDistance)
 {
     _maxSpeed = maxSpeed;
     _maxAcceleration = maxAcceleration;
     _velocity = new Vector3(0, 0, 0);
 }
コード例 #3
0
ファイル: DynamicSubsystem.cs プロジェクト: fakkoweb/AsTKoids
 public DynamicSubsystem(string id, StaticModel staticModel, float maxRotSpeed, float viewDistance, int health)
     : base(id, staticModel, maxRotSpeed, viewDistance)
 {
     _damage = 0;
     _health = health;
     _isDead = false;
 }
コード例 #4
0
        public void Load()
        {
            _camera = new Camera();
              _camera.PositionSpeed = 5;
              _camera.Move(_camera.Up, 400);
              _camera.Move(_camera.Backward, 1500);
              _camera.Move(_camera.Backward, 300);

              _terrain = StaticModelManager.GetModel("Terrain");
              _terrain.Scale = new Vector(500, 20, 500);
              //_terrain.RotationAmmounts = new Vector(0, 0, 0);
              _terrain.Position = new Vector(0, 0, 0);

              _sprites = new Sprite(TextureManager.Get("Menu"));
              _sprites.Scale.X = 50;
              _sprites.Scale.Y = 50;
              _sprites2 = new Sprite(TextureManager.Get("Menu"));
              _sprites2.Scale.X = 50;
              _sprites2.Scale.Y = 50;
              _sprites3 = new Sprite(TextureManager.Get("Menu"));
              _sprites3.Scale.X = 50;
              _sprites3.Scale.Y = 50;

              _isReady = true;
        }
コード例 #5
0
ファイル: StaticSubsystem.cs プロジェクト: fakkoweb/AsTKoids
 public StaticSubsystem(string id, StaticModel staticModel, int health)
     : base(id, staticModel)
 {
     _damage = 0;
     _health = health;
     _isDead = false;
 }
コード例 #6
0
ファイル: Cannon.cs プロジェクト: fakkoweb/AsTKoids
 public Cannon(string id, StaticModel staticModel, float maxRotSpeed, float viewDistance, int health)
     : base(id, staticModel, maxRotSpeed, viewDistance, health)
 {
     _bulletHole = new Vector3(0, 0, 0);
     _bulletVector = new Vector3(0, 0, 0);
     _fireTime = 0;
     _fireSpeed = 1;
 }
コード例 #7
0
ファイル: Ranged.cs プロジェクト: KelvinCoding/SevenEngine
 public Ranged(string id, StaticModel staticModel)
     : base(id, staticModel)
 {
     Random random = new Random();
       _health = random.Next(_healthMin, _healthMax);
       _damage = random.Next(_damageMin, _damageMax);
       _viewDistance = random.Next(_viewDistanceMin, _viewDistanceMax);
       _attackRange = random.Next(_attackRangeMin, _attackRangeMax);
       _moveSpeed = random.Next(_moveSpeedMin, _moveSpeedMax) / 20f;
       _attackRangedSquared = _attackRange * _attackRange;
 }
コード例 #8
0
        public void Load()
        {
            // Creates a camera and sets the initial positions
              _camera = new Camera();
              _camera.PositionSpeed = 5;
              _camera.Move(_camera.Up, 400);
              _camera.Move(_camera.Backward, 1500);
              _camera.Move(_camera.Backward, 300);

              // Gets a copy of the "Terrain" model and tracks the number of hardware instances of each component
              _terrain = StaticModelManager.GetModel("Terrain");
              _terrain.Scale = new Vector(500, 20, 500);
              _terrain.Orientation = new Quaternion(0, 0, 0, 0);
              _terrain.Position = new Vector(0, 0, 0);

              // Gets a copy of the "RedRanger" model and tracks the number of hardware instances of each component
              _redRanger = StaticModelManager.GetModel("RedRanger");
              _redRanger.Orientation = new Quaternion(0, 1, 0, 0);
              //_redRanger.RotationAngle = 180f;
              _redRanger.Scale = new Vector(5, 5, 5);
              _redRanger.Position = new Vector(_terrain.Position.X + 200, _terrain.Position.Y + 130, _terrain.Position.Z);

              // Gets a copy of the "YellowRanger" model and tracks the number of hardware instances of each component
              _yellowRanger = StaticModelManager.GetModel("YellowRanger");
              _yellowRanger.Orientation = new Quaternion(0, 1, 1, 0);
              _yellowRanger.Scale = new Vector(10, 10, 10);
              _yellowRanger.Position = new Vector(_terrain.Position.X + 100, _terrain.Position.Y + 130, _terrain.Position.Z);

              // Gets a copy of the "BlackRanger" model and tracks the number of hardware instances of each component
              _blackRanger = StaticModelManager.GetModel("BlackRanger");
              _blackRanger.Orientation = new Quaternion(1, 1, 0, 0);
              _blackRanger.Scale = new Vector(10, 10, 10);
              _blackRanger.Position = new Vector(_terrain.Position.X + 0, _terrain.Position.Y + 130, _terrain.Position.Z);

              // Gets a copy of the "BlueRanger" model and tracks the number of hardware instances of each component
              _blueRanger = StaticModelManager.GetModel("BlueRanger");
              _blueRanger.Orientation = new Quaternion(0, 1, 2, 0);
              _blueRanger.Scale = new Vector(10, 10, 10);
              _blueRanger.Position = new Vector(_terrain.Position.X - 200, _terrain.Position.Y + 130, _terrain.Position.Z);

              // Gets a copy of the "PinkRanger" model and tracks the number of hardware instances of each component
              _pinkRanger = StaticModelManager.GetModel("PinkRanger");
              _pinkRanger.Orientation = new Quaternion(0, 1, 0, 0);
              _pinkRanger.Scale = new Vector(10, 10, 10);
              _pinkRanger.Position = new Vector(_terrain.Position.X - 100, _terrain.Position.Y + 130, _terrain.Position.Z);

              // Gets a copy of the "RedRangerSeven" model and tracks the number of hardware instances of each component
              _RedRangerTwo = StaticModelManager.GetModel("RedRangerSeven");
              _RedRangerTwo.Orientation = new Quaternion(0, 1, 0, 0);
              _RedRangerTwo.Scale = new Vector(20, 20, 20);
              _RedRangerTwo.Position = new Vector(_terrain.Position.X - 500, _terrain.Position.Y + 130, _terrain.Position.Z + 700);

              _isReady = true;
        }
コード例 #9
0
ファイル: Geometric.cs プロジェクト: fakkoweb/AsTKoids
        public static Quaternion FreeLookAt(StaticModel actor, Vector3 targetAbsRef, Vector3 upRelRef)
        {

            //Vector v1 = new Vector3(0, 0, -1);
            //Vector moveV = _staticModel.Position - vector;
            //Vector v2 = moveV.RotateBy(_staticModel.Orientation.W, 0, 1, 0);

            /*Vector forward = lookAt.Normalized();
            Vector right = Vector::Cross(up.Normalized(), forward);
            Vector up = Vector::Cross(forward, right);*/
            Vector3 eye = actor.Position;
            Vector3 forward;
            Vector3 up;

            //Normalizing target.. local system is the same as world system
            forward = targetAbsRef;
            up = upRelRef;

            //Insert manual imprecision to avoid singularity
            if (Vector3.Dot(forward, up) == 1)
            {
                forward.X += 0.001f;
                forward.Y += 0.001f;
                forward.Z += 0.001f;
            }
            //forward = forward.Normalized();

            // HACK INVERSION
            //forward = -forward;

            //float angle = (float)Math.Acos( Vector3.Dot(current,targetAbsRef) );
            //Vector3 rotAxis = Vector3.CrossProduct(current, forward).Normalized();
            //Vector3 right = Vector3.CrossProduct(forward, up);

            Matrix4 lookAt_result = Matrix4.LookAt(forward.X, forward.Y, forward.Z, eye.X, eye.Y, eye.Z, up.X, up.Y, up.Z);
            Matrix3 targetRelOrientation_matrix = new Matrix3(lookAt_result);
            Quaternion targetRelOrientation_quaternion = Quaternion.FromMatrix(targetRelOrientation_matrix);

            /*
            Quaternion targetRelOrientation_quaternion = new Quaternion();
            targetRelOrientation_quaternion.W = (float)Math.Sqrt((double)(1.0f + right.X + up.Y + forward.Z)) * 0.5f;
            float w4_recip = 1.0f / (4.0f * targetRelOrientation_quaternion.W);
            targetRelOrientation_quaternion.X = (forward.Y - up.Z) * w4_recip;
            targetRelOrientation_quaternion.Y = (right.Z - forward.X) * w4_recip;
            targetRelOrientation_quaternion.Z = (up.X - right.Y) * w4_recip;
            */

            return targetRelOrientation_quaternion;

        }
コード例 #10
0
 public KillemMelee(string id, StaticModel staticModel)
     : base(id, staticModel)
 {
     _time = 0; if (AiBattle._map == 0) _delay = 4000;
 }
コード例 #11
0
ファイル: Geometric.cs プロジェクト: fakkoweb/AsTKoids
        public static Quaternion ConstraintLookAt(StaticModel actor, Vector3 targetAbsRef, Vector3 upRelRef, Vector3 constraintAxisSelect)
        {

            Vector3 targetRelRef;

            //Transforming target into relative coordinates if child
            if (actor.IsChild)
                targetRelRef = Geometric.Quaternion_Rotate(actor.ParentModel.Orientation.Inverted(), targetAbsRef);
            else
                targetRelRef = new Vector3(targetAbsRef.X, targetAbsRef.Y, targetAbsRef.Z);

            
            // HACK INVERSION
            //targetRelRef = -targetRelRef;
            //
            

            //Make a non projected safe copy of relative target
            Vector3 targetRelRef_notConstraint = new Vector3(targetRelRef.X, targetRelRef.Y, targetRelRef.Z);

            /*
            //Project relative target to plane defined by constraint
            if (constraintAxisSelect.X != 0)
                targetRelRef.X = 0;
            else if (constraintAxisSelect.Y != 0)
                targetRelRef.Y = 0;
            else if (constraintAxisSelect.Z != 0)
                targetRelRef.Z = 0;
             */

            //Normalizing constrainted relative target
            Vector3 eye = actor.PositionRelative;
            Vector3 up;
            Vector3 forward;
            if (actor.IsChild)
            {
                //Normalizing target and transforming it to local system
                forward = targetRelRef - actor.ParentModel.Position;
                up = Quaternion_Rotate(actor.OrientationRelative, upRelRef);
            }
            else
            {
                //Normalizing target.. local system is the same as world system
                forward = targetRelRef;
                up = upRelRef;
            }

            //Normalizing upVector (we are assuming it is expressed in local system)


            //Insert manual imprecision tilt to avoid singularity  (if any!)
            float ciao = Vector3.Dot(targetRelRef_notConstraint.Normalized(), up);
            if (Vector3.Dot(targetRelRef_notConstraint.Normalized(), up) == 1)
            {
                forward.X = 0.001f;
                forward.Y = 0.001f;
                forward.Z = 0.001f;
            }

            //Project relative target to plane defined by constraint
            if (constraintAxisSelect.X != 0)
                forward.X = 0;
            else if (constraintAxisSelect.Y != 0)
                forward.Y = 0;
            else if (constraintAxisSelect.Z != 0)
                forward.Z = 0;

            //forward = forward.Normalized();

//            Vector3 v1 = new Vector3(forward.X,forward.Y,forward.Z)
//            float ciao = Vector3.Dot(forward, up);


            //float angle = (float)Math.Acos( Vector3.Dot(current,targetAbsRef) );
            //Vector3 rotAxis = Vector3.CrossProduct(current, forward).Normalized();
            //Vector3 right = Vector3.CrossProduct(forward, up);

            Matrix4 lookAt_result = Matrix4.LookAt(forward.X, forward.Y, forward.Z, eye.X, eye.Y, eye.Z, up.X, up.Y, up.Z);
            Matrix3 targetRelOrientation_matrix = new Matrix3(lookAt_result);
            Quaternion targetRelOrientation_quaternion = Quaternion.FromMatrix(targetRelOrientation_matrix);

            /*
            Quaternion targetRelOrientation_quaternion = new Quaternion();
            targetRelOrientation_quaternion.W = (float)Math.Sqrt((double)(1.0f + right.X + up.Y + forward.Z)) * 0.5f;
            float w4_recip = 1.0f / (4.0f * targetRelOrientation_quaternion.W);
            targetRelOrientation_quaternion.X = (forward.Y - up.Z) * w4_recip;
            targetRelOrientation_quaternion.Y = (right.Z - forward.X) * w4_recip;
            targetRelOrientation_quaternion.Z = (up.X - right.Y) * w4_recip;
            */

            return targetRelOrientation_quaternion;

        }
コード例 #12
0
ファイル: Geometric.cs プロジェクト: fakkoweb/AsTKoids
        public static Quaternion FreeLookAtWithConstraint(StaticModel actor, Vector3 targetAbsRef, Vector3 upRelRef)
        {

            //Vector v1 = new Vector3(0, 0, -1);
            //Vector moveV = _staticModel.Position - vector;
            //Vector v2 = moveV.RotateBy(_staticModel.Orientation.W, 0, 1, 0);

            /*Vector forward = lookAt.Normalized();
            Vector right = Vector::Cross(up.Normalized(), forward);
            Vector up = Vector::Cross(forward, right);*/
            Vector3 eye = actor.PositionRelative;
            Vector3 forward;
            Vector3 up;

            if (actor.IsChild)
            {
                //Normalizing target and transforming it to local system
                forward = Geometric.Quaternion_Rotate(actor.ParentModel.Orientation.Inverted(), targetAbsRef) - actor.ParentModel.Position;
                up = Quaternion_Rotate(actor.OrientationRelative, upRelRef);
            }
            else
            {
                //Normalizing target.. local system is the same as world system
                forward = targetAbsRef;
                up = upRelRef;
            }
            //Normalizing upVector (we are assuming it is expressed in local system)


            //Insert manual imprecision to avoid singularity
            if (Vector3.Dot(forward, up) == 1)
            {
                forward.X += 0.001f;
                forward.Y += 0.001f;
                forward.Z += 0.001f;
            }
            //forward = forward.Normalized();

            // HACK INVERSION
            //forward = -forward;

            //float angle = (float)Math.Acos( Vector3.Dot(current,targetAbsRef) );
            //Vector3 rotAxis = Vector3.CrossProduct(current, forward).Normalized();
            //Vector3 right = Vector3.CrossProduct(forward, up);
            //Output.WriteLine(forward.X + "," + forward.Y + "," + forward.Z);
            Matrix4 lookAt_result;
            Matrix3 targetRelOrientation_matrix;
            Quaternion targetRelOrientation_quaternion;
            if (forward.X >= 0 && forward.Y >= 0)
            {
                lookAt_result = Matrix4.LookAt(forward.X, forward.Y, forward.Z, eye.X, eye.Y, eye.Z, up.X, up.Y, up.Z);
                targetRelOrientation_matrix = new Matrix3(lookAt_result);
                targetRelOrientation_quaternion = Quaternion.FromMatrix(targetRelOrientation_matrix);
            }
            else
            {
                targetRelOrientation_quaternion = actor.OrientationRelative;
            }
            /*
            Quaternion targetRelOrientation_quaternion = new Quaternion();
            targetRelOrientation_quaternion.W = (float)Math.Sqrt((double)(1.0f + right.X + up.Y + forward.Z)) * 0.5f;
            float w4_recip = 1.0f / (4.0f * targetRelOrientation_quaternion.W);
            targetRelOrientation_quaternion.X = (forward.Y - up.Z) * w4_recip;
            targetRelOrientation_quaternion.Y = (right.Z - forward.X) * w4_recip;
            targetRelOrientation_quaternion.Z = (up.X - right.Y) * w4_recip;
            */

            return targetRelOrientation_quaternion;

        }
コード例 #13
0
ファイル: StaticModel.cs プロジェクト: fakkoweb/AsTKoids
 public void setParent(StaticModel parent)
 {
     if (parent != null)
     {
         _parentModel = parent;
         _isChild = true;
         parent.addChildren(this);
     }
 }
コード例 #14
0
ファイル: Static.cs プロジェクト: fakkoweb/AsTKoids
 public Static(string id, string staticModel)
 {
     _id = id;
     _mainModel = StaticModelManager.GetModel(staticModel);
 }
コード例 #15
0
 public static int CompareTo(StaticModel left, StaticModel right)
 {
     return left.Id.CompareTo(right.Id);
 }
コード例 #16
0
 public ZackRanged(string id, StaticModel staticModel)
     : base(id, staticModel)
 {
     _time = 0; if (AiBattle._map == 0) _delay = 4000;
 }
コード例 #17
0
 public static int CompareTo(StaticModel left, string right)
 {
     return left.Id.CompareTo(right);
 }
コード例 #18
0
 public KillemKamakazi(string id, StaticModel staticModel)
     : base(id, staticModel)
 {
 }
コード例 #19
0
ファイル: GameState.cs プロジェクト: KelvinCoding/SevenEngine
    public void Load()
    {
      _camera = new Camera();
      _camera.PositionSpeed = 5;
      _camera.Move(_camera.Up, 400);
      _camera.Move(_camera.Backward, 1500);
      _camera.Move(_camera.Backward, 300);

      _skybox = new SkyBox();
      _skybox.Scale.X = 10000;
      _skybox.Scale.Y = 10000;
      _skybox.Scale.Z = 10000;
      _skybox.Left = TextureManager.Get("SkyboxLeft");
      _skybox.Right = TextureManager.Get("SkyboxRight");
      _skybox.Front = TextureManager.Get("SkyboxFront");
      _skybox.Back = TextureManager.Get("SkyboxBack");
      _skybox.Top = TextureManager.Get("SkyboxTop");

      _terrain = StaticModelManager.GetModel("Terrain");
      _terrain.Scale = new Vector(500, 20, 500);
      _terrain.Orientation = new Quaternion(0, 0, 0, 0);
      _terrain.Position = new Vector(0, 0, 0);

      _mushroomCloud = StaticModelManager.GetModel("MushroomCloud");
      _mushroomCloud.Scale = new Vector(500, 20, 500);
      _mushroomCloud.Orientation = new Quaternion(0, 0, 0, 0);
      _mushroomCloud.Position.X = 0;
      _mushroomCloud.Position.Y = _terrain.Position.Y + 30;
      _mushroomCloud.Position.Z = 0;
      _time = 0;
      _bool = false;

      _mountain = StaticModelManager.GetModel("Mountain");
      _mountain.Scale = new Vector(5000, 5000, 5000);
      _mountain.Orientation = new Quaternion(0, 0, 0, 0);
      _mountain.Position = new Vector(4000, 0, 1000);

      _mountain2 = StaticModelManager.GetModel("Mountain2");
      _mountain2.Scale = new Vector(3500, 3500, 3500);
      _mountain2.Orientation = new Quaternion(0, 0, 0, 0);
      _mountain2.Position = new Vector(0, 0, 2500);

      string[] colors = new string[] { "YellowRanger", "RedRanger", "BlueRanger", "BlackRanger", "PinkRanger" };

      Random random = new Random();
      _rangers = new StaticModel[80];
      for (int i = 0; i < _rangers.Length; i++)
      {
        _rangers[i] = StaticModelManager.GetModel(colors[random.Next(0, 5)]);
        _rangers[i].Position.X = -100;
        _rangers[i].Position.Y = _terrain.Position.Y + 10;
        _rangers[i].Position.Z = -i * 50;
        _rangers[i].Scale = new Vector(5, 5, 5);
        _rangers[i].Orientation = new Quaternion(0, 1, 0, 0);
        _rangers[i].Orientation.W = i * 2;
        _rangers[i].Id = "Ranger" + i;
        _octree.Add(_rangers[i]);
      }

      _tuxes = new StaticModel[80];
      for (int i = 0; i < _tuxes.Length; i++)
      {
        _tuxes[i] = StaticModelManager.GetModel("Tux");
        _tuxes[i].Position.X = 100;
        _tuxes[i].Position.Y = _terrain.Position.Y + 10;
        _tuxes[i].Position.Z = i * 50;
        _tuxes[i].Scale = new Vector(25, 25, 25);
        _tuxes[i].Orientation = new Quaternion(0, 1, 0, 0);
        _tuxes[i].Orientation.W = i * 2;
        _tuxes[i].Id = "Tux" + i;
        _octree.Add(_tuxes[i]);
      }

      for (int i = 0; i < _rangers.Length; i += 2)
      {
        _rangers[i].Meshes.Remove("Body");
        //_octree.Remove("Ranger" + i);
        _tuxes[i].Meshes.Remove("Body");
      }

      Renderer.Font = TextManager.GetFont("Calibri");

      // ONCE YOU ARE DONE LOADING, BE SURE TO SET YOUR READY 
      // PROPERTY TO TRUE SO MY ENGINE DOESN'T SCREAM AT YOU
      _isReady = true;
    }
コード例 #20
0
ファイル: Dreadnaught.cs プロジェクト: fakkoweb/AsTKoids
        public Dreadnaught(string id)
            : base(id, "Dreadnaught_front_model", 0.87f, 10000, 4, 0.01f, 100000)
        {
            //Collider
            _boxRadius = 24.5f;
            //_box = new RectangularPrism(25, 94, Position);
            _box = new Sphere(Position, _boxRadius, new Quaternion(0, 0, 0, 1));

            //Back side
            _backModel = StaticModelManager.GetModel("Dreadnaught_back_model");
            _backModel.setParent(_mainModel);

            //Rings
            _ringModels = new StaticModel[2];
            _ringModels[0] = StaticModelManager.GetModel("Dreadnaught_ring_model");
            _ringModels[0].Position = new Vector3(0, -0.60810f, 0);     //this tilt is a fix
            _ringModels[0].setParent(_mainModel);
            _ringModels[1] = StaticModelManager.GetModel("Dreadnaught_ring_model");
            _ringModels[1].Position = new Vector3(0, -0.60810f, -3.0701f);     //this tilt is a fix
            _ringModels[1].setParent(_backModel);

            //Cannons
            _cannons = new SmallCannon[7];
            for (int i = 0; i < _cannons.Length; i++)
            {
                _cannons[i] = new SmallCannon(id + "_SmallCannon_" + (i+1) );
                _cannons[i].StaticModel.Id = id + "_SmallCannon_" + (i+1) ;
                _cannons[i].FireSpeed = 3;
            }

            float offset = 0.5f;
            //Upper Front cannons positions
            _cannons[0].StaticModel.PositionRelative = new Vector3(5f,2.467f+offset,40.251f);
            _cannons[0].StaticModel.setParent(_mainModel);
            _cannons[1].StaticModel.PositionRelative = new Vector3(-5f, 2.467f+offset, 40.251f);
            _cannons[1].StaticModel.setParent(_mainModel);
            _cannons[2].StaticModel.PositionRelative = new Vector3(6.793f, 3.102f+offset, 24.521f);
            _cannons[2].StaticModel.setParent(_mainModel);
            _cannons[3].StaticModel.PositionRelative = new Vector3(-6.793f, 3.102f+offset, 24.521f);
            _cannons[3].StaticModel.setParent(_mainModel);
            //Lower Front cannons positions
            _cannons[4].StaticModel.PositionRelative = new Vector3(0, -6.162f-offset, 24.521f);
            _cannons[4].StaticModel.OrientationRelative = Geometric.Generate_Quaternion(Constants.pi_float, 0, 0, 1);
            _cannons[4].StaticModel.setParent(_mainModel);
            //Lower Back cannons positions
            _cannons[5].StaticModel.PositionRelative = new Vector3(5.93f, -7.01f-offset, -22f);
            _cannons[5].StaticModel.OrientationRelative = Geometric.Generate_Quaternion(Constants.pi_float, 0, 0, 1);
            _cannons[5].StaticModel.setParent(_backModel);
            _cannons[6].StaticModel.PositionRelative = new Vector3(-5.93f, -7.01f-offset, -22f);
            _cannons[6].StaticModel.OrientationRelative = Geometric.Generate_Quaternion(Constants.pi_float, 0, 0, 1);
            _cannons[6].StaticModel.setParent(_backModel);
            
            /*
            _coolerLeftModels = new StaticModel[3];
            _coolerRightModels = new StaticModel[3];
            _ringModels = new StaticModel[2];

            for (int i = 0; i < _coolerLeftModels.Length; i++)
            {
                _coolerLeftModels[i] = StaticModelManager.GetModel("Dreadnaught_cooler_model");
                _coolerRightModels[i] = StaticModelManager.GetModel("Dreadnaught_cooler_model");
                _coolerRightModels[i].Scale = new Vector3( - _coolerRightModels[i].Scale.X, _coolerRightModels[i].Scale.Y, _coolerRightModels[i].Scale.Z);
            }

            
            //TODO setup cannons and coolers relative positions
            _frontCannons[0].Position = new Vector3(0, 0, 0);
            _frontCannons[1].Position = new Vector3(0, 0, 0);
            _frontCannons[2].Position = new Vector3(0, 0, 0);
            _frontCannons[3].Position = new Vector3(0, 0, 0);
            _frontCannons[4].Position = new Vector3(0, 0, 0);
            _frontCannons[5].Position = new Vector3(0, 0, 0);

            _coolerLeftModels[0].Position = new Vector3(0, 0, 0);
            _coolerRightModels[0].Position = new Vector3(0, 0, 0);
            _coolerLeftModels[1].Position = new Vector3(0, 0, 0);
            _coolerRightModels[1].Position = new Vector3(0, 0, 0);
            _coolerLeftModels[2].Position = new Vector3(0, 0, 0);
            _coolerRightModels[2].Position = new Vector3(0, 0, 0);

            _ringModels[0] = StaticModelManager.GetModel("Dreadnaught_ringfront_model");
            _ringModels[1] = StaticModelManager.GetModel("Dreadnaught_ringback_model");
            */
        }
コード例 #21
0
ファイル: Unit.cs プロジェクト: KelvinCoding/SevenEngine
 public Unit(string id, StaticModel staticModel)
 {
     _id = id;
       _staticModel = staticModel;
       _isDead = false;
 }
コード例 #22
0
ファイル: Orientable.cs プロジェクト: fakkoweb/AsTKoids
 public Orientable(string id, StaticModel staticModel, float maxRotSpeed, float viewDistance) : base(id, staticModel)
 {
     _maxRotSpeed = maxRotSpeed;
     _viewDistance = viewDistance;
 }
コード例 #23
0
ファイル: Renderer.cs プロジェクト: KelvinCoding/SevenEngine
        /// <summary>Renders a single static model using "GL.DrawArrays()".</summary>
        /// <param name="staticModel">The mesh to be rendered.</param>
        public static void DrawStaticModel(StaticModel staticModel)
        {
            // Apply the 3D projection matrix transformations
              SetProjectionMatrix();

              if (staticModel.ShaderOverride != null)
            GL.UseProgram(staticModel.ShaderOverride.GpuHandle);
              else
            GL.UseProgram(DefaultShaderProgram.GpuHandle);

              //GL.UseProgram(ShaderManager.LightShader.GpuHandle);

              // Apply the model view matrix transformations
              GL.MatrixMode(MatrixMode.Modelview);
              // Apply the camera transformation
              Matrix4 cameraTransform = _currentCamera.GetMatrix();
              GL.LoadMatrix(ref cameraTransform);
              // Apply the world transformation
              GL.Translate(staticModel.Position.X, staticModel.Position.Y, staticModel.Position.Z);
              GL.Rotate(Calc.ToDegrees(staticModel.Orientation.W), staticModel.Orientation.X, staticModel.Orientation.Y, staticModel.Orientation.Z);
              GL.Scale(staticModel.Scale.X, staticModel.Scale.Y, staticModel.Scale.Z);

              // Call the drawing functions for each mesh within the model
              staticModel.Meshes.Traverse(DrawStaticModelPart);
        }
コード例 #24
0
ファイル: StaticModel.cs プロジェクト: fakkoweb/AsTKoids
 public void clearParent()
 {
     _parentModel = null;
     _isChild = false;
 }
コード例 #25
0
ファイル: Kamakazi.cs プロジェクト: KelvinCoding/SevenEngine
 public Explosion()
 {
     _time = 0;
       _explosion = StaticModelManager.GetModel("MushroomCloud");
 }
コード例 #26
0
ファイル: Renderer.cs プロジェクト: fakkoweb/AsTKoids
    /// <summary>Renders a single static model using "GL.DrawArrays()". Renders also all its children submodels if any.</summary>
    /// <param name="staticModel">The mesh to be rendered.</param>
    public static void DrawStaticModel(StaticModel staticModel)
    {
        // Apply the 3D projection matrix transformations
        SetProjectionMatrix();

        // Use
        GL.UseProgram(DefaultShaderProgram.GpuHandle);

        // Apply the model view matrix transformations
        GL.MatrixMode(MatrixMode.Modelview);
        // Apply the camera transformation
        Matrix4 cameraTransform = _currentCamera.GetMatrix();
        GL.LoadMatrix(ref cameraTransform);

        // Apply the world transformation
        GL.Translate(staticModel.Position.X, staticModel.Position.Y, staticModel.Position.Z);
        Matrix4 glFriendly = Matrix4.CreateFromQuaternion( staticModel.Orientation );
        GL.MultMatrix(ref glFriendly);
        //GL.Rotate(staticModel.Orientation.W * 180f / 3.14f, staticModel.Orientation.X, staticModel.Orientation.Y, staticModel.Orientation.Z);
        GL.Scale(staticModel.Scale.X, staticModel.Scale.Y, staticModel.Scale.Z);

        // Call the drawing functions for each mesh within the model
        staticModel.Meshes.Foreach((Foreach<StaticMesh>)DrawStaticModelPart);

        // Call the drawing function recursively for each model parented to this model
        if (staticModel.HasChildren)
        {
            foreach(StaticModel childModel in staticModel.ChildrenModels)
            {
                DrawStaticModel(childModel);
            }
        }
        
    }
コード例 #27
0
ファイル: Static.cs プロジェクト: fakkoweb/AsTKoids
 public Static(string id, StaticModel staticModel)
 {
   _id = id;
   _mainModel = staticModel;
 }
コード例 #28
0
ファイル: AiBattle.cs プロジェクト: KelvinCoding/SevenEngine
        public void Load()
        {
            _camera = new Camera();
              _camera.PositionSpeed = 5;
              _camera.Move(_camera.Up, 400);
              _camera.Move(_camera.Backward, 1500);
              _camera.Move(_camera.Backward, 300);

              _skybox = new SkyBox();
              _skybox.Scale.X = 10000;
              _skybox.Scale.Y = 10000;
              _skybox.Scale.Z = 10000;
              _skybox.Left = TextureManager.Get("SkyboxLeft");
              _skybox.Right = TextureManager.Get("SkyboxRight");
              _skybox.Front = TextureManager.Get("SkyboxFront");
              _skybox.Back = TextureManager.Get("SkyboxBack");
              _skybox.Top = TextureManager.Get("SkyboxTop");

              _terrain = StaticModelManager.GetModel("Terrain");
              _terrain.Scale = new Vector(500, 20, 500);
              _terrain.Orientation = new Quaternion(0, 0, 0, 0);
              _terrain.Position = new Vector(0, 0, 0);

              _mountain = StaticModelManager.GetModel("Mountain");
              _mountain.Scale = new Vector(5000, 5000, 5000);
              _mountain.Orientation = new Quaternion(0, 0, 0, 0);
              _mountain.Position = new Vector(4000, 0, 1000);

              _mountain2 = StaticModelManager.GetModel("Mountain2");
              _mountain2.Scale = new Vector(3500, 3500, 3500);
              _mountain2.Orientation = new Quaternion(0, 0, 0, 0);
              _mountain2.Position = new Vector(0, 0, 2500);

              GenerateUnits();

              Renderer.Font = TextManager.GetFont("Calibri");

              // ONCE YOU ARE DONE LOADING, BE SURE TO SET YOUR READY
              // PROPERTY TO TRUE SO MY ENGINE DOESN'T SCREAM AT YOU
              _isReady = true;
        }
コード例 #29
0
 public ZackKamakazi(string id, StaticModel staticModel)
     : base(id, staticModel)
 {
 }
コード例 #30
0
ファイル: StaticModel.cs プロジェクト: fakkoweb/AsTKoids
 public void addChildren(StaticModel child)
 {
     if (child != null)
     {
         //is it already there? if not... (how to check?)
         try
         {
             _childrenModels.Add(child);
         }
         catch(System.Exception e)
         {
             Output.WriteLine(e.Message);
         }
         _hasChildren = true;
         if (child.ParentModel == null || (child.ParentModel != null && StaticModel.CompareTo(child.ParentModel, this) != Comparison.Equal) )
             child.setParent(this);
     }
 }