Ejemplo n.º 1
0
    void OnTriggerEnter(Collider col)
    {
        if ("Player" == col.gameObject.tag)
        {
            if (4 == Inventory.charge)
            {
                transform.FindChild("door").SendMessage("DoorCheck");

                if (GameObject.Find("PowerGUI"))
                {
                    Destroy(GameObject.Find("PowerGUI"));
                    doorLoght.color = Color.green;
                }
            }
            else if (Inventory.charge > 0 &&
                     Inventory.charge < 4)
            {
                textHints.SendMessage("ShowHint", "This door won't budge... guess it needs more charging - maybe more power cells will help...");
                if (null != lockedSound)
                {
                    transform.FindChild("door").audio.PlayOneShot(lockedSound);
                }
            }
            else
            {
                if (null != lockedSound)
                {
                    transform.FindChild("door").audio.PlayOneShot(lockedSound);
                }

                col.gameObject.SendMessage("HUDon");
                textHints.SendMessage("ShowHint", "This door seems to be locked... maybe that generator needs power...");
            }
        }
    }
Ejemplo n.º 2
0
    //Player has entered a farm collider
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "Player")
        {
            if (!villageVisited)
            {
                switch (villageNumber)
                {
                case 2:
                    Inventory.visitedVillageTwo = true;
                    villageVisited = true;
                    textHints.SendMessage("ShowHint", "Discovered " + Inventory.villageTwo);
                    GameSettings.percentCompleted += GameSettings.percentVillage;
                    break;

                case 1:
                    textHints.SendMessage("ShowHint", "Discovered " + Inventory.villageOne);
                    Inventory.visitedVillageOne = true;
                    villageVisited = true;
                    GameSettings.percentCompleted += GameSettings.percentVillage;
                    break;
                }
            }
        }
    }
Ejemplo n.º 3
0
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "Player")
        {
            if (Inventory.charge == 4)
            {
                transform.FindChild("door").SendMessage("DoorCheck");

                if (GameObject.Find("PowerGUI"))
                {
                    Destroy(GameObject.Find("PowerGUI"));
                    doorLight.color = Color.green;
                }
            }
            else if (Inventory.charge > 0 && Inventory.charge < 4)
            {
                textHints.SendMessage("ShowHint", "The door still won't budge...\nThe generator isn't fully charged yet.");
                transform.FindChild("door").audio.PlayOneShot(lockedSound);
            }
            else
            {
                transform.FindChild("door").audio.PlayOneShot(lockedSound);
                col.gameObject.SendMessage("HUDon");
                textHints.SendMessage("ShowHint", "This door hasn't the energy to open.\nFinding some power cells should do the trick.");
            }
        }
    }
Ejemplo n.º 4
0
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.name == "First Person Controller")
        {
            if (Inventory.charge == 4)
            {
                transform.FindChild("door").SendMessage("DoorCheck");

                if (GameObject.Find("PowerGUI"))
                {
                    Destroy(GameObject.Find("PowerGUI"));
                    doorLight.color = Color.green;
                }
            }

            else if (Inventory.charge > 0 && Inventory.charge < 4)
            {
                textHints.SendMessage("ShowHint", "This door won't budge... guess it needs fully charging - maybe more power cells will help...");
                //This door won't budge... guess it needs fully charging - maybe more power cells will help...
                //Drzwi sa nadal zamkniete... generator ma za malo mocy - moze wiecej ogniw pomoze...
                transform.FindChild("door").audio.PlayOneShot(lockedSound);
            }

            else
            {
                transform.FindChild("door").audio.PlayOneShot(lockedSound);
                col.gameObject.SendMessage("HUDon");
                textHints.SendMessage("ShowHint", "This door seems locked... maybe that generator needs power...");
                //This door seems locked... maybe that generator needs power...
                //Te drzwi wygladaja na zamkniete... \n byc moze generator wymaga odpowiedniego zasilania...
            }
        }
    }
Ejemplo n.º 5
0
    void OnTriggerEnter(Collider col)
    {
        Debug.Log("Trigger entered");
        //note you could do the below via name
        //if(col.gameObject.name =="First Person Controller");
        if (col.gameObject.tag == "Player")
        {
            if (Inventory.charge == 4)
            {
                GameObject.Find("door").SendMessage("DoorCheck");
                if (GameObject.Find("PowerGUI"))
                {
                    Destroy(GameObject.Find("PowerGUI"));
                    doorLight.color = Color.green;
                }
            }
            else if (Inventory.charge < 4)
            {
                textHints.SendMessage("ShowHint", "you need 4 cells");
                //GameObject.Find("door").audio.PlayOneShot(lockedSound);
                Debug.Log("Im getting to the else statemet");
            }


            //findChild > find here b/c it only seraches children not whole game
        }
    }
Ejemplo n.º 6
0
 void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.tag == "Player")
     {
         CoconutThrower.canThrow = true;
         crosshair.enabled       = true;
         if (!CoconutWin.haveWon)
         {
             textHints.SendMessage("ShowHint", "\n\n\n\n\n There's power cell attached to this game, \n maybe I'll win if I can knock down all the targets...");
             // \n\n\n\n\n There's power cell attached to this game, \n maybe I'll win if I can knock down all the targets...
             //\n\n\n\n\n Po prawej stronie znajduje sie pojemnik z ogniwem, \n moze jesli wygram skrzynka z zawartoscia sie otworzy
         }
     }
 }
Ejemplo n.º 7
0
 void OnControllerColliderHit(ControllerColliderHit col)
 {
     if (col.gameObject.name == "campfire")
     {
         if (!haveMatches && !fireIsLit)
         {
             textHints.SendMessage("ShowHint", "I could use this campfire to signal for help\nif I can find something to light it.");
         }
         else if (!fireIsLit)
         {
             LightFire(col.gameObject);
         }
     }
 }
Ejemplo n.º 8
0
    void OnTriggerEnter(Collider other)
    {
        if (!other.CompareTag("Player"))
        {
            return;
        }

        //Debug.Log ("BOUM!");

        other.SendMessage("AddCoin");
        Texto.SendMessage("Add");

        Destroy(this.gameObject);
    }
Ejemplo n.º 9
0
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "Player")
        {
            CoconutThrower.canThrow = true;
            crosshair.enabled       = true;

            if (!CoconutWin.haveWon)
            {
                textHints.SendMessage("ShowHint",
                                      "\n\n\n\n There is a power cell attached to this game,\nmaybe I'll win it if I knock down the targets.");
            }
        }
    }
Ejemplo n.º 10
0
 // handles door behavoir when player enters trigger area
 void OnTriggerEnter(Collider col)
 {
     // checks to ensure collision is with player before carrying out routine
     if (col.gameObject.tag == "Player")
     {
         // checks to ensure all powercells have been collected before carrying out routine
         if (Inventory.charge == 4)
         {
             // sends message to DoorCheck function attached to Door game object
             transform.FindChild("door").SendMessage("DoorCheck");
             // checks to see if charge GUI is still active before running routine.
             if (GameObject.Find("PowerGUI"))
             {
                 // removes charge GUI from game
                 Destroy(GameObject.Find("PowerGUI"));
                 // changes color of light over cabin door
                 doorLight.color = Color.green;
             }
         }
         else if (Inventory.charge > 0 && Inventory.charge < 4)
         {
             // sends call to ShowHint function to turn on text hint GUI and dsiplay a message
             textHints.SendMessage("ShowHint", "This door won't budge.. guess it needs to be fully charged- maybe more power cells will help...");
             // plays locked sound from door
             transform.FindChild("door").audio.PlayOneShot(lockedSound);
         }
         else
         {
             // plays locked sound from door
             transform.FindChild("door").audio.PlayOneShot(lockedSound);
             // sends call to HUDon function to turn on charge GUI
             col.gameObject.SendMessage("HUDon");
             // sends call to ShowHint function to turn on text hint GUI and dsiplay a message
             textHints.SendMessage("ShowHint", "This door seems locked.. maybe that generator needs power...");
         }
     }
 }
Ejemplo n.º 11
0
    // Use this for initialization

    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "Player")
        {
            CoconutThrower.canThrow = true;
            //note CoconutThrower is static hence why we can get it so
            //easily
            crosshair.enabled = true;
            if (!CoconutWin.haveWon)
            {
                textHints.SendMessage("ShowHint",
                                      "\n\n\n\n There's a power cell attached to this game,\n maybe I'll win it if I can knock down all the targets...");
            }
        }
    }
Ejemplo n.º 12
0
 void OnControllerColliderHit(ControllerColliderHit col)
 {
     if (col.gameObject.name == "campfire")
     {
         if (haveMatches && !fireIsLit)
         {
             LightFire(col.gameObject);
         }
         else if (!haveMatches && !fireIsLit)
         {
             textHints.SendMessage("ShowHint", "I could use this campfire to signal for help... if only I could light it...");
             //I could use this campfire to signal for help... if only I could light it...
             //Powiniennem uzyc ogniska do wezwania pomocy... gdybym tylko znalazl zapalki...
         }
     }
 }
Ejemplo n.º 13
0
 // handles the enabling of cocunt throwing for the player character
 void OnTriggerEnter(Collider col)
 {
     // check for collisions with the player character before carrying out routine
     if (col.gameObject.tag == "Player")
     {
         // passes a vaule to canThrow boolean within the CoconutThower class
         CoconutThrower.canThrow = true;
         // enables the crosshair GUI texture
         crosshair.enabled = true;
         // checks to see if player has already won game previously before carrying out routine
         if (!CoconutWin.haveWon)
         {
             // sends a message to the ShowHint function to display a text hint
             textHints.SendMessage("ShowHint", "\n\n\n\n\n There's a power cell attahced to this game, \n maybe I'll win it if I can nock down all the targets...");
         }
     }
 }
Ejemplo n.º 14
0
 void OnControllerColliderHit(ControllerColliderHit col)
 {
     if ("campfire" == col.gameObject.name)
     {
         if (haveMatches && !fireIsLit)
         {
             LightFire(col.gameObject);
             Destroy(matchGUIInstance);
             haveMatches = false;
             fireIsLit   = true;
             winObject.SendMessage("GameOver");
         }
         else if (!haveMatches && !fireIsLit)
         {
             textHints.SendMessage("ShowHint", "I could use this campfire to signal for help...\nIf only I could light it...");
         }
     }
 }
Ejemplo n.º 15
0
 // handles players collision with campfire object
 void OnControllerColliderHit(ControllerColliderHit col)
 {
     // check to see if object player has collided with is the campfire
     if (col.gameObject.name == "campfire")
     {
         // conditional checks of players invenotry and state of campfire
         if (haveMatches && !fireIsLit)
         {
             // calls LightFire function
             LightFire(col.gameObject);
         }
         else if (!haveMatches && !fireIsLit)
         {
             // dispalys message to player via textHint GUI Text
             textHints.SendMessage("ShowHint", "I could use this campfire to sgnal for help..if only I could light it..");
         }
     }
 }
Ejemplo n.º 16
0
 public void OnControllerColliderHit(ControllerColliderHit col)
 {
     if (col.gameObject.name == "campfire" && haveMatches)
     {
         LightFire(col.gameObject);
     }
     else if (!haveMatches && !fireIsLit && col.gameObject.name == "campfire")
     {
         textHints.SendMessage("ShowHint", "you need to get\n the matches\n  in the cabin.");
     }
     if (col.gameObject.tag == "berry")
     {
         berries++;
         Debug.Log("berry hit " + berries);
         Destroy(col.gameObject);
         BerryPickup();
     }
 }
Ejemplo n.º 17
0
    public int farmOrder;     //To track the database

    //Player has entered a farm collider
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "Player")
        {
            if (!farmVisited)
            {
                if (addFarm == null)
                {
                    Debug.Log("Can't find the Inventory GameObject.");
                }

                //they found a farm, so add it to the inventory and update a GUI
                addFarm.AddFarm(farmOrder);
                Inventory.farmsVisited += 1;
                textHints.SendMessage("ShowHint", "Discovered " + addFarm.GetFarmName(farmOrder) + " Farm");
                farmVisited = true;
            }
        }
    }