Ejemplo n.º 1
0
 private void FixedUpdate()
 {
     if (_healthComponent.IsAlive())
     {
         EnemyMovement();
     }
 }
Ejemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (playerHealthComp.IsAlive())
     {
         DashIconUI();
     }
 }
Ejemplo n.º 3
0
 // Update is called once per frame
 void Update()
 {
     if (_healthComponent.IsAlive())
     {
         //Shoot(GetFireRateFromDistance());
         Shoot();
     }
 }
Ejemplo n.º 4
0
 // Update is called once per frame
 void Update()
 {
     if (_healthComp.IsAlive())
     {
         if (_enemyController.playerRef.GetComponentInParent <HealthComponent>().IsAlive() && _enemyController.playerRef != null && _enemyController.TargetDistance() <= _shootRange && _canShoot)
         {
             ShootProjectile();
         }
     }
 }
 // Update is called once per frame
 void FixedUpdate()
 {
     if (_healthComp.IsAlive())
     {
         //only shoot when engaged
         if (_enemyController.playerRef != null && _enemyController.TargetDistance() <= _shootRange && _canShoot && _enemyController.enemyState == EnemyState.engaged)
         {
             ShootProjectile();
         }
     }
 }
Ejemplo n.º 6
0
    private void FixedUpdate()
    {
        if (playerHealthComp.IsAlive())
        {
            if (canMove)
            {
                PlayerMovement(currentMovementSpeed);
            }

            DirectionCheck();
        }
        CheckEnemyBlockers();
    }
Ejemplo n.º 7
0
    // Update is called once per frame
    void Update()
    {
        if (healthComponent.IsAlive())
        {
            if (!playerController.isNPCInteracting && !gameManager.IsPause)
            {
                if (playerController.canMove)
                {
                    PlayerMoveInput();
                }

                if (playerController.canAttack)
                {
                    PlayerBasicAttacks();
                    PlayerAbilitySelect();
                }
            }

            MenuInput();
            PlayerNPCInteract();
        }
    }
Ejemplo n.º 8
0
 // Update is called once per frame
 void Update()
 {
     if (!_healthComponent.IsAlive())
     {
         Instantiate(essenceCollectable, transform.position, transform.rotation);
         Destroy(gameObject);
     }
     else
     {
         SetEnemyDirection();
         //ignore player collision
         Physics2D.IgnoreCollision(_playerTarget.GetComponent <Collider2D>(), physicsCollider);
     }
 }
Ejemplo n.º 9
0
    // Update is called once per frame
    void Update()
    {
        if (_healthComponent.IsAlive())
        {
            float deltaPosition = movementSpeed * Time.deltaTime;
            PlayerMovementBehaviour(deltaPosition);
            PlayerJump();
            PlayerDash();
            Slam();
            PlayerDirectionFace();
            EnergyRegenerate();
            WallSlide();

            //if healSplinter upgraded
            if (Input.GetKeyDown(KeyCode.I) && _addOns.healSplinter)
            {
                Heal();
                _uiManager.UpdateHealth();
            }
        }
        else
        {
            Debug.Log("Dead");
            _uiManager.ShowRestartPanel();
            dead        = true;
            rb.velocity = new Vector2(0, 0);
            //Death UI
            //No longer moving
            //Death anim
            //Game State Change
        }
        //onGroundCheckRepresentation = GetGround();
        if (stopVelocity)
        {
            rb.velocity = new Vector2(0, 0);
        }
    }
Ejemplo n.º 10
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        GameObject explosionRef = Resources.Load <GameObject>(AssetPaths.pref_explosion);

        //dealing damage code
        if (collision.GetComponentInParent <EnemyController>() && !collision.GetComponentInParent <EnemyController>().canRecieveDamage)
        {
            //if enemy, and has enemy controller, but cannot receive damage
            print("hit shield");
            if (isPlayerProj)
            {
                Destroy(gameObject);
            }
        }
        else if (collision.gameObject.layer == targetLayer && collision.GetComponentInParent <HealthComponent>() != null /*&& collision.gameObject.GetComponent<EnemyController>() && collision.gameObject.GetComponent<EnemyController>().canRecieveDamage*/)
        {
            //if enemy and health component exists
            print("Hit player");
            _healthComponent = collision.GetComponentInParent <HealthComponent>();

            if (_playerController && isPlayerProj)
            {
                _healthComponent.Damage(damage * _playerController.DamageMultiplier);
            }
            else
            {
                _healthComponent.Damage(damage);
            }

            if (_healthComponent.IsAlive())
            {
                Destroy(gameObject);
            }
            else
            {
                HitCounter();
            }
        }
        else if (collision.gameObject.layer == 13 && !isPlayerProj)
        {
            //if player melee attack to deflect
            //Destroy(gameObject);
            print("projectile reverted");
        }
        else if (collision.gameObject.layer == 14 && !isPlayerProj)
        {
            //if we are enemy projectile and run into playerproj layer
            //explode
            if (explosionRef)
            {
                Instantiate(explosionRef, transform.position, Quaternion.identity);
            }

            Destroy(gameObject);
            print("explode");
        }
        else if (gameObject.layer == 15 && collision.gameObject.layer == 15 && isPlayerProj)
        {
            //if we are enemyProj, and the other is enemyProj but WE have playerProj true, then explode and destroy
            if (explosionRef)
            {
                Instantiate(explosionRef, transform.position, Quaternion.identity);
            }

            Destroy(gameObject);
            print("explode");
        }
        else if (gameObject.layer == 15 && collision.gameObject.layer == 15 && !isPlayerProj && collision.GetComponent <ProjectileBehaviour>().isPlayerProj)
        {
            //if we are enmemyproj and they are enemyproj and our isPlayerProj is false but their isPlayerProj is true, then simply destroy.
            Destroy(gameObject);
        }
        else if (collision.gameObject.layer == 15 && isPlayerProj)
        {
            //if we are player proj and run into enemy proj
            Destroy(gameObject);
        }

        if (collision.gameObject.layer == 12)
        {
            //if environment blocker, destroy object
            Destroy(gameObject);
        }
    }
Ejemplo n.º 11
0
 // Update is called once per frame
 void Update()
 {
     if (_enemyController.playerRef != null)
     {
         if (_enemyController.TargetDistance() <= _attackRange && _enemyController.haveDirectlyEngaged && _ourHealthComp.IsAlive())
         {
             AttackPlayer();
         }
     }
 }
Ejemplo n.º 12
0
 public virtual bool IsAlive()
 {
     return(Health.IsAlive());
 }