예제 #1
0
        public static void Play(Player player)
        {
            int   fightNum = 1;
            bool  runAway  = false;
            Enemy enemy    = EnemyGenerator.GenerateEnemy();

            while (player.IsAlive && !runAway)
            {
                Console.WriteLine($"You met a {enemy.Name} (HP: {enemy.HitPoints}).");
                Console.WriteLine($"Your remaining HP: {player.HP}");
                Console.WriteLine();

                Console.Write("Fight? (y/n)\n>> ");

                if (Console.ReadLine().ToLower() == "n")
                {
                    runAway = true;
                    ConsoleHelper.WriteRedLine("\nYou ran away!");
                    break;
                }

                ConsoleHelper.WriteYellowBackgroundLine($"\nFight #{fightNum++}");

                if (Fight(player, enemy))
                {
                    enemy = EnemyGenerator.GenerateEnemy();
                }
            }
        }
예제 #2
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject == target)
     {
         renderBody.sprite = spriteAttack;
         Invoke("StopAttackAnim", 0.3f);
         enemyGenerator.GenerateEnemy(collision.gameObject.transform.position, collision.gameObject.transform.rotation);
         Destroy(target);
     }
 }
    IEnumerator WaitBeforeDeathState()
    {
        yield return(new WaitForSeconds(dyingTime));

        if (enemyGenerator != null)
        {
            Instantiate(soulMonsterPrefab, transform.position, Quaternion.identity);
            enemyGenerator.GenerateEnemy(transform.position, transform.rotation);
        }

        Destroy(gameObject);
    }
예제 #4
0
    private void UpdateEnemiesSpawn(RTPacket packet)
    {
        RTData data = packet.Data;

        int     id       = data.GetInt(1).Value;
        Vector2 position = data.GetVector2(3).Value;

        position = SignsExt.Vector2Sign(position, (Signs)data.GetInt(4).Value);
        float   rotation = data.GetFloat(5).Value;
        Vector2 velocity = data.GetVector2(6).Value;

        velocity = SignsExt.Vector3Sign(velocity, (Signs)data.GetInt(7).Value);

        m_enemyGenerator.GenerateEnemy(id, position, rotation, velocity, true);
    }
예제 #5
0
    /// <summary>
    /// isBattleフラグがtrueの時のみ前進する
    /// </summary>
    void Update()
    {
        if (Input.GetKey(KeyCode.A))
        {
            transform.Rotate(new Vector3(0, -0.9f, 0));
        }

        if (Input.GetKey(KeyCode.D))
        {
            transform.Rotate(new Vector3(0, 0.9f, 0));
        }

        if (CheckMoveCamera() == false)
        {
            return;
        }


        if (CheckMoveCamera() == true)
        {
            this.transform.position += new Vector3(dx * Time.deltaTime, 0, 0);


            if (gameObject.transform.position.x > 75)
            {
                isBoss = true;
            }
        }


        if (isBoss == true)
        {
            enemyGenerator.GenerateEnemy(isBoss);
            isBoss = false;
        }
    }