Interact() 공개 메소드

public Interact ( ArrayList list ) : bool
list ArrayList
리턴 bool
예제 #1
0
 public void Interact(GameObject interactor, Interaction interaction)
 {
     Debug.Log("Interactor: " + interactor.name);
     Debug.Log("Interaction: " + interaction.name);
     Debug.Log("Interactable: " + gameObject.name);
     _interactionController.Interact(interactor, interaction);
 }
예제 #2
0
        private void Update()
        {
            if (interactionsEnabled)
            {
                if (interactionsCooling)
                {
                    interactionsCooling = false;
                    return;
                }

                if (Input.GetButtonDown(KeyCodeConsts.Use))
                {
                    OnConfirm?.Invoke(INPUT_TYPE.USE);
                    interactionController.Interact();
                }

                if (Input.GetButtonDown(KeyCodeConsts.Cancel))
                {
                    OnCancel?.Invoke(INPUT_TYPE.CANCEL);
                    interactionController.Cancel();
                }

                if (Input.GetButtonDown(KeyCodeConsts.Inventory))
                {
                    OnInventory?.Invoke(INPUT_TYPE.INVENTORY);
                }
            }
        }
예제 #3
0
    private void Update()
    {
#if !UNITY_ANDROID
        if (Input.GetButtonDown("Interact"))
        {
            interactionController.Interact();
        }

        if (Input.GetButtonDown("Inventory"))
        {
            inventoryManager.ShowRecipeBookMenu();
        }
#endif
    }
    private void Update()
    {
        if (inputs.interactPressed)
        {
            interactionController.Interact();
        }

        if (inputs.interactReleased)
        {
            interactionController.ReleaseInteract();
        }
        if (inputs.crouch)
        {
            ToggleCrouch();
        }
        if (inputs.v != 0 || inputs.h != 0)
        {
            rb.drag = 1;
        }
        else
        {
            rb.drag = 10;
        }
    }
예제 #5
0
        private static void Main(string[] args)
        {
            Text.Clear();

            Console.WindowWidth  = ConsoleWidth;
            Console.WindowHeight = ConsoleHeight;
            Console.BufferHeight = ConsoleHeight;
            Console.BufferWidth  = ConsoleWidth;

            while (RunningGame)
            {
                switch (GameState)
                {
                case GameState.Menu:
                    RpgController.MainMenu();
                    break;

                case GameState.Start:
                    RpgController.StartNewGame();
                    break;

                case GameState.Playing:
                    if (Player.Instance.CurrentGladiator.CurrentZone == null)
                    {
                        IZone currentZone = ZoneFactory.GetZone(ZoneLevel.One);
                        Header.Map = currentZone.Map;
                        Player.Instance.CurrentGladiator.CurrentZone = currentZone;
                    }

                    Player.Instance.CurrentGladiator.CurrentZone.StateChanged(GameEvent.ZoneEnter);
                    Text.WriteLine("Welcome to the Arena Of Death!.\nNavigate through the arena to kill enemies.\n");
                    RpgController.Navigate();
                    break;

                case GameState.Interacting:
                    InteractionController.Interact(Player.Instance.CurrentGladiator, Player.Instance.CurrentGladiator.Target);
                    break;

                case GameState.Battle:
                    Text.ClearWithAbilities();
                    RpgController.Battle();
                    break;

                case GameState.Quit:
                    RpgController.QuitGame();
                    break;

                case GameState.GameOver:
                    Zone1.Instance.Dispose();
                    var repo = new MongoRepository();
                    //display ladder board
                    repo.AddGladiatorToHistory(Player.Instance.CurrentGladiator);
                    //repo.AddGladiator(Player.Instance.CurrentGladiator);
                    Thread.Sleep(2000);
                    //Console.WriteLine(repo.GetGladiatorHistory("YOMAN").Result.kills);
                    //repo.RemoveGladiatorHistoryRecord("JAVY");
                    GameState = GameState.Menu;
                    Text.Clear();
                    break;
                }
            }
        }
예제 #6
0
 private void OnInteractionTriggered(Gladiator unit)
 {
     InteractionController.Interact(unit, this);
 }
예제 #7
0
    void Update()
    {
        // begin
        if (ConstructionSystem.instance.activated || ForgeSystem.instance.activated || DiscussionSystem.instance.activated)
        {
            InventoryUI.instance.SetActive(false);
            return;
        }

        float speedFactor = Input.GetKey(KeyCode.LeftShift) && loadFactor > 0.75f ? 2 : 1;

        direction = Vector3.zero;

        // offensive posture on horse
        bool mounted = horse ? horse.equipedItem.type != HorseItem.Type.None : false;
        bool attack  = mounted ? Input.GetMouseButtonUp(0) : Input.GetMouseButtonDown(0);

        attack &= !eventsystem.IsPointerOverGameObject();
        bool allowOffensivePosture = mounted && weapon.equipedItem.type != WeaponItem.Type.None && weapon.equipedItem.animationCode == 5;

        if (allowOffensivePosture && Input.GetMouseButton(0))
        {
            offensiveSpearWeight = Mathf.Clamp(offensiveSpearWeight + 3 * Time.deltaTime, 0f, 1f);
        }
        else if (allowOffensivePosture)
        {
            offensiveSpearWeight = Mathf.Clamp(offensiveSpearWeight - 3 * Time.deltaTime, 0f, 1f);
        }
        else
        {
            offensiveSpearWeight = 0f;
        }
        if (animator.GetLayerIndex("OffensivePosture") >= 0)
        {
            animator.SetLayerWeight(animator.GetLayerIndex("OffensivePosture"), offensiveSpearWeight);
        }

        // action or attack
        if (attack && attackDelay <= 0)
        {
            // if not click on UI
            RaycastHit hit;
            if (!Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 50f, 1 << LayerMask.NameToLayer("PlayerUI")))
            {
                animator.SetTrigger("attack");
                attackDelay      = attackCooldown;
                attacking        = !mounted;
                audiosource.clip = effortSound;
                audiosource.Play();
                target = hit.point;
            }
        }

        // interaction
        else if (interactionController.hoveredInteractor && Input.GetKeyDown(interactionController.interactKey) && !interactionController.interacting)
        {
            InteractionType[] interactions = interactionController.hoveredInteractor.GetComponents <InteractionType>();
            foreach (InteractionType interaction in interactions)
            {
                interactionController.Interact(interaction.type);
            }
        }

        // movement
        if ((controller.isGrounded || grounded < 0.2f) && !attacking && !interactionController.interacting)
        {
            // compute animation parameters
            direction = GetInputDirection();
            if (direction.x == 0f && direction.z == 0f)
            {
                animator.SetFloat("run", 0f);
            }
            else
            {
                animator.SetFloat("run", speedFactor);
            }
            animator.SetFloat("loadFactor", loadFactor * speedFactor);

            // update position
            direction = speedFactor * loadFactor * runSpeed * direction;
            direction = direction.x * Camera.main.transform.right + direction.z * Vector3.ProjectOnPlane(Camera.main.transform.forward, Vector3.up).normalized;
            grounded  = 0f;
        }
        else
        {
            grounded += Time.deltaTime;
        }

        // move
        direction.y = -gravity;
        controller.Move(direction * Time.deltaTime);

        // aiming
        if (attacking)
        {
            direction = (target - transform.position).normalized;
        }
        else if (interactionController.interacting && interactionController.hoveredInteractor != null)
        {
            direction = (interactionController.hoveredInteractor.transform.position - transform.position).normalized;
        }
        if (direction.x != 0f || direction.z != 0f)
        {
            Quaternion goal = Quaternion.LookRotation(new Vector3(direction.x, 0, direction.z), Vector3.up);
            transform.rotation = Quaternion.RotateTowards(transform.rotation, goal, (attacking | interactionController.interacting ? aimingAttackSpeed : aimingSpeed) * Time.deltaTime);
        }

        if ((direction.x != 0f || direction.z != 0f) && speedFactor >= 2 && Random.Range(0, 4) == 0)
        {
            particles.Emit(emitParams, 1);
        }

        // update timers
        if (attackDelay > 0f)
        {
            attackDelay -= Time.deltaTime;
        }
        if (needEquipementAnimationUpdate)
        {
            AnimationParameterRefresh();
        }
    }