Пример #1
0
 public static void CookingPot_OnBlockPlaced_Postfix(CookingPot __instance)
 {
     foreach (var autoRecipe in AutoRecipeBehaviour.Instances)
     {
         autoRecipe.OnCookingPotPlaced(__instance);
     }
 }
Пример #2
0
 private void OnTriggerExit2D(Collider2D collider)
 {
     if (collider.tag == "pot" && pot && collider.gameObject == pot.gameObject)
     {
         pot.boiling = false;
         pot         = null;
     }
 }
Пример #3
0
    protected virtual void Start()
    {
        _CombatData = Resources.Load <SO_CombatData>("CombatData");

        // Spawning cooking pot for the player
        CookingPot cookingPotPrefab = Resources.Load <CookingPot>("CookingPot");

        CookingPot = Instantiate(cookingPotPrefab, Vector3.zero, Quaternion.identity);
        CookingPot.Initialize(_PhotonView);
    }
Пример #4
0
 private IEnumerator CollectCookingPot()
 {
     while (_FirstCookingPot == null)
     {
         if (_MatchState.PlayerCookingPots.Count > 0)
         {
             _FirstCookingPot = _MatchState.PlayerCookingPots.ElementAt(0).Value;
         }
         yield return(null);
     }
 }
Пример #5
0
        public static void CookingPot_OnDestroy_Postfix(CookingPot __instance)
        {
            if (!Traverse.Create(__instance).Field <bool>("hasBeenPlaced").Value)
            {
                return;
            }

            foreach (var autoRecipe in AutoRecipeBehaviour.Instances)
            {
                autoRecipe.OnCookingPotRemoved(__instance);
            }
        }
    public void OnCookingPotRemoved(CookingPot oldCookingPot)
    {
        if (IsKill)
        {
            return;
        }

        if (cookingPot == null || oldCookingPot.ObjectIndex != cookingPot.ObjectIndex)
        {
            return;
        }

        SetCookingPot(null);
    }
    public void OnCookingPotPlaced(CookingPot newCookingPot)
    {
        if (IsKill)
        {
            return;
        }

        var sqrMag    = cookingPot == null ? float.MaxValue : (cookingPot.transform.position - transform.position).sqrMagnitude;
        var newSqrMag = (newCookingPot.transform.position - transform.position).sqrMagnitude;

        if (newSqrMag <= Player.UseDistance * Player.UseDistance && newSqrMag < sqrMag)
        {
            SetCookingPot(newCookingPot);
        }
    }
Пример #8
0
 private void OnTriggerEnter2D(Collider2D collider)
 {
     if (GetComponent <BoolStateTileScript>().BoolValue)
     {
         Debug.Log(collider.isTrigger);
         if (collider.gameObject.tag == "Player" && !collider.isTrigger)
         {
             Debug.Log("killing the player");
             collider.gameObject.GetComponent <PlayerHealthManager>().KillPlayer();
         }
     }
     if (collider.tag == "pot")
     {
         pot = collider.GetComponent <CookingPot>();
     }
 }
Пример #9
0
    public void Cook(IngredientMinion ingredient, CookingPot cookingPot)
    {
        // Cooking the ingredient
        bool ingredientCooked = _TargetCookingStation.Use(ingredient);

        // Setting target cooking station to null
        _TargetCookingStation = null;

        // Updating ui and inventory only on the local machine
        if (IsLocal && ingredientCooked)
        {
            RemoveIngredientFromInventory(ingredient);

            // Telling the UI that something has happened to some ingredient, so that they update themselves
            _IngredientModifiedEvent.Invoke(null);
        }
    }
    private CookingPot FindClosestCookingPot()
    {
        float      sqrMag     = float.MaxValue;
        CookingPot cookingPot = null;

        foreach (var block in BlockCreator.GetPlacedBlocks())
        {
            var candidate = block.GetComponent <CookingPot>();
            if (candidate == null || !Traverse.Create(candidate).Field <bool>("hasBeenPlaced").Value)
            {
                continue;
            }

            var sqrMagToCandidate = (candidate.transform.position - transform.position).sqrMagnitude;
            if (sqrMagToCandidate <= Player.UseDistance * Player.UseDistance && sqrMagToCandidate < sqrMag)
            {
                sqrMag     = sqrMagToCandidate;
                cookingPot = candidate;
            }
        }

        return(cookingPot);
    }
Пример #11
0
 public void RegisterCookingPot(int playerViewId, CookingPot playersPot)
 {
     PlayerCookingPots[playerViewId] = playersPot;
 }
 private void SetCookingPot(CookingPot newCookingPot)
 {
     cookingPot = newCookingPot;
     ClearPreparation();
 }
Пример #13
0
 private void UpdateUI(Slider progressSlider, CookingPot cookingPot)
 {
     progressSlider.value = cookingPot.CurrentDishStatusFraction;
 }