Beispiel #1
0
 //when the player enters the area, change the powers of the player
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player")
     {
         blobPlayer.SetState("vapor");
         temp.setTemp(2);
     }
 }
Beispiel #2
0
    //GotASeed is called when the player picks up a seed. It increments the amount of seeds
    //they currently have. If it is the first collected seed, it plays instructions
    public void GotASeed(GameObject aSeed)
    {
        if (aSeed.tag == "waterSeed")
        {
            //destroy the things around the seed
            GameObject[] waterPlaces = GameObject.FindGameObjectsWithTag("waterPlace");
            for (var i = 0; i < waterPlaces.Length; i++)
            {
                Vector3 waterPlacePos = waterPlaces [i].transform.position;
                if (Vector3.Distance(transform.position, waterPlacePos) <= MIN_DIST)
                {
                    Destroy(waterPlaces [i]);
                    //if the water place is destroyed, on trigger exit is NOT called, but we need to
                    //change the power back
                    blobPlayer.SetState("ice");
                    temp.setTemp(0);
                }
            }
        }
        else if (aSeed.tag == "vaporSeed")
        {
            //destroy the things around the seed
            GameObject[] vaporPlaces = GameObject.FindGameObjectsWithTag("vaporPlace");
            for (var i = 0; i < vaporPlaces.Length; i++)
            {
                Vector3 waterPlacePos = vaporPlaces [i].transform.position;
                if (Vector3.Distance(transform.position, waterPlacePos) <= MIN_DIST)
                {
                    Destroy(vaporPlaces [i]);
                    //if the vapor place is destroyed, on trigger exit is NOT called, but we need to
                    //change the power back
                    blobPlayer.SetState("ice");
                    temp.setTemp(0);
                    numSeeds++;
                }
            }
        }

        numSeeds++;
        if (isFirst)
        {
            MovieCamera movieScript = GameObject.Find("SecondaryCamera").GetComponent <MovieCamera> ();
            movieScript.SeedInstructions();
            isFirst = false;
        }
    }