private bool randomroll      = false;//prevents repeat of dice rolling
    #endregion

    void Start()
    {
        daytracker = GameObject.Find("Avatar").GetComponent <CharControl2>();
        #region setting chances
        for (int x = 1; x < spawnchance.Length; x++)              //setting the spawn chance values for the script
        {
            spawnchance[x] = spawnchance[x] + spawnchance[x - 1]; //taking the values put in by others and stacking the values together per element
        }
        #endregion
        #region setting spawning location
        itemmarker = this.gameObject.transform.GetChild(0);//getting the location for spawned item
        //spawnpoint = itemmarker.transform.position;//setting the location for spawned item
        //spawnpoint.y += spawnheight;//adjusting the height
        #endregion
        #region setting up prefabs
        for (int x = 0; x < itemchoice.Length; x++)//putting the prefabs in
        {
            spawnpoint    = itemmarker.transform.position;
            spawnpoint.y += spawnheight[x];
            itemchoice[x] = Instantiate(itemchoice[x], spawnpoint, Quaternion.Euler(-90 + spawnrotation[x], 0, 0)) as GameObject; //this sets our variables to the instances(copies of prefabs)
            itemchoice[x].SetActive(false);
            itemchoice[x].name = itemchoice[x].name.Replace("(Clone)", "").Trim();                                                //cuts the names of the instances(itemchoice objects). Gets rid of the clone part
        }
        #endregion
        #region initial item
        random();                         //diceroller
        spawneditem = itemchoice[select]; //just setting the starting items
        spawneditem.SetActive(true);
        #endregion
    }
Ejemplo n.º 2
0
 private void Awake()
 {
     storycheck = GetComponent <StoryChecker>();
     character  = GetComponent <CharControl2>();
 }