Ejemplo n.º 1
0
 /// <summary>
 /// Атака игрока
 /// </summary>
 /// <param name="isSnowball"> снежки или угольки </param>
 /// <param name="cnt"> сколько </param>
 public void Attack(bool isSnowball, int cnt)
 {
     if (isSnowball)
     {
         arm.AddSnowballs(cnt);
     }
     else
     {
         cntCoal += cnt;
     }
 }
Ejemplo n.º 2
0
    /// <summary>
    /// Корутин для анимации атаки
    /// </summary>
    /// <returns></returns>
    private IEnumerator AnimateAttack()
    {
        isWorking = true;
        StartCoroutine(RotateX(-60));
        StartCoroutine(Move(Vector3.forward * 0.7f, 1));
        while (isRotatingX || isMoving)
        {
            yield return(null);
        }

        yield return(new WaitForSeconds(0.2f));

        StartCoroutine(RotateX(60));
        StartCoroutine(Move(-Vector3.forward * 0.7f, 1));
        while (isRotatingX || isMoving)
        {
            yield return(null);
        }


        isWorking = false;
        arm.AddSnowballs(5);
        yield break;
    }