Ejemplo n.º 1
0
 protected virtual void InitializeAttackState(Enemy enemy)
 {
     if (enemyAttack == null)
     {
         enemyAttack = new EnemyAttacking(enemy);
     }
 }
    private void Awake()
    {
        player = FindObjectOfType <PlayerMovement>();

        animator       = GetComponent <Animator>();
        agent          = GetComponent <NavMeshAgent>();
        enemyAttacking = GetComponent <EnemyAttacking>();
    }
Ejemplo n.º 3
0
    void Awake()
    {
        game = Game.GetGame();

        slimeAudio           = GetComponent <AudioSource>();
        slimeMovement        = GetComponent <SlimeMovement>();
        enemyAttacking       = GetComponent <EnemyAttacking>();
        anim                 = GetComponent <Animation>();
        anim["Damage"].layer = 1;
        colliders            = GetComponents <Collider>();

        currentHealth = startingHealth; // set it to a more reasonable value
    }
Ejemplo n.º 4
0
    void OnCollisionEnter2D(Collision2D playerCol)
    {
        print("Inside  PlayerCollision enter");
        EnemyAttacking EnemyHitting = playerCol.collider.GetComponent <EnemyAttacking>();

        if (EnemyHitting)
        {
            print("Player Hit");
            PlayerHealth -= EnemyHitting.EnemyDamage();
        }
        if (PlayerHealth <= 0)
        {
            SceneManager.LoadScene(SceneManager.GetSceneAt(0).name);
        }
    }
Ejemplo n.º 5
0
 void Awake()
 {
     anim             = this.GetComponent <Animator>();
     agent            = this.GetComponent <NavMeshAgent>();
     move             = this.GetComponent <EnemyMovementControll>();
     capsuleCollider  = this.GetComponent <CapsuleCollider>();
     m_particleSystem = this.GetComponentInChildren <ParticleSystem>();
     enemyAttack      = this.GetComponentInChildren <EnemyAttacking>();
     gamecontroller   = GameObject.FindGameObjectWithTag("GameController");
     //healthBarPrefab =
     myHealthBar  = healthBarPrefab; //Instantiate<GameObject>(healthBarPrefab);
     SliderObject = myHealthBar.GetComponentInChildren <Canvas>();
     healthslider = myHealthBar.GetComponentInChildren <Slider>();
     myCurHp      = maxHp;
     updateHealthSliderUI();
 }
Ejemplo n.º 6
0
    void Awake()
    {
        game = Game.GetGame();

        player         = GameObject.FindGameObjectWithTag("Player").transform;
        playerHealth   = player.GetComponent <PlayerHealth>();
        playerMove     = player.GetComponent <PlayerMovement>();
        enemyHealth    = GetComponent <SlimeHealth>();
        enemyAttacking = GetComponent <EnemyAttacking> ();
        anim           = GetComponent <Animation>();

        nav = GetComponent <NavMeshAgent>();

        SetNavEnabled(false);

        isStunned = false;
    }