void Start()
    {
        TC = canvasMain.GetComponent <TimeCheck>();
        IS = canvasMain.GetComponent <ItemSpawning>();
        FileStream   f      = new FileStream("Restart.dat", FileMode.OpenOrCreate, FileAccess.Read);
        StreamReader reader = new StreamReader(f, System.Text.Encoding.Unicode);
        string       str    = reader.ReadLine();

        reader.Close();
        f.Close();


        if (str != null && str.Equals("true"))
        {
            canvasStart.enabled = false;
            canvasMain.enabled  = true;
            canvasEnd.enabled   = false;
            for (int i = 0; i < TC.PosNum; i++)
            {
                GameObject Temp = Instantiate(TC.NNPC, TC.Position[i].transform.position, Quaternion.identity);
            }
            for (int i = 0; i < 8; i++)
            {
                IS.CreateItem();
            }
        }
        else
        {
            canvasStart.enabled = true;
            canvasMain.enabled  = false;
            canvasEnd.enabled   = false;
        }
    }
Пример #2
0
 void Start()
 {
     IS = canvasMain.GetComponent <ItemSpawning>();
     TC = canvasMain.GetComponent <TimeCheck>();
     //canvasStart.enabled = true;
     //canvasMain.enabled = false;
     //canvasEnd.enabled = false;
 }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        itemManagerScript = itemManager.GetComponent <ItemSpawning>();
        trashToBeMade     = itemManagerScript.trashToSpawn;

        postProcessorScript = postProcessor.GetComponent <PostProcessVolume>();
        timeManagerScript   = timeObject.GetComponent <TimeManager>();
    }
Пример #4
0
    void Start()
    {
        yeetProgress = 0.0f;
        yeetPoints   = new Vector3[3];

        itemManager     = GameObject.FindGameObjectWithTag("ItemManager");
        itemSpawnScript = itemManager.GetComponent <ItemSpawning>();
        fallSpeed       = itemSpawnScript.fallSpeed;
        myRB            = GetComponent <Rigidbody>();
    }
Пример #5
0
 // Update is called once per frame
 void Update()
 {
     if (drillProgress < drillTime)
     {
         drillProgress += Time.deltaTime;
     }
     if (drillProgress >= drillTime)
     {
         drillProgress = 0;
         ItemSpawning.Spawn(new Item(drops[(int)Mathf.Floor(Random.Range(0, drops.Length))], dropAmount), transform.position + itemOffset);
         if (drillEffect != null)
         {
             Instantiate(drillEffect, transform.position + itemOffset, Quaternion.identity);
         }
     }
 }
    void OnTriggerEnter2D(Collider2D col)
    {
        if (!requirementsMet)
        {
            return;
        }
        Block b = col.GetComponent <Block>();

        if (b)
        {
            if (b.fluid)
            {
                ItemSpawning.Spawn(new Item(b.DropItem, b.dropAmount), transform.position + (Vector3)offset);
                Destroy(b.gameObject);
            }
        }
    }
Пример #7
0
    // Update is called once per frame
    void Update()
    {
        int  i = 0;
        bool b = false;

        foreach (Item item in storedItems)
        {
            if (item.amount >= recipe.input[i].amount)
            {
                b = true;
            }
            else
            {
                b = false;
            }
            i++;
        }
        if (b)
        {
            if (smeltProgress < recipe.craftDuration)
            {
                smeltProgress += Time.deltaTime * smelterTier;
            }
            if (smeltProgress >= recipe.craftDuration)
            {
                ItemSpawning.Spawn(recipe.output, transform.position + spawnedItemOffset);
                smeltProgress = 0;
                int i2 = 0;
                foreach (Item item in storedItems)
                {
                    item.amount -= recipe.input[i2].amount;
                    i2++;
                }
            }
        }
    }