Ejemplo n.º 1
0
 public void TargetAINull()
 {
     if (aiDestination.target == null)
     {
         aiDestination.target = GameInstances.GetPlayer().transform;
     }
 }
Ejemplo n.º 2
0
 public void SetScorePoints()
 {
     if (GameInstances.GetPlayer().state != ShipState.DISABLED)
     {
         GameInstances.GetPlayer().amountPoints += amountPoints;
     }
 }
Ejemplo n.º 3
0
    public void AddLifeBar()
    {
        if (!HasLifeBar(GameInstances.GetPlayer()))
        {
            LifeBarInfo _lifeBar = GameInstances.instance.poolSystemInstance.TryToGetLifeBar();
            _lifeBar.owner = GameInstances.GetPlayer();
            listLifeBarInfo.Add(_lifeBar);
        }

        for (int i = 0; i < GameInstances.instance.listShooterEnemies.Count; i++)
        {
            ShooterEnemy enemyIndex = GameInstances.instance.listShooterEnemies[i];
            if (!HasLifeBar(enemyIndex))
            {
                LifeBarInfo _lifeBar = GameInstances.instance.poolSystemInstance.TryToGetLifeBar();
                _lifeBar.owner = enemyIndex;
                listLifeBarInfo.Add(_lifeBar);
            }
        }

        for (int i = 0; i < GameInstances.instance.listChaserEnemies.Count; i++)
        {
            ChaserEnemy enemyIndex = GameInstances.instance.listChaserEnemies[i];
            if (!HasLifeBar(enemyIndex))
            {
                LifeBarInfo _lifeBar = GameInstances.instance.poolSystemInstance.TryToGetLifeBar();
                _lifeBar.owner = enemyIndex;
                listLifeBarInfo.Add(_lifeBar);
            }
        }
    }
Ejemplo n.º 4
0
 public void DistanceBetweenPlayer()
 {
     if (aiPath.reachedDestination && state != ShipState.DISABLED)
     {
         _lookAtdirection   = GameInstances.GetPlayer().transform.position - transform.position;
         transform.rotation = Quaternion.LookRotation(Vector3.forward, _lookAtdirection);
     }
 }
Ejemplo n.º 5
0
 public void DisableFindingPlayer()
 {
     if (state == ShipState.DISABLED || GameInstances.GetPlayer().state == ShipState.DISABLED || Spawner.spawnerInstance.gameFinish == true)
     {
         aiDestination.enabled = false;
         aiPath.enabled        = false;
     }
 }
Ejemplo n.º 6
0
    public void CheckDistanceBtwPlayer()
    {
        _distanceBetween = Vector2.Distance(transform.position, GameInstances.GetPlayer().transform.position);

        if (_distanceBetween > maxDistanceBtwShooter)
        {
            gameObject.SetActive(false);
        }
    }
Ejemplo n.º 7
0
    public void SetScorePoints()
    {
        scorePointsText.text = GameInstances.GetPlayer().amountPoints.ToString();

        if (GameInstances.GetPlayer().state == ShipState.DISABLED || Spawner.spawnerInstance.gameFinish == true)
        {
            endScorePointsText.text = GameInstances.GetPlayer().amountPoints.ToString();
        }
    }
Ejemplo n.º 8
0
    public void EnemyHitsPlayer()
    {
        _distanceBetween = Vector2.Distance(transform.position, GameInstances.GetPlayer().transform.position);

        if (_distanceBetween <= 0.5 && state != ShipState.DISABLED && GameInstances.GetPlayer().state != ShipState.DISABLED)
        {
            GameInstances.GetPlayer().TakeDamage(maxLife);
            TakeDamage(maxLife);
        }
    }
Ejemplo n.º 9
0
 void Update()
 {
     DisableFindingPlayer();
     if (GameInstances.GetPlayer().state == ShipState.DISABLED)
     {
         return;
     }
     SetShipGraphics();
     Dead();
 }
Ejemplo n.º 10
0
 public void CheckEndGame()
 {
     if (gamePlayTime >= gameMinutes * 60 || GameInstances.GetPlayer().state == ShipState.DISABLED)
     {
         EndGame();
     }
     else
     {
         if (currentCountdown >= 1 && GameInstances.GetPlayer().state != ShipState.DISABLED)
         {
             GamePlayTime();
         }
     }
 }
Ejemplo n.º 11
0
    public void EnemyShooting()
    {
        _distanceBetween = Vector2.Distance(transform.position, GameInstances.GetPlayer().transform.position);

        if (_distanceBetween < distanceToShoot && state != ShipState.DISABLED && GameInstances.GetPlayer().state != ShipState.DISABLED && Spawner.spawnerInstance.gameFinish == false)
        {
            if (timeBtwShots <= 0)
            {
                Bullet _bullet = GameInstances.instance.poolSystemInstance.TryToGetBullet();
                _bullet.transform.position   = shotPoint.position;
                _bullet.rBodyBullet.velocity = shotPoint.up * -1 * _bullet.speed;
                _bullet.currentShooter       = transform;
                timeBtwShots = startTimeBtwShots;
            }
            else
            {
                timeBtwShots -= Time.deltaTime;
            }
        }
    }