Exemplo n.º 1
0
    IEnumerator QuitScene()
    {
        santaStates = SantaStates.MiddleAttackPosition;
        yield return(new WaitForSeconds(3f));

        santaStates = SantaStates.QuittingToUp;
    }
Exemplo n.º 2
0
 void BeforeEnter()
 {
     transform.position = new Vector3(player.position.x - 80, player.position.y + offset.y + 10, 0);
     transform.rotation = Quaternion.identity;
     StartCoroutine("WaitAndGoToMiddlePointPosition");
     santaStates = SantaStates.Entering;
 }
Exemplo n.º 3
0
    IEnumerator WaitAndGoToMiddlePointPosition()
    {
        yield return(new WaitForSeconds(0.5f));

        AudioSource.PlayClipAtPoint(enter, transform.position, 0.5f);
        yield return(new WaitForSeconds(5.5f));

        santaStates = SantaStates.MiddleAttackPosition;
    }
Exemplo n.º 4
0
    public void ReceiveDamage()
    {
        if (!(santaStates == SantaStates.UpperAttackPosition || santaStates == SantaStates.MiddleAttackPosition || santaStates == SantaStates.DownAttackPosition))
            return;

        santaStates = SantaStates.QuittingToTheRight;
        if (!isSpawnning)
        {
            isSpawnning = true;
            NotificationCenter.DefaultCenter().PostNotification(this, "StartSpawner");
        }
    }
Exemplo n.º 5
0
    public void ReceiveDamage()
    {
        if (!(santaStates == SantaStates.UpperAttackPosition || santaStates == SantaStates.MiddleAttackPosition || santaStates == SantaStates.DownAttackPosition))
        {
            return;
        }

        santaStates = SantaStates.QuittingToTheRight;
        if (!isSpawnning)
        {
            isSpawnning = true;
            NotificationCenter.DefaultCenter().PostNotification(this, "StartSpawner");
        }
    }
Exemplo n.º 6
0
 public void StopSpawner()
 {
     isSpawnning = false;
     santaStates = SantaStates.BeforeEnter;
 }
Exemplo n.º 7
0
    void ChooseAttackPosition()
    {
        timer += Time.deltaTime;
        if (timer < 2)
        {
            return;
        }

        timer = 0;
        if (santaStates == SantaStates.DownAttackPosition && transform.position.y < player.position.y)
        {
            switch (Random.Range(0, 2))
            {
            case 0:
                santaStates = SantaStates.UpperAttackPosition;
                break;

            case 1:
                santaStates = SantaStates.MiddleAttackPosition;
                break;
            }
        }
        else if (santaStates == SantaStates.MiddleAttackPosition && transform.position.y <= player.position.y)
        {
            santaStates = SantaStates.UpperAttackPosition;
        }
        else if (santaStates == SantaStates.MiddleAttackPosition && transform.position.y >= player.position.y)
        {
            santaStates = SantaStates.DownAttackPosition;
        }
        else if (santaStates == SantaStates.UpperAttackPosition && transform.position.y <= player.position.y)
        {
            switch (Random.Range(0, 2))
            {
            case 0:
                santaStates = SantaStates.DownAttackPosition;
                break;

            case 1:
                santaStates = SantaStates.MiddleAttackPosition;
                break;
            }
        }
        else
        {
            switch (Random.Range(0, 2))
            {
            case 0:
                santaStates = SantaStates.DownAttackPosition;
                break;

            case 1:
                santaStates = SantaStates.MiddleAttackPosition;
                break;

            case 2:
                santaStates = SantaStates.UpperAttackPosition;
                break;
            }
        }
    }
Exemplo n.º 8
0
    void ChooseAttackPosition()
    {
        timer += Time.deltaTime;
        if (timer < 2)
            return;

        timer = 0;
        if (santaStates == SantaStates.DownAttackPosition && transform.position.y < player.position.y)
        {
            switch (Random.Range(0, 2))
            {
                case 0:
                    santaStates = SantaStates.UpperAttackPosition;
                    break;
                case 1:
                    santaStates = SantaStates.MiddleAttackPosition;
                    break;
            }
        } else if (santaStates == SantaStates.MiddleAttackPosition && transform.position.y <= player.position.y)
        {
            santaStates = SantaStates.UpperAttackPosition;
        } else if (santaStates == SantaStates.MiddleAttackPosition && transform.position.y >= player.position.y)
        {
            santaStates = SantaStates.DownAttackPosition;
        } else if (santaStates == SantaStates.UpperAttackPosition && transform.position.y <= player.position.y)
        {
            switch (Random.Range(0, 2))
            {
                case 0:
                    santaStates = SantaStates.DownAttackPosition;
                    break;
                case 1:
                    santaStates = SantaStates.MiddleAttackPosition;
                    break;
            }
        }
        else
        {
            switch (Random.Range(0, 2))
            {
                case 0:
                    santaStates = SantaStates.DownAttackPosition;
                    break;
                 case 1:
                    santaStates = SantaStates.MiddleAttackPosition;
                    break;
                case 2:
                   santaStates = SantaStates.UpperAttackPosition;
                   break;
            }
        }
    }
Exemplo n.º 9
0
 void BeforeEnter()
 {
     transform.position = new Vector3 (player.position.x - 80 ,player.position.y + offset.y + 10,0);
     transform.rotation = Quaternion.identity;
     StartCoroutine("WaitAndGoToMiddlePointPosition");
     santaStates = SantaStates.Entering;
 }
Exemplo n.º 10
0
 public void StopSpawner()
 {
     isSpawnning = false;
     santaStates = SantaStates.BeforeEnter;
 }
Exemplo n.º 11
0
 IEnumerator WaitAndGoToMiddlePointPosition()
 {
     yield return new WaitForSeconds (0.5f);
     AudioSource.PlayClipAtPoint (enter, transform.position, 0.5f);
     yield return new WaitForSeconds(5.5f);
     santaStates = SantaStates.MiddleAttackPosition;
 }
Exemplo n.º 12
0
 IEnumerator QuitScene()
 {
     santaStates = SantaStates.MiddleAttackPosition;
     yield return new WaitForSeconds(3f);
     santaStates = SantaStates.QuittingToUp;
 }