Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     player        = GameObject.FindGameObjectWithTag("Player").GetComponent <Rigidbody>();
     playerText    = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <TextMesh> ();
     bedCollision  = FindObjectOfType <BedCollision> ();
     buttonToPress = FindObjectOfType(typeof(ButtonToPress)) as ButtonToPress;
 }
Beispiel #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");
     }
 }
Beispiel #3
0
 void OnCollisionExit(Collision col)
 {
     buttonToPress = FindObjectOfType(typeof(ButtonToPress)) as ButtonToPress;
     if (col.gameObject.tag == "shopCounter")
     {
         buttonToPress.hidePanel();
     }
     else if (col.gameObject.tag == "ShippingBinObject")
     {
         buttonToPress.hidePanel();
     }
     else if (col.gameObject.tag == "Fountain")
     {
         buttonToPress.hidePanel();
     }
     else if (col.gameObject.tag == "Farm")
     {
         buttonToPress.hidePanel();
     }
     else if (col.gameObject.tag == "MyHouse")
     {
         buttonToPress.hidePanel();
     }
     else if (col.gameObject.tag == "Bed")
     {
         buttonToPress.hidePanel();
     }
 }
Beispiel #4
0
    // Use this for initialization
    void Start()
    {
        playerStamina = GetComponent <PlayerStamina> ();

        camera = Camera.main;
        tool   = Tools.NONE;

        hoe               = GetComponent <Hoe> ();
        plant             = GetComponent <PlantSeeds> ();
        wateringCan       = GetComponent <WateringCan> ();
        sickle            = GetComponent <Sickle> ();
        none              = GetComponent <None> ();
        holdingItem       = GetComponent <HoldingItem> ();
        inventory         = GetComponent <InventoryManager> ();
        fountainCollision = GetComponent <FountainCollider> ();
        NPCCollision      = GetComponentInChildren <NPCCollision> ();
        if (SceneManager.GetActiveScene().name.Contains("Outside") || SceneManager.GetActiveScene().name == "Farming" || SceneManager.GetActiveScene().name == "Farm")
        {
            outside = true;
        }
        else
        {
            outside = false;
        }

        anim          = GetComponent <Animator> ();
        hoeGO         = this.transform.Find("hoe").gameObject;
        wcanGO        = this.transform.Find("wateringcan").gameObject;
        sickleGO      = this.transform.Find("sickle").gameObject;
        buttonToPress = FindObjectOfType(typeof(ButtonToPress)) as ButtonToPress;
    }
Beispiel #5
0
 // Use this for initialization
 void Start()
 {
     camera        = Camera.main;
     inventory     = GetComponent <InventoryManager> ();
     player        = GameObject.FindGameObjectWithTag("Player");
     buttonToPress = FindObjectOfType(typeof(ButtonToPress)) as ButtonToPress;
 }
Beispiel #6
0
 void OnTriggerExit(Collider col)
 {
     buttonToPress = FindObjectOfType(typeof(ButtonToPress)) as ButtonToPress;
     if (col.gameObject.tag == "crop")
     {
         buttonToPress.hidePanel();
     }
     else if (col.gameObject.tag == "NPC")
     {
         buttonToPress.hidePanel();
     }
 }
Beispiel #7
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);
     }
 }
Beispiel #8
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();
    }
Beispiel #9
0
 void Start()
 {
     BTP = GetComponent <ButtonToPress>();
     SE  = GetComponent <ShotEmitter>();
 }