Пример #1
0
    //void OnCollisionEnter(Collision col)
    //{

    //}

    //IEnumerator PerformAnimation()
    //{

    //    yield return new WaitForSeconds(2);
    //}

    public void GoToNextWaypoint()
    {
        if (_waypointIndex != Waypoints.Length)
        {
            _currentWayPoint = Waypoints[_waypointIndex++];
            _ai.AssignNewState(new GoSomewhereAndWaitState(_sideKickAgent, _currentWayPoint.position));
        }
    }
Пример #2
0
    public void EngageWaypoint()
    {
        if (player != null)
        {
            player.GetComponent <PlayerMovement>().enabled = true;
        }

        //if (Animate)
        //{
        //    sidekick.GetComponent<Animator>().SetTrigger(Animation);
        //}

        //if (AddNewSign)
        //{
        //    CreateNewSymbol.SymbolID = SignId;
        //}

        //if (LookAtPlayer)
        //{
        //   sidekick.GetComponent<SidekickControls>().ExecuteAction(19);
        //}

        if (UseText)
        {
            //  speech.ActivateSidekickSignBubble(new List<int>(new[] { 8 }));
        }

        if (ImmobilizePlayerUntilNextWaypoint && player != null)
        {
            player.GetComponent <PlayerMovement>().enabled = false;
        }

        if (sidekick != null)
        {
            sidekickMovement.StrollSpeed = 0;
            sidekickMovement.AssignNewState(new GoSomewhereAndWaitState(sidekick.GetComponent <NavMeshAgent>(), transform.position));
            sidekickMovement.GetCurrentState().WaitingTime = WaitForSeconds ? WaitTime : float.MaxValue - Time.time * 2;
            //    Debug.Log("State assigned");
        }
        StartCoroutine(ExecuteWaypoint());
    }
Пример #3
0
        void LateUpdate()
        {
            if (!_canMove)
            {
                return;
            }

            _tap     = false;
            _canMove = false;
            // if (!Input.GetMouseButtonUp(0)) return;

            var ts = Input.touches;

            //	Debug.Log ("touches " + EventSystem.current.IsPointerOverGameObject());

            if (ts.Length > 1 || (ts.Length > 0 && EventSystem.current.IsPointerOverGameObject(ts[0].fingerId)) ||
                EventSystem.current.IsPointerOverGameObject())
            {
                return;
            }


            // Find all object in ray, and sort them by distance to object.
            var ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            RaycastHit[] hits = Physics.RaycastAll(ray, 100);
            hits = hits.OrderBy(h => h.distance).ToArray();

            var state = hits.Select(hit => GameObjectToState(hit.transform.gameObject, hit))
                        .FirstOrDefault(s => s != null);

            if (state != null)
            {
                _ai.AssignNewState(state);
            }
        }
Пример #4
0
        public void ExecuteAction(int i)
        {
            switch (i)
            {
            case 0:
                _sideKickMovement.AssignNewState(new GoSomewhereAndWaitState(_sideKickAgent,
                                                                             _player.transform.position));
                return;

            case 1:
                _sideKickMovement.AssignNewState(new WaitState(_sideKickAgent));
                return;

            case 2:
                _sideKickMovement.AssignNewState(new InteractWithNearestState(_sideKickAgent, Constants.Tags.Lever,
                                                                              _sidekickPickupHandler.CurrentPickup));
                return;

            case 3:
                _sideKickMovement.AssignNewState(new PickupItemState(_sideKickAgent, Constants.Tags.Stick));
                return;

            case 4:
                _sideKickMovement.AssignNewState(new InteractWithNearestState(_sideKickAgent, Constants.Tags.Brazier,
                                                                              _sidekickPickupHandler.CurrentPickup));
                return;

            case 5:
                _sideKickMovement.AssignNewState(new TradeState(_sideKickAgent, _player.GetComponent <NavMeshAgent>()));
                return;

            case 6:
                _sideKickMovement.AssignNewState(new PickupItemState(_sideKickAgent, Constants.Tags.Bucket));
                return;

            case 7:
                _sideKickMovement.AssignNewState(new InteractWithNearestState(_sideKickAgent, Constants.Tags.Pool,
                                                                              _sidekickPickupHandler.CurrentPickup));
                return;

            case 8:
                _sideKickMovement.AssignNewState(new InteractWithNearestState(_sideKickAgent, Constants.Tags.Font,
                                                                              _sidekickPickupHandler.CurrentPickup));
                return;

            case 9:
                _sideKickMovement.AssignNewState(new PickupItemState(_sideKickAgent, Constants.Tags.Key));
                return;

            case 10:
                _sideKickMovement.AssignNewState(new InteractWithNearestState(_sideKickAgent, Constants.Tags.Keyhole,
                                                                              _sidekickPickupHandler.CurrentPickup));
                return;
            }
        }