Exemplo n.º 1
0
        private void Start()
        {
            enemyHandlerList = new List <EnemyHandler>();

            playerHandler         = PlayerHandler.CreatePlayer(GetClosestEnemyHandler);
            playerHandler.OnDead += delegate(object sender, EventArgs e) {
                Window_GameOver.Show();
            };

            cameraFollow.Setup(70f, 2f, playerHandler.GetPosition);

            FunctionPeriodic.Create(SpawnEnemy, 1.5f);
        }
Exemplo n.º 2
0
        public static EnemyHandler CreateEnemy(Vector3 spawnPosition, PlayerHandler playerHandler)
        {
            Transform    enemyTransform = Instantiate(GameAssets.i.pfEnemyTransform, spawnPosition, Quaternion.identity);
            EnemyHandler enemyHandler   = enemyTransform.GetComponent <EnemyHandler>();

            HealthSystem healthSystem = new HealthSystem(100);
            HealthBar    healthBar    = Instantiate(GameAssets.i.pfHealthBar, spawnPosition + new Vector3(0, 10), Quaternion.identity, enemyTransform).GetComponent <HealthBar>();

            healthBar.Setup(healthSystem);

            enemyHandler.Setup(playerHandler, healthSystem);

            return(enemyHandler);
        }
Exemplo n.º 3
0
        public static PlayerHandler CreatePlayer(Func <Vector3, EnemyHandler> getClosestEnemyHandlerFunc)
        {
            Transform playerTransform = Instantiate(GameAssets.i.pfPlayerTransform, new Vector3(0, 0), Quaternion.identity);

            HealthSystem healthSystem = new HealthSystem(100);
            HealthBar    healthBar    = Instantiate(GameAssets.i.pfHealthBar, new Vector3(0, 10), Quaternion.identity, playerTransform).GetComponent <HealthBar>();

            healthBar.Setup(healthSystem);

            PlayerHandler playerHandler = playerTransform.GetComponent <PlayerHandler>();

            playerHandler.Setup(healthSystem, getClosestEnemyHandlerFunc);

            return(playerHandler);
        }