void Start()
    {
        beeRecipes = new Dictionary <string, Recipe>();
        //add all recipes
        addAllRecipesGross();
        addToMantleList();

        backpack = UniquesBackpack.backpack;
    }
 void Awake()
 {
     if (backpack == null)
     {
         backpack = this;
     }
     else if (backpack != this)
     {
         Destroy(gameObject);
     }
 }
Beispiel #3
0
    void Start()
    {
        if (allItemTextures != null)
        {
            initAllItems();
        }

        if (player == null || apiaryOrg == null || canvas == null)
        {
            player    = Map.map.player;
            apiaryOrg = apiary.GetComponentInChildren <ApiaryOrganiser>();
            backpack  = UniquesBackpack.backpack;
        }
    }
    //store the move for the character and then do the things in here
    public void doTurn(int turnNum)
    {
        UpdateDayResources();

        if (nextHex == currentHex || nextHex == null)
        {
            ChangeResourceText.UpdateUIResources(Food, Water, Honey);
            return;
        }
        if (backpack == null)
        {
            backpack      = UniquesBackpack.backpack;
            storyProgress = 0;
        }
        //set all the variables and stuff when the click happens, then call all the actual moving and updating of stuff here!
        //TODO: make it more clear when the player has selected a tile
        //have to pass as negative as we are taking these away as movement cost
        UpdateResources(-nextHex.foodCost, -nextHex.waterCost);

        //updates and resets event costs
        UpdateResources(ScenarioManager.foodResult, ScenarioManager.waterResult, ScenarioManager.honeyResult);
        ScenarioManager.honeyResult = 0; ScenarioManager.waterResult = 0; ScenarioManager.foodResult = 0;

        float rand = Random.Range(0f, 10f);

        highlightStory(storyProgress);

        if ((turnNum % 7 != 4))
        {
            //HERE: hard code a check for if the nextHex is a story location
            if (currentHex.hexMap.storyLocations.Contains(nextHex))                     //roundabout way of doing it but we get what we want
            {
                if (currentHex.hexMap.storyLocations.IndexOf(nextHex) == storyProgress) //checks if the next is the one we have progressed up to
                //THIS WORKS: AS IN - the recognition triggers
                //ONCOMPLETION: add 1 to story progress from within scenario manager and unset storyTrigger
                {
                    if (storyProgress == 0)
                    {
                        ScenarioManager.ChooseEvent(nextHex, 1000);                         //TRIGGERS AGAIN
                        storyTriggered = true;
                    }
                    else if (storyProgress == 1)
                    {
                        ScenarioManager.ChooseEvent(nextHex, 2000);
                        storyTriggered = true;
                    }
                    else if (storyProgress == 2)
                    {
                        ScenarioManager.ChooseEvent(nextHex, 3000);
                        storyTriggered = true;
                    }
                    else if (storyProgress == 3)
                    {
                        ScenarioManager.ChooseEvent(nextHex, 4000);
                        storyTriggered = true;
                    }
                    else if (storyProgress == 4)
                    {
                        ScenarioManager.ChooseEvent(nextHex, 5000);
                        storyTriggered = true;
                    }                    //else game should be over
                }
                else
                {
                    int currentLoc = currentHex.hexMap.storyLocations.IndexOf(nextHex);
                    if (currentLoc == 0)                                  //can only be after
                    {
                        ScenarioManager.ChooseEvent(nextHex, 1002, true); //___1 is before, ___2 is after
                    }
                    else if (currentLoc == 1)
                    {
                        if (currentLoc > storyProgress)
                        {
                            ScenarioManager.ChooseEvent(nextHex, 2001, true);                           //have no completed the event before this one
                        }
                        else if (currentLoc < storyProgress)
                        {
                            ScenarioManager.ChooseEvent(nextHex, 2002, true);                           //have completed this story event
                        }
                    }
                    else if (currentLoc == 2)
                    {
                        if (currentLoc > storyProgress)
                        {
                            ScenarioManager.ChooseEvent(nextHex, 3001, true);
                        }
                        else if (currentLoc < storyProgress)
                        {
                            ScenarioManager.ChooseEvent(nextHex, 3002, true);
                        }
                    }
                    else if (currentLoc == 3)
                    {
                        if (currentLoc > storyProgress)
                        {
                            ScenarioManager.ChooseEvent(nextHex, 4001, true);
                        }
                        else if (currentLoc < storyProgress)
                        {
                            ScenarioManager.ChooseEvent(nextHex, 4002, true);
                        }
                    }
                    else if (currentLoc == 4)
                    {
                        if (currentLoc > storyProgress)
                        {
                            ScenarioManager.ChooseEvent(nextHex, 5001, true);
                        }
                        else if (currentLoc < storyProgress)
                        {
                            ScenarioManager.ChooseEvent(nextHex, 5002, true);
                        }
                    }
                    //TODO: add events here so it doesnt trigger agin if already visited
                }
            }
            else if (rand < 4.1f)
            {
                //happens a turn late but at least it happens
                ScenarioManager.ChooseEvent(nextHex);
            }
        }

        AudioManager.audioManager.playSound("footsteps");
        ChangeResourceText.UpdateUIResources(Food, Water, Honey);
        //TODO: play walking animation
        SetHex(nextHex);
        unHighlightTile(nextHex.hexMap.hexToGameObjectMap[nextHex]);
    }