Exemplo n.º 1
0
        public TrackingCamera(Game game, Tank target)
            : base(game)
        {
            _target = target;

            _pitch = MathHelper.ToRadians(45);
            _yaw = 0;
            _distance = 10;
        }
Exemplo n.º 2
0
        public Bullet(Game game, Tank owner, Vector3 position, Vector3 velocity)
            : base(game)
        {
            Owner = owner;
            Position = position;
            Velocity = velocity;

            IsDead = false;
        }
Exemplo n.º 3
0
 public TankController(Game1 game, Tank tank)
     : base(game)
 {
     _tank = tank;
 }
Exemplo n.º 4
0
 public TankControllerAI(Game1 game, Tank tank)
     : base(game, tank)
 {
 }
Exemplo n.º 5
0
        public bool Collides(Tank otherTank)
        {
            bool result = false;

            int[] collisionMeshIndices = { 0, 1, 4, 5, 10, 11 };

            for (int i = 0; i < 6; i++)
            {
                ModelMesh mesh = _tankModel.Meshes[collisionMeshIndices[i]];

                BoundingSphere boundingSphere = mesh.BoundingSphere;

                boundingSphere = boundingSphere.Transform(_boneTransforms[mesh.ParentBone.Index]);

                for (int c = 0; c < 6; c++)
                {
                    ModelMesh otherMesh = otherTank._tankModel.Meshes[collisionMeshIndices[c]];

                    BoundingSphere otherBoundingSphere = otherMesh.BoundingSphere;

                    otherBoundingSphere = otherBoundingSphere.Transform(otherTank._boneTransforms[otherMesh.ParentBone.Index]);

                    if (boundingSphere.Contains(otherBoundingSphere) != ContainmentType.Disjoint)
                    {
                        result = true;
                        break;
                    }
                }

                if (result == true)
                    break;
            }

            return result;
        }