Пример #1
0
        public override void Build(GameRunningState Game)
        {
            //we build a interior rectangular prism centered on 0,0.

            //first, create the Top face.
            BlockObject TopFace = new BlockObject(Game.Owner,new Vector3(-_ArenaSize.X/2,_ArenaSize.Y/2-_WallWidth,-ArenaSize.Z/2),new Vector3(_ArenaSize.X,_WallWidth,_ArenaSize.Z),Vector3.Zero);

            //Bottom face is similar but at the bottom.
            BlockObject BottomFace = new BlockObject(Game.Owner, new Vector3(-_ArenaSize.X / 2, -_ArenaSize.Y / 2 , -ArenaSize.Z / 2), new Vector3(_ArenaSize.X, _WallWidth, _ArenaSize.Z), Vector3.Zero);

            //Side face, for X Direction.
            BlockObject LeftFace = new BlockObject(Game.Owner,
                new Vector3(-_ArenaSize.X / 2 - _WallWidth,
                    -_ArenaSize.Y / 2, -_ArenaSize.Z / 2),
                    new Vector3(_WallWidth, _ArenaSize.Y, _ArenaSize.Z), Vector3.Zero);
            BlockObject RightFace = new BlockObject(Game.Owner,
                new Vector3(_ArenaSize.X / 2,
                    -_ArenaSize.Y / 2, -_ArenaSize.Z / 2),
                    new Vector3(_WallWidth, _ArenaSize.Y, _ArenaSize.Z), Vector3.Zero);

            BlockObject[] Faces = new BlockObject[] { TopFace, BottomFace, LeftFace, RightFace };

            foreach (var facebox in Faces)
            {
                facebox.PhysicsObject.IsStatic = true;
                Game.GameObjects.Add(facebox);
            }
        }
Пример #2
0
        public override bool Update(GameRunningState gameState)
        {
            List<Particle> removeelements = new List<Particle>();
            Particle.UpdatePoints(_Particles, gameState, removeelements.Add);

            foreach (var iterate in removeelements)
            {
                _Particles.Remove(iterate);
            }

            return false;
        }
Пример #3
0
 public void DoSetup(GameRunningState state)
 {
     firstPhase = (Phase)Instantiate(state.firstPhase);
     Debug.Log("Created firstPhase: " + firstPhase.name);
     mourning = (Phase)Instantiate(state.mourning);
     thePlayer = (PlayerController)Instantiate(state.player);
     level = (Transform)Instantiate(state.level);
     level.SendMessage("Setup");
     messageGUI = (MessageGUI)Instantiate(state.messageGUI);
     scoreGUI = (ScoreGUI)Instantiate(state.scoreGUI);
     spawner = level.GetComponent<Spawner>();
     currentPhase = firstPhase;
     ChangePhase(firstPhase);
 }
        public override void Render(GameRunningState gameState)
        {
            //GL.LineWidth(5);
            //GL.Viewport(0, 0, gameState.Width, gameState.Height);
            GL.Begin(BeginMode.Quads);
            GL.Color3(BallColor);
            Vector3[] usearray = new Vector3[] { new Vector3(0, 0, 0), new Vector3(10, 0, 0), new Vector3(10, 10, 0), new Vector3(0, 10, 0) };

            foreach(var iterate in usearray){

                GL.Vertex3(iterate);
            }

            GL.End();
        }
Пример #5
0
 public override bool Update(GameRunningState gameState)
 {
     Location += Velocity;
     Velocity = Vector3.Multiply(Velocity, _FallOff);
     if (DateTime.Now - Birth > TTL)
     {
         return true;
     }
     return false;
 }
Пример #6
0
 public override void Render(GameRunningState gameState)
 {
     //unused.
 }
Пример #7
0
 public static void UpdatePoints(IEnumerable<Particle> Particles,GameRunningState grs,Action<Particle> RemoveAction)
 {
     List<Particle> removeElements = new List<Particle>();
     foreach (var iterate in Particles)
     {
         if (iterate.Update(grs))
         {
             RemoveAction(iterate);
         }
     }
 }
Пример #8
0
        public override bool Update(GameRunningState gameState)
        {
            // rb.LinearVelocity = new JVector(Velocity.X,Velocity.Y,Velocity.Z);

            //throw new NotImplementedException();
              /*  SphereVertices = GeometryHelper.CalculateSphereVertices((float) Radius, (float) Radius, 100, 100);
            SphereElements = GeometryHelper.CalculateSphereElements((float) Radius, (float) Radius, 100, 100);*/
            return false;
        }
Пример #9
0
 public override void Render(GameRunningState gameState)
 {
     //GL.BindTexture(TextureTarget.Texture2D, PrehenderGame.instance.TextureMan[_TextureMapName]);
     GL.Disable(EnableCap.Texture2D);
     GL.Color3(_elementColor);
     SphereShape sphereshape = rb.Shape as SphereShape;
     dsDrawSphere(rb.Position, rb.Orientation, sphereshape.Radius - 0.1f);
 }
Пример #10
0
 public abstract void Render(GameRunningState gameState);
 public override bool Update(GameRunningState gameState)
 {
     return false;
       //  throw new NotImplementedException();
 }
Пример #12
0
        public override bool Update(GameRunningState gameState)
        {
            //BlockBody.Update();

            return false;
        }
Пример #13
0
        public override void Render(GameRunningState gameState)
        {
            var A = new Vector3(Location.X, Location.Y, Location.Z);
            var B = new Vector3(Location.X + Size.X, Location.Y, Location.Z);
            var C = new Vector3(Location.X + Size.X, Location.Y+Size.Y, Location.Z);
            var D = new Vector3(Location.X, Location.Y+Size.Y, Location.Z);

            var E = new Vector3(Location.X, Location.Y, Location.Z+Size.Z);
            var F = new Vector3(Location.X + Size.X, Location.Y, Location.Z+Size.Z);
            var G = new Vector3(Location.X + Size.X, Location.Y + Size.Y, Location.Z+Size.Z);
            var H = new Vector3(Location.X, Location.Y + Size.Y, Location.Z+Size.Z);
            if (BlockBody.Shape is BoxShape)
            {
                BoxShape bs = BlockBody.Shape as BoxShape;
                dsDrawBox(BlockBody.Position, BlockBody.Orientation, bs.Size);

            }
            //GL.BindTexture(TextureTarget.Texture2D, PrehenderGame.instance.TextureMan[FaceTextures[BlockFaceConstants.Front]]);

            /*
            GL.Begin(BeginMode.Quads);
            //GL.Color3(Color.Blue);
            //Front face ABCD.
            GL.TexCoord2(0, 0);
            GL.Vertex3(A);
            GL.TexCoord2(1, 0);
            GL.Vertex3(B);
            GL.TexCoord2(1, 1);
            GL.Vertex3(C);
            GL.TexCoord2(0, 1);
            GL.Vertex3(D);
            GL.End();
            GL.BindTexture(TextureTarget.Texture2D, PrehenderGame.instance.TextureMan["GENERIC_2"]);
            GL.BindTexture(TextureTarget.Texture2D, PrehenderGame.instance.TextureMan[FaceTextures[BlockFaceConstants.Back]]);
            GL.Begin(BeginMode.Quads);

            //Front: ABCD
            //Left: ADGE
            //Right: BFHC
            //Top:EFBA
            //Bottom:DCHG
            //Back:FEGH
            GL.TexCoord2(0, 0);
            GL.Vertex3(E);
            GL.TexCoord2(1, 0);
            GL.Vertex3(F);
            GL.TexCoord2(1, 1);
            GL.Vertex3(G);
            GL.TexCoord2(0, 1);
            GL.Vertex3(H);
            GL.End();
            //Top Face
            GL.BindTexture(TextureTarget.Texture2D, PrehenderGame.instance.TextureMan[FaceTextures[BlockFaceConstants.Bottom]]);
            GL.Begin(BeginMode.Quads);
            GL.TexCoord2(0, 0);
            GL.Vertex3(E);
            GL.TexCoord2(1, 0);
            GL.Vertex3(F);
            GL.TexCoord2(1, 1);
            GL.Vertex3(B);
            GL.TexCoord2(0, 1);
            GL.Vertex3(A);
            GL.End();
            GL.BindTexture(TextureTarget.Texture2D, PrehenderGame.instance.TextureMan[FaceTextures[BlockFaceConstants.Top]]);
            GL.Begin(BeginMode.Quads);
            GL.TexCoord2(0, 0);
            GL.Vertex3(D);
            GL.TexCoord2(1, 0);
            GL.Vertex3(C);
            GL.TexCoord2(1, 1);
            GL.Vertex3(G);
            GL.TexCoord2(0, 1);
            GL.Vertex3(H);
            GL.End();
            GL.BindTexture(TextureTarget.Texture2D, PrehenderGame.instance.TextureMan[FaceTextures[BlockFaceConstants.Right]]);
            GL.Begin(BeginMode.Quads);
            GL.TexCoord2(0, 0);
            GL.Vertex3(G);
            GL.TexCoord2(1, 0);
            GL.Vertex3(E);
            GL.TexCoord2(1, 1);
            GL.Vertex3(A);
            GL.TexCoord2(0, 1);
            GL.Vertex3(D);
            GL.End();

            GL.Begin(BeginMode.Quads);
            GL.TexCoord2(0, 0);
            GL.Vertex3(B);
            GL.TexCoord2(1, 0);
            GL.Vertex3(F);
            GL.TexCoord2(1, 1);
            GL.Vertex3(G);
            GL.TexCoord2(0, 1);
            GL.Vertex3(C);
            GL.End();

            GL.BindTexture(TextureTarget.Texture2D, PrehenderGame.instance.TextureMan[FaceTextures[BlockFaceConstants.Left]]);
            GL.Begin(BeginMode.Quads);
            GL.TexCoord2(0, 0);
            GL.Vertex3(E);
            GL.TexCoord2(1, 0);
            GL.Vertex3(A);
            GL.TexCoord2(1, 1);
            GL.Vertex3(D);
            GL.TexCoord2(0, 1);
            GL.Vertex3(H);
            GL.End();

              /*  GL.Color3(Color.Firebrick);
            GL.Vertex3(_Location.X+Size.X, _Location.Y, _Location.Z);
            GL.Vertex3(_Location.X+Size.X, _Location.X, _Location.Z + Size.Z);
            GL.Vertex3(_Location.X+Size.X, _Location.Y + Size.Y, _Location.Z + Size.Z);
            GL.Vertex3(_Location.X+Size.X, _Location.Y + Size.Y, _Location.Z);*/
        }
Пример #14
0
 //return true to remove this element.
 public abstract bool Update(GameRunningState gameState);
Пример #15
0
    public override void Run()
    {
        if (GameManager.instance.gameLevel == GameManager.instance.lastLevel &&
            GameManager.instance.waveNumber == GameManager.instance.wavesPerGameLevel)
        {
            finalBoss = true;
        }


        switch (gameRunningState)
        {
        case GameRunningState.wave:

            Debug.Log("Level " + GameManager.instance.gameLevel);
            Debug.Log("Wave " + GameManager.instance.waveNumber);

            GameManager.instance.stateText = "-  " + "Level " + GameManager.instance.gameLevel + " : " + "Wave " + GameManager.instance.waveNumber + "  -";

            if (GameManager.instance.waveTimer >= GameManager.instance.waveDuration)
            {
                GameManager.instance.canSpawn      = false;
                OilManager.instance.canGenerateOil = false;

                if (EnemiesManager.instance.enemiesOnScreen == 0)
                {
                    UpgradesManager.instance.canGeneratePoints = false;
                    intervalTimer = 0f;
                    GameManager.instance.waveNumber++;
                    if (GameManager.instance.waveNumber > GameManager.instance.wavesPerGameLevel)
                    {
                        GameManager.instance.waveNumber = 1;
                        GameManager.instance.gameLevel++;
                    }
                    if (GameManager.instance.gameLevel >= 6)
                    {
                        GameManager.instance.ChangeGameState(GameManager.GameState.endGame);
                    }
                    else
                    {
                        gameRunningState = GameRunningState.interval;
                    }
                }
            }
            else
            {
                if (GameManager.instance.waveNumber == GameManager.instance.wavesPerGameLevel && !spawnedBoss)
                {
                    OilManager.instance.oilLevelMaxedCount++;
                    if (GameManager.instance.gameLevel == GameManager.instance.lastLevel)
                    {
                        EnemiesManager.instance.SpawnFinalBoss();
                    }
                    else
                    {
                        EnemiesManager.instance.SpawnBoss(OilManager.instance.oilLevelMaxedCount);
                    }
                    spawnedBoss = true;
                }

                Player.instance.canCastAbilities   = true;
                GameManager.instance.canSpawn      = true;
                OilManager.instance.canGenerateOil = true;
                GameManager.instance.waveTimer    += Time.deltaTime;
            }

            if (Player.instance.currentLifes <= 0)
            {
            }

            break;

        case GameRunningState.interval:

            Debug.Log("Interval!");

            GameManager.instance.stateText = "-  INTERVAL! Next: " + "Level " + GameManager.instance.gameLevel +
                                             " | " + "Wave " + GameManager.instance.waveNumber + "  -";

            intervalTimer += Time.deltaTime;
            Player.instance.canCastAbilities = false;

            if (intervalTimer >= intervalDuration)
            {
                gameRunningState = GameRunningState.wave;
                GameManager.instance.canSpawn              = true;
                OilManager.instance.canGenerateOil         = true;
                UpgradesManager.instance.canGeneratePoints = true;
                Player.instance.canCastAbilities           = true;
                GameManager.instance.waveTimer             = 0f;
                spawnedBoss = false;
            }

            break;

        default:
            break;
        }

        if (Player.instance.currentLifes <= 0)
        {
            Debug.Log("GAME OVER!");
            GameManager.instance.ChangeGameState(GameManager.GameState.gameOver);
        }
    }
Пример #16
0
 public override void Render(GameRunningState gameState)
 {
     Particle.RenderPoints(_Particles);
 }
Пример #17
0
 public abstract void Build(GameRunningState game);