Esempio n. 1
0
 // Use this for initialization
 void Start()
 {
     state = nisseState.Walking;
     moveX = startDirection;
     setCharacterStats(enemyType);
     maxHP = healthPoints;
 }
Esempio n. 2
0
 // Override virtual functions
 public override void attack()
 {
     gameObject.GetComponent <Rigidbody2D>().velocity = new Vector2(0, gameObject.GetComponent <Rigidbody2D>().velocity.y);
     this.state = nisseState.Attack;
     GetComponent <Animator>().SetBool("attack", true);
     canAttack = false;
 }
Esempio n. 3
0
    private void Event_NisseAttackOver()
    {
        // Create projectile
        GameObject missile = Instantiate(projectileHorizontal, this.transform.position, this.transform.rotation);

        missile.GetComponent <nisse_fireball>().setHorz_dir(moveX);

        // Update animation and reset state
        GetComponent <Animator>().SetBool("attack", false);
        this.state = nisseState.Walking;

        // Cooldown timer for next attack
        Debug.Log("timer start");
        StartCoroutine("AttackCooldownCo");
    }
Esempio n. 4
0
 public override void death()
 {
     this.state = nisseState.Dying;
     if (enemyType == enemyCharacter.Bamse)
     {
         healthBar.GetComponent <HealthBar>().UpdateHealthBar(healthPoints, maxHP);
         PlayerPrefs.SetInt("PedoBamseIsDefeated", 1);
     }
     woofSound.Play();
     canAttack = false;                                                           // Enemy can't attack anymore
     gameObject.GetComponent <Rigidbody2D> ().velocity = new Vector2(0.0f, 0.0f); // Enemy stops moving
     damageTrigger.SetActive(false);
     //gameObject.GetComponentInChildren<ObjectStats>().enabled = false; // Enemy touch won't hurt player anymore
     GetComponent <Animator> ().SetBool("isDying", true);
     StartCoroutine("waitForDeathAnimationCo");
 }