Ejemplo n.º 1
0
    private void Update()
    {
        if (Input.GetButtonDown("Action") && isInContact && !hasAnObject && !toolsManager.usingATool)
        {
            toolsManager.UseTool();

            // Animation
            toolsManager.GetComponent <Animator>().SetBool("pickUp", true);

            StartCoroutine("ItemInPipe");

            Inventory.instance.Remove(Inventory.instance.usedItem);
            if (Inventory.instance.usedItem == null)
            {
                toolsManager.CarryItem(false);
            }
            toolsManager.ActivateActionInfo("Poser", requiredUsingTools, "l'item");
        }
    }
Ejemplo n.º 2
0
    void OnButton()
    {
        int cStep = toolManager.GetCurrentStep();

        if ((controledIndex + 1) <= steps.Length && toolManager.CheckStep(steps[controledIndex]))     //操作步骤正确
        {
            //换鼠标指针
            toolManager.kCursorCur = kCursor;
            //隐藏上一步场景
            if (kLastScene != null)
            {
                kLastScene.SetActive(false);
            }
            //显示当前步骤
            kControledObjs[controledIndex].SetActive(true);
            kLastScene = kControledObjs[controledIndex];
            //步骤7以后需要隐藏kDM_A
            if (kDM_A != null)
            {
                if (steps[controledIndex] >= 7)
                {
                    kDM_A.SetActive(false);
                }
                else
                {
                    kDM_A.SetActive(true);
                }
            }
            controledIndex++;
        }
        else    //操作步骤错误
        {
            toolManager.kMotion.transform.SetParent(transform);
            toolManager.kMotion.transform.localPosition = new Vector3(0, 200, 0);
            toolManager.kMotion.Show();
            toolManager.GetComponent <AudioSource>().Play();
        }
    }
Ejemplo n.º 3
0
    private void Update()
    {
        if (isInContact && Input.GetButtonDown("Action") && !toolsManager.usingATool)
        {
            toolsManager.UseTool();

            // Animation
            toolsManager.GetComponent <Animator>().SetBool("pickUp", true);

            if (nestIsEmpty)
            {
                // Put Egg in center
                //egg = Instantiate(Inventory.instance.usedItem.prefab, eggPosition.position, eggPosition.rotation, eggPosition);
                egg = Instantiate(Inventory.instance.usedItem.prefab, eggPosition);
                egg.GetComponent <Rigidbody>().isKinematic = true;
                egg.GetComponent <ItemPickup>().canPickUp  = false;
                egg.transform.position = eggPosition.position;

                Inventory.instance.Remove(Inventory.instance.usedItem);
                if (Inventory.instance.usedItem == null)
                {
                    toolsManager.CarryItem(false);
                }

                // Change Symbol aspect according to egg color
                mySymbol.myEgg = egg.GetComponent <ItemPickup>().item.name;
                mySymbol.changeColor(egg.GetComponent <ItemPickup>().item.name);
                if (mySymbol.CheckWin())
                {
                    GetComponent <CinematicTrigger>().Play();
                    ChangeAnimation();
                    win = true;
                }
                nestIsEmpty = false;
                toolsManager.ActivateActionInfo("Prendre", null, "Oeuf");
            }
            else
            {
                egg.GetComponent <ItemPickup>().canPickUp  = true;
                egg.GetComponent <Rigidbody>().isKinematic = false;
                Destroy(eggPosition.GetChild(0).gameObject);

                Inventory.instance.Add(egg.GetComponent <ItemPickup>().item);

                // Change Symbol aspect according to egg color
                mySymbol.myEgg = null;
                mySymbol.setDefaultColor();

                // reverse animation only if the door was open before
                if (win)
                {
                    GetComponent <CinematicTrigger>().Play();
                    ChangeAnimation();
                    win = false;
                }

                nestIsEmpty = true;
                toolsManager.ActivateActionInfo("Poser", requiredUsingTools, "Oeuf");
            }
        }
    }