Ejemplo n.º 1
0
    void doAttack()
    {
        Color color = UnityUtils.RecursiveFind(transform, "Image").GetComponent <Image>().color;

        color.a = 0.0f;

        float unitCircleRotation = RotationUtils.MakePositiveAngle(transform.eulerAngles.z + 90);

        Color zeroAlphaColor = color;

        zeroAlphaColor.a = 0.0f;
        object[] obj = GameObject.FindObjectsOfType(typeof(GameObject));
        foreach (Enemy enemy in GameObject.FindObjectsOfType(typeof(Enemy)))
        {
            if (enemy.isInAttackArea(unitCircleRotation - this.currentAttack.angle,
                                     unitCircleRotation + this.currentAttack.angle,
                                     this.currentAttack.closeRadius,
                                     this.currentAttack.farRadius))
            {
                enemy.applyDamageTo(this.currentAttack.damage);
            }
        }

        // For now, change color of boss when he is attacking
        // TODO: Change when areas of damage is implemented
        gameObject.GetComponent <SpriteRenderer>().color = Color.red;

        if (currentCooldownBehaviour != null)
        {
            currentCooldownBehaviour.RestartCooldown();
        }

        this.aimColorModifier.FadeToSelected(this.currentAttack.frequency);

        StartCoroutine(UnityUtils.ChangeToColorAfterTime(gameObject.GetComponent <SpriteRenderer>(), Color.white, 0.5f));
    }
Ejemplo n.º 2
0
 public void AddAngle(float addedAngle)
 {
     this.angle += addedAngle;
     this.angle  = RotationUtils.MakePositiveAngle(angle);
 }
Ejemplo n.º 3
0
 public void SetAngle(float angle)
 {
     angle      = RotationUtils.MakePositiveAngle(angle);
     this.angle = angle;
 }