예제 #1
0
 void OnTriggerEnter(Collider col)
 {
     buttonToPress = FindObjectOfType(typeof(ButtonToPress)) as ButtonToPress;
     if (col.gameObject.tag == "crop")
     {
         if (col.GetComponent <CropBehaviour> ().state.Equals(Crops.cropStates.HARVEST))
         {
             buttonToPress.showPanel("rightMouse", "Pick up " + col.GetComponent <CropBehaviour> ().cropName.ToLower());
         }
     }
     else if (col.gameObject.tag == "NPC")
     {
         buttonToPress.showPanel("E", col.gameObject.GetComponent <NPCBehaviour> ().myself.name + " " + col.gameObject.GetComponent <NPCBehaviour> ().myself.surname);
     }
 }
예제 #2
0
 void OnCollisionEnter(Collision col)
 {
     buttonToPress = FindObjectOfType(typeof(ButtonToPress)) as ButtonToPress;
     if (col.gameObject.tag == "shopCounter")
     {
         buttonToPress.showPanel("E", "Shop counter");
     }
     else if (col.gameObject.tag == "ShippingBinObject")
     {
         buttonToPress.showPanel("E", "Shipping bin");
     }
     else if (col.gameObject.tag == "Fountain")
     {
         buttonToPress.showPanel("E", "Recharge the watering can");
     }
     else if (col.gameObject.tag == "Farm")
     {
         buttonToPress.showPanel("E", "Enter house");
     }
     else if (col.gameObject.tag == "MyHouse")
     {
         buttonToPress.showPanel("E", "Exit house");
     }
     else if (col.gameObject.tag == "Bed")
     {
         buttonToPress.showPanel("E", "Bed");
     }
 }
예제 #3
0
    void hold(InventoryItem item, Button iob)
    {
        Debug.Log("hold");
        HoldingItem holdingItem = GameObject.FindGameObjectWithTag("Player").GetComponent <HoldingItem> ();

        holdingItem.holdingItem = true;
        ButtonToPress btp = FindObjectOfType(typeof(ButtonToPress)) as ButtonToPress;

        btp.showPanel("X", "Save " + item.name);
        anim.SetBool("isHolding", true);
        if (item.inventoryType.Equals(InventoryItem.inventoryTypes.EDIBLE) ||
            item.inventoryType.Equals(InventoryItem.inventoryTypes.NOTEDIBLE))
        {
            Debug.Log("Hold " + item.inventoryType.ToString().ToLower() + "/" + item.name.ToLower());
            GameObject resource = Resources.Load <GameObject> ("Hold " + item.inventoryType.ToString().ToLower() + "/" + item.name.ToLower());
            GameObject instance = Instantiate(resource, GameObject.FindGameObjectWithTag("Player").transform);
            holdingItem.item     = instance;
            holdingItem.itemCode = item.code;
        }
        Destroy(iob.transform.parent.gameObject);
        enableButtons();
        Exit();
    }