Exemple #1
0
    public void OnTouched()
    {
        if (!IsFinished() && HasAllIngridients() && !IsBoxClosed())
        {
            m_ingridientContainer.GetComponentInChildren <BurgerBox>().CloseBox();
            return;
        }

        var cook = Cook.Get();

        if (IsInProgress() && cook.IsHolding <SauceBottle>())
        {
            var sauceBottle = cook.GetRightHand <SauceBottle>();
            cook.DropRightHand(m_sauceBottlePlaceholder);
            sauceBottle.SpreadSauce(() =>
            {
                cook.GrabRightHand(sauceBottle.gameObject);
            });

            var sauce = ObjectFactory.Get().CreateSauce();
            sauce.transform.position = transform.position;
            sauce.transform.rotation = transform.rotation;
            sauce.PlayAppearAnimation();
            AddIngridient(sauce.gameObject);
        }
        else if (IsFinished() && cook.Inventory.IsRightHandFree)
        {
            cook.GrabRightHand(transform.gameObject);
        }
        else if (!cook.Inventory.IsRightHandFree)
        {
            AddIngridient(cook.Inventory.RightHand);
            cook.DropRightHand();
        }
    }
Exemple #2
0
    public void Touched()
    {
        m_animator.SetTrigger("Open");
        m_closed = false;

        m_trashPlaceholder.rotation = Random.rotation;

        var cook = Cook.Get();

        var obj = cook.Inventory.RightHand;

        if (obj == null)
        {
            return;
        }

        obj.transform.SetParent(null);
        cook.Inventory.SetRightHand(null);

        var dir = m_trashPlaceholder.position - obj.transform.position;

        dir.Normalize();
        dir.y += 1.0f;

        var thrower = obj.AddComponent <Thrower>();

        thrower.SetVelocity(dir * 1.2f);

        m_trash = obj;
    }
Exemple #3
0
    public void OnTouched()
    {
        if (IsReady() || !IsInDrinkMachine())
        {
            Cook.Get().GrabRightHand(gameObject);
            return;
        }

        if (!IsFull())
        {
            return;
        }

        if (!HasLid())
        {
            if (Cook.Get().IsHolding <Lid>())
            {
                Cook.Get().DropRightHand(m_lidPlaceholder);
            }

            return;
        }

        if (!HasStraw())
        {
            if (Cook.Get().IsHolding <Straw>())
            {
                Cook.Get().DropRightHand(m_strawPlaceholder);
            }

            return;
        }
    }
Exemple #4
0
    public void OnTouched()
    {
        if (!HasTray())
        {
            if (Cook.Get().IsHolding <Tray>())
            {
                Cook.Get().DropRightHand(m_trayPlaceholder);
            }

            return;
        }
    }
Exemple #5
0
    public void DoAction()
    {
        var cook = Cook.Get();

        if (!cook.Inventory.IsRightHandFree)
        {
            return;
        }

        var spawnedObject = Instantiate(m_spawnPrefab, transform.position, transform.rotation);

        cook.GrabRightHand(spawnedObject);
    }
Exemple #6
0
    public void DoAction()
    {
        var cook          = Cook.Get();
        var objectFactory = ObjectFactory.Get();

        if (IsOccupied())
        {
            var bottomBan = GetBottomBan();
            if (bottomBan != null && bottomBan.HalfBanCookStatus == HalfBanCookStatus.Done)
            {
                cook.GrabRightHand(bottomBan.gameObject);
            }
            else
            {
                var topBan = GetTopBan();
                if (topBan != null && topBan.HalfBanCookStatus == HalfBanCookStatus.Done)
                {
                    cook.GrabRightHand(topBan.gameObject);
                }
            }
        }
        else
        {
            if (!cook.Inventory.IsRightHandFree)
            {
                var ban = cook.Inventory.RightHand.GetComponent <Ban>();
                if (ban != null)
                {
                    cook.DropRightHand();
                    Destroy(ban.gameObject);

                    var banBottom = objectFactory.CreateHalfBanBottom();
                    // Utils.SetParentAndResetTransform(banBottom.transform, m_bottomBanHolder);
                    banBottom.transform.position = ban.m_bottomBan.position;
                    banBottom.transform.rotation = ban.m_bottomBan.rotation;
                    Mover.Get().Move(banBottom.transform, m_bottomBanHolder);

                    var banTop = objectFactory.CreateHalfBanTop();
                    // Utils.SetParentAndResetTransform(banTop.transform, m_topBanHolder);
                    banTop.transform.position = ban.m_topBan.position;
                    banTop.transform.rotation = ban.m_topBan.rotation;
                    Mover.Get().Move(banTop.transform, m_topBanHolder);
                }
            }
        }
    }
Exemple #7
0
    public void OnTouched()
    {
        if (Cook.Get().Inventory.IsRightHandFree)
        {
        }
        else
        {
            if (Cook.Get().IsHolding <Burger>() && GetBurger() == null)
            {
                Cook.Get().DropRightHand(m_burgerPlaceholder);
            }

            if (Cook.Get().IsHolding <Cup>() && GetCup() == null)
            {
                Cook.Get().DropRightHand(m_cupPlaceholder);
            }
        }
    }
Exemple #8
0
    public override void DoAction()
    {
        var cook = Cook.Get();

        if (transform.childCount > 0)
        {
            var interactiveElement = transform.GetChild(0).GetComponent <BaseInteractiveElement>();
            if (interactiveElement != null)
            {
                interactiveElement.DoAction();
            }
        }
        else if (!cook.Inventory.IsRightHandFree && transform.childCount == 0)
        {
            var rightHandGameObject = cook.Inventory.RightHand;

            cook.DropRightHand(transform);
        }
    }
Exemple #9
0
    public void OnTouched()
    {
        var burger = GetBurger();

        if (burger != null)
        {
            return;
        }

        var cook = Cook.Get();

        if (cook.Inventory.IsRightHandFree || cook.Inventory.RightHand.GetComponent <BurgerBox>() == null)
        {
            return;
        }

        burger = ObjectFactory.Get().CreateBurger();
        Utils.SetParentAndResetTransform(burger.transform, m_burgerPlaceholder.transform);
        burger.AddIngridient(cook.Inventory.RightHand);

        cook.DropRightHand();
    }
Exemple #10
0
 public override void DoAction()
 {
     Cook.Get().GrabRightHand(gameObject);
 }