Example #1
0
 private void MoveToFireplace()
 {
     MovementState.SetPivotCollider(_fireplace.GetComponent <Collider2D>(), ColliderPoint.Centre, ColliderPoint.Centre);
     MovementState.MovementOverridden = true;
     _isFireplaceActive = true;
 }
    void Update()
    {
        AudioSource fire = FirePlace.GetComponent <AudioSource>();

        ChsdCell = InventoryScript.ChsdCell;
        if (Fire == true && int.Parse(OvenInv[1, 1]) != 0)
        {
            Timer += Time.timeScale / 10;
            if (fire.isPlaying == false)
            {
                fire.Play();
            }
        }
        else
        {
            fire.Stop();
            Timer = 0;
            Fire  = false;
        }
        if (Timer > CookingTime)
        {
            for (int i = 0; i < Items.Length; i++)
            {
                if (OvenInv[0, 6] == Items[i])
                {
                    for (int k = 0; k < 7; k++)
                    {
                        OvenInv[2, k] = Food[i].GetComponent <ItemScript>().Item[0, k];
                        if (k != 1)
                        {
                            OvenInv[0, k] = null;
                        }
                        else
                        {
                            OvenInv[0, k] = "" + 0;
                        }
                    }
                }
            }
            Timer         = 0;
            Fire          = false;
            OvenInv[1, 1] = "" + (int.Parse(OvenInv[1, 1]) - 1);
        }
        if (Active == true)
        {
            if (OvenInv[0, 3] != null)
            {
                if (int.Parse(OvenInv[0, 1]) != 0)
                {
                    ItemC.GetComponentInChildren <RawImage>().texture = InventoryScript.ICONS[int.Parse(OvenInv[0, 3])];
                }
                else
                {
                    ItemC.GetComponentInChildren <RawImage>().texture = null;
                }
            }
            else
            {
                ItemC.GetComponentInChildren <RawImage>().texture = null;
            }
            if (OvenInv[1, 3] != null)
            {
                if (int.Parse(OvenInv[1, 1]) != 0)
                {
                    FuelC.GetComponentInChildren <RawImage>().texture = InventoryScript.ICONS[int.Parse(OvenInv[1, 3])];
                }
                else
                {
                    FuelC.GetComponentInChildren <RawImage>().texture = null;
                }
            }
            else
            {
                FuelC.GetComponentInChildren <RawImage>().texture = null;
            }
            if (OvenInv[2, 3] != null)
            {
                if (int.Parse(OvenInv[2, 1]) != 0)
                {
                    FoodC.GetComponentInChildren <RawImage>().texture = InventoryScript.ICONS[int.Parse(OvenInv[2, 3])];
                }
                else
                {
                    FoodC.GetComponentInChildren <RawImage>().texture = null;
                }
            }
            else
            {
                FoodC.GetComponentInChildren <RawImage>().texture = null;
            }
            Timeleft.GetComponent <Text>().text = Timer.ToString("f0") + " / 30";
        }
    }