コード例 #1
0
        public void SelectedEnemySpawnPoint(HUD invoker)
        {
            _3DGameObject enemyMaker = new _3DGameObject();

            enemyMaker.Tag      = "EnemySpawnPoint";
            enemyMaker.renderer = new BillboardRenderer(Game.Content.Load <Texture2D>(@"Sprites\EnemySpawnPoint"));
            enemyMaker.AddComponent(enemyMaker.renderer);
            enemyMaker.collider = new Collider(new BoundingBox(new Vector3(-0.5f, 0, -0.5f), new Vector3(0.5f, 1, 0.5f)));
            enemyMaker.AddComponent(new SelectPointController());
            enemyMaker.transformation.ScaleMatrix = Matrix.CreateScale(5);
            Game.Components.Add(enemyMaker);
        }
コード例 #2
0
        public void AddObject(_3DGameObject gameObject)
        {
            if (this == RootPartition)
            {
                Partition partition = FindPartition(gameObject.transformation.Position);
                partition.AddObject(gameObject);
                return;
            }

            this.managedObjects.Add(gameObject);
            Game.Components.Add(gameObject);
            gameObject.partition = this;
        }
コード例 #3
0
        public TankBullet(ModelType modelType, _3DGameObject owner)
        {
            this.damage = 20;
            this.owner  = owner;

            Model bulletModel = Game.Content.Load <Model>(modelType.ToDescription());

            renderer = new ModelRenderer(bulletModel);
            AddComponent(renderer);

            collider = new Collider(bulletModel);
            AddComponent(collider);

            physics = new BulletPhysics();
            AddComponent(physics);
        }
コード例 #4
0
        public void SelectPlayerStartPoint(HUD invoker)
        {
            if (playerStartPointMaker != null && Game.Components.Contains(playerStartPointMaker))
            {
                Game.Components.Remove(playerStartPointMaker);
            }

            playerStartPointMaker          = new _3DGameObject();
            playerStartPointMaker.Tag      = "PlayerStartPoint";
            playerStartPointMaker.renderer = new BillboardRenderer(Game.Content.Load <Texture2D>(@"Sprites\PlayerStartPoint"));
            playerStartPointMaker.AddComponent(playerStartPointMaker.renderer);
            playerStartPointMaker.collider = new Collider(new BoundingBox(new Vector3(-0.5f, 0, -0.5f), new Vector3(0.5f, 1, 0.5f)));
            playerStartPointMaker.AddComponent(new SelectPointController());
            playerStartPointMaker.transformation.ScaleMatrix = Matrix.CreateScale(5);
            Game.Components.Add(playerStartPointMaker);
        }
コード例 #5
0
        public static List <GameObject> GetObjectsForCollisionDetection(_3DGameObject gameObject)
        {
            List <GameObject> returnValue = new List <GameObject>();

            int pX = gameObject.partition.x;
            int pY = gameObject.partition.y;
            int pZ = gameObject.partition.z;

            for (int x = -1; x <= 1; x++)
            {
                for (int y = -1; y <= 1; y++)
                {
                    for (int z = -1; z <= 1; z++)
                    {
                        int fX = pX + x;
                        int fY = pY + y;
                        int fZ = pZ + z;

                        if (fX < 0 || fX >= X)
                        {
                            continue;
                        }
                        if (fY < 0 || fY >= Y)
                        {
                            continue;
                        }
                        if (fZ < 0 || fZ >= Z)
                        {
                            continue;
                        }

                        PartitionList[fX, fY, fZ].renderer.SetColor(Color.Yellow);

                        returnValue.AddRange(PartitionList[fX, fY, fZ].managedObjects);
                    }
                }
            }

            return(returnValue);
        }
コード例 #6
0
 public void RemoveObject(_3DGameObject gameObject)
 {
     this.managedObjects.Remove(gameObject);
     Game.Components.Remove(gameObject);
     gameObject.partition = null;
 }