Ejemplo n.º 1
0
    private void WalkSelection()
    {
        Collider col    = GazeManager.RaycastCollider();
        Vector3  newPos = GazeManager.RaycastPosition();

        if (GazeManager.RaycastUI() != null)
        {
            return;
        }

        if (col != null && col.gameObject.layer == 9)
        {
            walkSelTimer += Time.deltaTime;
            if (walkSelTimer >= preWalkSelTime)
            {
                UIManager.SetSelectionMarker(Mathf.Clamp01((walkSelTimer - preWalkSelTime) / (walkSelTime - preWalkSelTime)), walkToPos);
            }
            if (walkSelTimer >= walkSelTime)
            {
                agent.SetDestination(new Vector3(walkToPos.x, transform.position.y, walkToPos.z));
                UIManager.SetSelectionMarker(0, walkToPos);
                //walkSelTimer = 0;
                //newPos = Vector3.zero;
            }

            if (Vector3.Distance(newPos, walkToPos) >= corrDistance)
            {
                walkSelTimer = 0;
                walkToPos    = newPos;
                UIManager.SetSelectionMarker(0, walkToPos);
            }
        }
    }
Ejemplo n.º 2
0
    private void Update()
    {
        rect.position = UIManager.InsideScreenPos(UIManager.TargetMarkerPosition(), rect.sizeDelta.x / 2);

        Graphic graphic = GazeManager.RaycastUI();

        if (graphic == null)
        {
            return;
        }

        if (graphic.Equals(buttWalk))
        {
            Debug.Log("Walk state");
            PlayerController.SetState(PlayerController.PlayerState.MoveState);
            CloseWheels();
        }
        else if (graphic.Equals(buttInter))
        {
            Debug.Log("Inter state");
            PlayerController.SetState(PlayerController.PlayerState.IdleState);
            CloseWheels();
        }
        else if (graphic.Equals(buttExit))
        {
            //Exit
            //Debug.Log("Exit");
            CloseWheels();
        }
    }
Ejemplo n.º 3
0
    private void TargetMarkerSelectUpdate()
    {
        Graphic graphic = GazeManager.RaycastUI();

        if (graphic == null)
        {
            return;
        }

        if (graphic.Equals(UIManager.Instance.targetMarker))
        {
            if (UIManager.Target != null)
            {
                bool isKillable = UIManager.TargetType().IsSubclassOf(typeof(Killable));
                if (!isKillable)
                {
                    ToggleMoveState();
                }
                else
                {
                    playerState = PlayerState.SpellPick;
                    //UIManager.ShowStateWheel(isPlayer);
                    UIManager.ShowSpellWheel(isKillable);
                }
            }
        }
    }
Ejemplo n.º 4
0
    private void Update()
    {
        rect.position = UIManager.InsideScreenPos(UIManager.TargetMarkerPosition(), rect.sizeDelta.x / 2);

        Graphic graphic = GazeManager.RaycastUI();

        if (graphic == null)
        {
            return;
        }

        if (graphic.Equals(buttSpell1))
        {
            PlayerController.ThrowSpell(1);
            CloseWheel();
        }
        else if (graphic.Equals(buttSpell2))
        {
            PlayerController.ThrowSpell(2);
            CloseWheel();
        }
        else if (graphic.Equals(buttExit))
        {
            //Exit
            //Debug.Log("Exit");
            CloseWheel();
        }
    }
Ejemplo n.º 5
0
    void Update()
    {
        AnimationUpdate();

        switch (playerState)
        {
        case PlayerState.IdleState:
            //Look for target
            Collider col = GazeManager.RaycastCollider();
            Graphic  gr  = GazeManager.RaycastUI();

            if (gr != null)
            {
                if (gr.CompareTag("Target"))
                {
                    UIManager.SetTarget(gr.transform);
                }
            }
            else if (col != null && col.CompareTag("Enemy"))
            {
                UIManager.SetTarget(col.transform);
            }

            TargetMarkerSelectUpdate();
            break;

        case PlayerState.MoveState:
            gr = GazeManager.RaycastUI();
            if (gr != null && gr.CompareTag("Target"))
            {
                UIManager.SetTarget(gr.transform);
                return;
            }
            TargetMarkerSelectUpdate();
            WalkSelection();
            break;

        case PlayerState.SpellPick:
            ////Look for target
            //col = GazeManager.RaycastCollider();
            //gr = GazeManager.RaycastUI();

            //if (gr != null)
            //{
            //    if (gr.CompareTag("Target"))
            //    {
            //        UIManager.SetTarget(gr.transform);
            //        UIManager.Instance.targetMarker.color = playerState == PlayerState.MoveState ? UIManager.Instance.combatColor : UIManager.Instance.walkColor;
            //        UIManager.ShowSpellWheel(false);
            //        //UIManager.Instance.markerTimer = UIManager.Instance.markerLifeTime;
            //    }
            //}
            //else if (col != null && col.CompareTag("Enemy"))
            //{
            //    UIManager.SetTarget(col.transform);
            //    UIManager.ShowSpellWheel(false);
            //    //UIManager.Instance.markerTimer = UIManager.Instance.markerLifeTime;
            //}
            //TargetMarkerSelectUpdate();
            break;

        default:
            break;
        }
    }