Example #1
0
    IEnumerator Slow()
    {
        //Debug.LogError ("No Grape found? PANIC!");
        temp        = enemies[0].GetComponent <EnemyAI1>();
        temp.speed  = 50f;
        temp.speed1 = 0.1f;
        temp        = enemies[1].GetComponent <EnemyAI1>();
        temp.speed  = 50f;
        temp.speed1 = 0.1f;
        temp1       = enemies[2].GetComponent <GhostMovement1>();
        temp1.speed = 0.1f;
        temp1       = enemies[3].GetComponent <GhostMovement1>();
        temp1.speed = 0.1f;
        Debug.Log(temp.speed);
        yield return(new WaitForSeconds(7.0f));

        temp        = enemies[0].GetComponent <EnemyAI1>();
        temp.speed  = 100f;
        temp.speed1 = 0.2f;
        temp        = enemies[1].GetComponent <EnemyAI1>();
        temp.speed  = 100f;
        temp.speed1 = 0.2f;
        temp1       = enemies[2].GetComponent <GhostMovement1>();
        temp1.speed = 0.2f;
        temp1       = enemies[3].GetComponent <GhostMovement1>();
        temp1.speed = 0.2f;
        Destroy(gameObject);
    }
Example #2
0
    IEnumerator MyMethod()
    {
        temp          = enemies [0].GetComponent <EnemyAI1> ();
        temp.canmove1 = false;
        temp          = enemies [1].GetComponent <EnemyAI1> ();
        temp.canmove1 = false;
        temp1         = enemies [2].GetComponent <GhostMovement1> ();
        temp1.canmove = false;
        temp1         = enemies [3].GetComponent <GhostMovement1> ();
        temp1.canmove = false;
        Restart();
        yield return(new WaitForSeconds(0.5f));

        Restart();
        yield return(new WaitForSeconds(8.0f));

        temp          = enemies[0].GetComponent <EnemyAI1>();
        temp.canmove1 = true;
        temp.canmove  = true;
        temp          = enemies[1].GetComponent <EnemyAI1>();
        temp.canmove1 = true;
        temp.canmove  = true;
        /////////////////////////////////////////////////
        temp1         = enemies[2].GetComponent <GhostMovement1>();
        temp1.canmove = true;
        temp1         = enemies[3].GetComponent <GhostMovement1>();
        temp1.canmove = true;
        Destroy(gameObject);
    }
Example #3
0
    // Update is called once per frame
    void OnTriggerEnter2D(Collider2D co)
    {
        Vector2 a = transform.position;

        if (co.name == "pacman")
        {
            //Destroy (co.gameObject);
            if (Lives == 3)
            {
                Lives--;
                Destroy(Life[0]);
                PlayDeath();
            }
            else if (Lives == 2)
            {
                Lives--;
                Destroy(Life[1]);
                PlayDeath();
            }
            else
            {
                Lives--;
                Destroy(Life[2]);
                PlayDeath();
            }
            if (Lives == 0)
            {
                StartCoroutine(Level());
            }
            StartCoroutine(MyMethod());
            temp      = enemies[0].GetComponent <EnemyAI1>();
            temp.cur  = 0;
            temp      = enemies[1].GetComponent <EnemyAI1>();
            temp.cur  = 0;
            temp1     = enemies[2].GetComponent <GhostMovement1>();
            temp1.cur = 0;
            temp1     = enemies[3].GetComponent <GhostMovement1>();
            temp1.cur = 0;
        }
        //Destroy(target);

        /*if (co.name == "wayPoint") {
         *      Vector2 a=transform.position;
         *      a.x=35;
         *      co.gameObject.transform.position=a;
         * }*/
    }
Example #4
0
 // Use this for initialization
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.name == "pacman")
     {
         Vector2 a = transform.position;
         a.x = 100; a.y = 100;
         transform.position = a;
         StartCoroutine(MyMethod());
         temp      = enemies[0].GetComponent <EnemyAI1>();
         temp.cur  = 0;
         temp      = enemies[1].GetComponent <EnemyAI1>();
         temp.cur  = 0;
         temp1     = enemies[2].GetComponent <GhostMovement1>();
         temp1.cur = 0;
         temp1     = enemies[3].GetComponent <GhostMovement1>();
         temp1.cur = 0;
     }
 }
Example #5
0
    IEnumerator MyMethod()
    {
        Debug.Log("Here");
        temp          = enemies[0].GetComponent <EnemyAI1>();
        temp.canmove1 = false;
        temp          = enemies[1].GetComponent <EnemyAI1>();
        temp.canmove1 = false;
        temp1         = enemies[2].GetComponent <GhostMovement1>();
        temp1.canmove = false;
        temp1         = enemies[3].GetComponent <GhostMovement1>();
        temp1.canmove = false;
        Restart();

        yield return(new WaitForSeconds(0.5f));

        Restart();
        yield return(new WaitForSeconds(3.5f));

        Vector2 a = transform.position;

        a.x = 6.37f; a.y = -28.7f;
        enemies [4].transform.position = a;

        temp          = enemies[0].GetComponent <EnemyAI1>();
        temp.canmove1 = true;
        temp.canmove  = true;
        temp          = enemies[1].GetComponent <EnemyAI1>();
        temp.canmove1 = true;
        temp.canmove  = true;
        /////////////////////////////////////////////////
        temp1         = enemies[2].GetComponent <GhostMovement1>();
        temp1.canmove = true;
        temp1         = enemies[3].GetComponent <GhostMovement1>();
        temp1.canmove = true;
        //temp = enemies[3].GetComponent<EnemyAI>();
        //temp.canmove1=true;
    }