Example #1
0
 // Update is called once per frame
 void Update()
 {
     x_velocity     = rb2d.velocity.x;
     y_velocity     = rb2d.velocity.y;
     enemyPositionX = base.transform.position.x;
     enemyPositionY = base.transform.position.y;
     SetAreaPosition();
     health_points.GetComponent <Text>().text = healthLevel.ToString();
     if (!heroFightControl.HeroIsAttacking())
     {
         underAttack = false;
     }
     if (heroFightControl.HeroIsAttacking() && !underAttack && EnemyInAttackArea(heroFightControl.AttackArea()))
     {
         underAttack = true;
         TakeDamage(ref heroFightControl.GetAttackPoint(), ref heroFightControl.AttackDirection());
         SpecialDamage(ref heroFightControl.GetSpecialEffect());
     }
 }
Example #2
0
    // Update is called once per frame
    void FixedUpdate()
    {
        // show hero health level
        health_points.GetComponent <Text>().text = healthLevel.ToString();

        // hero is noisy when attacks or make noises during moves
        if (fightControl.HeroIsAttacking() || heroMovingControl.HeroIsMovingLoudly())
        {
            heroIsNoisy = true;
        }
        else
        {
            heroIsNoisy = false;
        }

        //set hero position
        heroPosition = new Vector2(base.transform.position.x, base.transform.position.y);
    }