示例#1
0
    public void CreateOrderUse()
    {
        if (Agent.BlackBoard.IsOrderAddPossible(AgentOrder.E_OrderType.E_USE) == false)
        {
            return;
        }

        InteractionGameObject onObject = MissionZone.Instance.CurrentGameZone.GetNearestInteractionObject(Agent.Position, 2);

        if (onObject == null)
        {
            return;
        }

        if (onObject is InteractionLever)
        {
            InteractionLever lever = onObject as InteractionLever;
            if (lever.State != InteractionLever.E_State.E_OFF && lever.State != InteractionLever.E_State.E_OFF)
            {
                return;
            }

            AgentOrder order = AgentOrderFactory.Create(AgentOrder.E_OrderType.E_USE);
            order.InteractionObject = onObject;
            order.Position          = order.InteractionObject.GetEntryTransform().position;
            order.Interaction       = E_InteractionType.On;
            Agent.BlackBoard.AddOrder(order);

            return;
        }

        ComboProgress.Clear();
        ClearBufferedOrder();
        //GuiManager.Instance.ShowComboProgress(ComboProgress);
    }
示例#2
0
    /// <summary>
    /// Swaps the players <see cref="PlayerInput.currentActionMap"/> to QTE and sets values of variables.
    /// </summary>
    /// <param name="lever">The script attached to the lever.</param>
    /// <param name="leverPosition">The gameobject which the script is attached to.</param>
    public void SwapToQTE(InteractionLever lever, GameObject leverPosition)
    {
        currentLever = lever;
        playerInput.SwitchCurrentActionMap("QTE");


        Vector3 placement = new Vector3(leverPosition.transform.position.x, transform.position.y, leverPosition.transform.position.z);

        moveToPosition   = placement + leverPosition.transform.forward * 0.4f + -leverPosition.transform.right * 0.5f;
        targetRotation   = (placement + leverPosition.transform.forward * 0.4f) - moveToPosition;
        fromRotation     = transform.rotation;
        moveFromPosition = rb.transform.position;
        toRotation       = Quaternion.LookRotation(targetRotation, Vector3.up);
        StartCoroutine(PlaceAndRotate());
    }