Пример #1
0
    void Update()
    {
        remainingMoveCooldown -= Time.deltaTime;

        if (CanReceiveInput && actionList.Count > 0)
        {
            bool proccessed = false;
            switch (actionList.Pop())
            {
            case MovementType.Forward:
            {
                Forward();
                proccessed = true;
                break;
            }

            case MovementType.Backward:
            {
                Backward();
                proccessed = true;
                break;
            }

            case MovementType.Left:
            {
                Right();
                proccessed = true;
                break;
            }

            case MovementType.Right:
            {
                Left();
                proccessed = true;
                break;
            }

            default:
            {
                break;
            }
            }
            if (proccessed)
            {
                remainingMoveCooldown = MovementCooldown;
                actionList.Clear();
                sentient?.ChangeFood(-SettingsProvider.Instance.Global.MovementFoodCost);

                if (movementSound != null)
                {
                    movementSound.pitch = UnityEngine.Random.Range(0.9f, 1.1f);
                    movementSound.PlayDelayed(0.20f);
                }
            }
        }
        else
        {
            actionList.Clear();
        }
    }
Пример #2
0
 public void Interact(Sentient Source)
 {
     Source.ChangeFood(Value);
     consumeRef.MarkConsumed();
 }