Example #1
0
    void Harvest()
    {
        if (canInteract && cropState == CropStateTest.Done && !feedback.harvested)
        {
            if (Input.GetKeyDown(KeyCode.Mouse0))
            {
                foreach (Item item in itemDatabase.database)
                {
                    if ((item.itemName + "(Clone)") == this.gameObject.name)
                    {
                        ni.questItemCheck(item);
                        inventory.AddItem(item.id);

                        // Quest item check
                        foreach (NPCManager.QuestInfo q in player.GetComponent <NPCInteraction>().acceptedQuestLists)
                        {
                            foreach (NPCManager.NPCItem it in q.requirement)
                            {
                                if ((it.objectName + "(Clone)") == this.gameObject.name)
                                {
                                    it.collected += 1;
                                }
                            }
                        }

                        this.gameObject.transform.parent.GetComponent <DirtTile>().needsPlowing = true;
                        this.gameObject.transform.parent.GetComponent <DirtTile>().AddDirt();

                        //local data record
                        DataRecord.AddEvents(5, this.gameObject.name);

                        //set harvested for feedback
                        feedback.harvested        = true;
                        feedback.itemImage.sprite = sr.sprite;
                        feedback.itemText.text    = item.itemName;

                        //For tutorial purpose
                        if (!TutorialManager.doneTutorial)
                        {
                            tutorial.harvestCount += 1;
                        }

                        // gsheet data record
                        player.GetComponent <gsheet_data>().sendData(1, 1);
                        Destroy(this.gameObject);
                        break;
                    }
                }
            }
            canInteract = false;
        }
    }
Example #2
0
    void spawnFish()
    {
        //if (fishType == FishTypeTest.Catfish)
        //{
        //    temp = Instantiate(fishObject[0], player.transform.position, Quaternion.identity);
        //}
        //if (fishType == FishTypeTest.Salmon)
        //{
        //    temp = Instantiate(fishObject[1], player.transform.position, Quaternion.identity);
        //}
        //if(fishType == FishTypeTest.Sardine)
        //{
        //    temp = Instantiate(fishObject[2], player.transform.position, Quaternion.identity);
        //}
        // if(fishType == FishTypeTest.Tuna)
        //{
        //    temp = Instantiate(fishObject[3], player.transform.position, Quaternion.identity);
        //}

        foreach (Item item in itemDatabase.database)
        {
            if ((item.itemName) == fishNames.text)
            {
                ni.questItemCheck(item);
                inventory.AddItem(item.id);

                //Quest item check
                foreach (NPCManager.QuestInfo q in GameObject.FindGameObjectWithTag("Player").GetComponent <NPCInteraction>().acceptedQuestLists)
                {
                    foreach (NPCManager.NPCItem it in q.requirement)
                    {
                        if ((it.objectName) == this.gameObject.name)
                        {
                            it.collected += 1;
                        }
                    }
                }

                //gsheet data record
                Player.LocalPlayerInstance.GetComponent <gsheet_data>().sendData(0, 1);

                //local data record
                DataRecord.AddEvents(0, fishImg.sprite.name);

                break;
            }
        }
    }