Пример #1
0
    public void Tapped()
    {
        if (alreadyTapped)
        {
            return;
        }
        alreadyTapped = true;
        AmtGiven      = Random.Range(2, 4);
        TypeGiven     = Random.Range(0, IM.seeds.Length);

        giftCanvas.SetActive(true);
        for (int i = 0; i < AmtGiven; i++)
        {
            IM.AddSeed(IM.seeds[TypeGiven].name);
        }

        IslandScript island = WorldManager.Instance.SelectedIsland.GetComponent <IslandScript>();

        if (island.currentCreaturePopulation < island.maxCreaturePopulation)
        {
            GameObject newEgg = Instantiate(IM.eggs[Random.Range(0, IM.eggs.Length)].objectToSpawn, this.transform.position, Quaternion.identity);
        }

        ItemPreview.GetComponent <Image>().sprite        = IM.seeds[TypeGiven].sprite;
        ItemPreview.GetComponentInChildren <Text>().text = "x" + AmtGiven;

        this.GetComponent <Animator>().SetTrigger("Open");
    }
    /*public void CraftingClick()
     * {
     *  Debug.Log(thisSeed.name);
     *  IM.SetCraftingObject(thisSeed);
     * }*/

    public void StartSeedDrag()
    {
        Debug.Log("SpawningNewSeed");
        IslandScript island  = WorldManager.Instance.SelectedIsland.GetComponent <IslandScript>();
        GameObject   NewSeed = Instantiate(IM.FindSeed(thisSeed.name).objectToSpawn);

        TouchManager.Instance.seedBeingDragged = NewSeed;
        IM.inventoryPanel.SetActive(false);
    }
Пример #3
0
    /*public void CraftingClick()
     * {
     *  Debug.Log(thisSeed.name);
     *  IS.SetCraftingObject(thisSeed);
     * }*/

    public void StartSeedDrag()
    {
        Debug.Log("SpawningNewSeed");
        IslandScript island = WorldSelector.Instance.SelectedIsland.GetComponent <IslandScript>();

        if (island.currentTreePopulation >= island.maxTreePopulation)
        {
            return;
        }
        GameObject NewSeed = Instantiate(IS.FindSeed(thisSeed.name).objectToSpawn);

        TouchController.Instance.seedBeingDragged = NewSeed;
        IS.inventoryPanel.SetActive(false);
    }
    public void SpawnSeed()
    {
        if (TutorialManager.Instance.TutorialActive && TutorialManager.Instance.waitingForSeed)
        {
            TutorialManager.Instance.tutorialStage++;
        }
        GameObject Giant = GameObject.FindGameObjectWithTag("Giant");

        if (Giant.GetComponent <GiantScript>().currentHolding != null)
        {
            Destroy(Giant.GetComponent <GiantScript>().currentHolding);
            Giant.GetComponent <GiantScript>().currentHolding = null;
        }
        Camera.main.gameObject.GetComponent <CameraControl>().currentCameraPosition = CameraControl.CameraPositions.IslandView;
        IslandScript island = WorldManager.Instance.SelectedIsland.GetComponent <IslandScript>();

        Giant.GetComponent <GiantScript>().SetCurrentHolding(IM.FindSeed(thisSeed.name).objectToSpawn, this.thisSeed.name);

        //IM.RemoveSeed(thisSeed);
        //IM.UpdateSeedUI(this.transform.parent.gameObject);
        IM.inventoryPanel.SetActive(false);
        IM.HUDPanel.SetActive(true);
    }
Пример #5
0
    public void SpawnSeed()
    {
        GameObject Giant = GameObject.FindGameObjectWithTag("Giant");

        if (Giant.GetComponent <GiantScript>().currentHolding != null)
        {
            Destroy(Giant.GetComponent <GiantScript>().currentHolding);
            Giant.GetComponent <GiantScript>().currentHolding = null;
        }

        IslandScript island = WorldSelector.Instance.SelectedIsland.GetComponent <IslandScript>();

        if (island.currentTreePopulation >= island.maxTreePopulation)
        {
            return;
        }

        Giant.GetComponent <GiantScript>().SetCurrentHolding(IS.FindSeed(thisSeed.name).objectToSpawn, this.thisSeed.name);

        //IS.RemoveSeed(thisSeed);
        //IS.UpdateSeedUI(this.transform.parent.gameObject);
        IS.inventoryPanel.SetActive(false);
        IS.HUDPanel.SetActive(true);
    }
Пример #6
0
    /*public void CraftingClick()
     * {
     *  IM.SetCraftingObject(thisEgg);
     * }*/

    public void SpawnEgg()
    {
        GameObject Giant = GameObject.FindGameObjectWithTag("Giant");

        IslandScript island = WorldManager.Instance.SelectedIsland.GetComponent <IslandScript>();

        if (island.currentCreaturePopulation >= island.maxCreaturePopulation)
        {
            return;
        }
        Debug.Log("SpawningEgg");

        if (Giant.GetComponent <GiantScript>().currentHolding != null)
        {
            Destroy(Giant.GetComponent <GiantScript>().currentHolding);
            Giant.GetComponent <GiantScript>().currentHolding = null;
        }

        Giant.GetComponent <GiantScript>().SetCurrentHolding(IM.FindEgg(thisEgg.name).objectToSpawn, thisEgg.name);
        //IM.RemoveEgg(thisEgg);
        //IM.UpdateEggUI(this.transform.parent.gameObject);
        IM.inventoryPanel.SetActive(false);
        IM.HUDPanel.SetActive(true);
    }
Пример #7
0
 // Use this for initialization
 void Start()
 {
     islandScript = Resources.Load ("statImages/ship") as IslandScript;
     //island = GameObject.FindGameObjectWithTag ("island"); //we need the island data
 }