Esempio n. 1
0
        // MARK:- Enemy Information
        private void MakeWaveOfEnemies()
        {
            int wave = this.playerContext.Wave;

            if (wave > 10)
            {
                wave = 10;
            }
            for (int i = 0; i < wave; i++)
            {
                EnemyOrb orb = EnemyOrb.MakeRandom(//Game.Logic.Core.OrbStyle.blue ,
                    new CGSize(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height));
                graphicsItems.Add(orb);
                orb.MoveRandom();

                /*
                 * orb = EnemyOrb.Make(Game.Logic.Core.OrbStyle.purple,
                 *  new CGSize(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height));
                 * graphicsItems.Add(orb);
                 * orb.MoveRandom();
                 */
            }
        }
Esempio n. 2
0
    public static int materialType = 0; //壁と床の色を決める乱数

    void Start()
    {
        horizon    = SelectStage.horizon;
        vertical   = SelectStage.vertical;
        enemyCount = SelectStage.enemyCreateCount;
        if (SelectStage.type == 6)
        {
            materialType = rand.Next(0, 6);
        }
        else
        {
            materialType = SelectStage.type;
        }
        //AudioManager.Instance.PlayBGM("Main1");

        /* ×外×外×外×
         * 外へ壁へ壁へ外
         * ×壁×壁×壁×
         * 外へ壁へ壁へ外
         * ×壁×壁×壁×
         * 外へ壁へ壁へ外
         * ×外×外×外×
         * 部屋の大きさ*2+1*/
        roomArray = new MapType[vertical * 2 + 1, horizon * 2 + 1];

        //部屋の生成
        for (int i = 0; i < vertical; i++)
        {
            for (int j = 0; j < horizon; j++)
            {
                GameObject floor = Instantiate(smallRoom, new Vector3(j * 10, 0, i * 10), Quaternion.identity);
                roomArray[i * 2 + 1, j * 2 + 1] = MapType.room;
            }
        }
        //外壁の生成
        for (int i = 0; i < roomArray.GetLength(0); i++)
        {
            for (int j = 0; j < roomArray.GetLength(1); j++)
            {
                //外壁を生成しないところをスキップする
                if ((i % 2 == 0 && j % 2 == 0) || (i % 2 == 1 && j % 2 == 1))
                {
                    continue;
                }
                if (!(i == 0 || i == roomArray.GetLength(0) - 1 || j == 0 || j == roomArray.GetLength(1) - 1))
                {
                    continue;
                }
                //外壁を生み出す
                Instantiate(outerWall, new Vector3(j * 5 - 5, 1.25f, i * 5 - 5), Quaternion.identity);
                roomArray[i, j] = MapType.wall;
            }
        }
        //内壁の生成
        for (int i = 0; i < roomArray.GetLength(0); i++)
        {
            for (int j = 0; j < roomArray.GetLength(1); j++)
            {
                //内壁を生成しないところをスキップする
                if ((i % 2 == 0 && j % 2 == 0) || (i % 2 == 1 && j % 2 == 1))
                {
                    continue;
                }
                if ((i == 0 || i == roomArray.GetLength(0) - 1) || (j == 0 || j == roomArray.GetLength(1) - 1))
                {
                    continue;
                }
                //内壁をランダムに生み出す
                randomCreate = rand.Next(0, 3);
                if (randomCreate != 1)
                {
                    Instantiate(block, new Vector3(j * 5 - 5, 1.25f, i * 5 - 5), Quaternion.identity);
                    roomArray[i, j] = MapType.wall;
                }
            }
        }
        //敵の生成
        foreach (Vector2Int room in GetEnemySpawnRoom())
        {
            EnemyOrb spawnEnemy = Instantiate(
                enemy,
                new Vector3((room.y - 1) / 2 * 10, 1f, (room.x - 1) / 2 * 10),
                Quaternion.identity
                ).GetComponent <EnemyOrb>();
            //生成と同時に部屋の位置座標を入れる
            spawnEnemy.currentPosition = room;
            spawnEnemy.wc = this;
            enemyes.Add(spawnEnemy);
            roomArray[room.y, room.x] = MapType.enemyRoom;
        }

        for (int i = 0; i < others.Length; i++)
        {
            randomOthersX = rand.Next(0, horizon);
            randomOthersZ = rand.Next(0, vertical);
            Instantiate(others[i], new Vector3(randomOthersX * 10, 0, randomOthersZ * 10), Quaternion.identity);
        }
    }
Esempio n. 3
0
        private void SurvivalViewController_Paint(object sender, PaintEventArgs e)
        {
            Graphics gctx = e.Graphics;

            if (IsGraphicsQualitySet == false)
            {
                IsGraphicsQualitySet = true;

                gctx.CompositingQuality = CompositingQuality.HighSpeed;
                gctx.PixelOffsetMode    = PixelOffsetMode.None;
                gctx.SmoothingMode      = SmoothingMode.None;
                gctx.InterpolationMode  = InterpolationMode.Default;
            }


            gctx.Clear(Color.White);

            CGRect bounds = new CGRect(0, 0, ClientSize.Width, ClientSize.Height);

            int orbCount = 0;

            List <OOEGraphicsItem> graphicsItems = new List <OOEGraphicsItem>(this.graphicsItems);

            foreach (OOEGraphicsItem item in graphicsItems)
            {
                if (item is PowerUp)
                {
                    PowerUp targetPowerUp = item as PowerUp;
                    if (targetPowerUp == healthPowerup)
                    {
                        if (player.IsInCollisionRangeOf(targetPowerUp))
                        {
                            playerContext.Heal();

                            this.graphicsItems.Remove(targetPowerUp);
                            healthPowerup = null;
                        }
                    }
                }

                if (item is EnemyOrb)
                {
                    EnemyOrb enemy = item as EnemyOrb;
                    orbCount += 1;

                    /*
                     * float x = player.frame.origin.x - enemy.frame.origin.x;
                     * float y = player.frame.origin.y - enemy.frame.origin.y;
                     * float rPlayer = player.frame.size.width / 2;
                     * float rEnemy = player.frame.size.width / 2;
                     */

                    if (player.IsInCollisionRangeOf(enemy) /*Math.Pow(x, 2) + Math.Pow(y, 2) <= Math.Pow(rPlayer+rEnemy,2)*/)
                    {
                        if (enemy.Style != player.Style)
                        {
                            // Decrease Health
                            playerContext.Injur();
                            playerContext.ResetSteak();

                            player.DecreaseSize();
                            playerContext.LastEatenOrb = Game.Logic.Core.OrbStyle.none;
                        }
                        else
                        {
                            orbCount -= 1;
                            enemy.Dispose();
                            this.graphicsItems.Remove(enemy);
                            playerContext.IncreaseScore();

                            AddStatusText(new CGPoint(player.frame.origin.x, player.frame.origin.y - player.frame.size.height), playerContext.ChangeInScore);


                            if (playerContext.LastEatenOrb == enemy.Style)
                            {
                                player.IncreaseSize();
                            }
                            else
                            {
                                player.DecreaseSize();
                                playerContext.LastEatenOrb = enemy.Style;
                            }
                        }

                        OnOrbCollision();
                    }
                }
                item.DrawIn(bounds, gctx);
            }
            player.DrawIn(bounds, gctx);


            if (orbCount == 0)
            {
                OnPlayerWin();
            }
        }