void Update()
        {
            pointer.laserColor = laserColor;
            pointer.lineWidth  = lineWidth;
            pointer.OnUpdate();

            // We hide the pointer target if there's no valid selection.
            bool isValid = IsPointedAtValidMovePosition() && IsPointedAtValidAngle();

            pointer.target.SetActive(isValid);

            if (!isValid)
            {
                return;
            }

            if (character == null)
            {
                Debug.LogError("Can't move null positioned character");
                return;
            }

            if (moveTrigger == null)
            {
                Debug.LogError("Can't position character without a move trigger to check");
                return;
            }

            if (moveTrigger.TriggerActive())
            {
                // Ask the character to move to pointed at position.
                character.SetTargetPosition(pointer.hitPosition);
                return;
            }
        }
コード例 #2
0
        void Update()
        {
            UpdateTargetPosition();

            // We hide the pointer target if there's no valid selection.
            bool isValid = IsPointedAtObject && IsPointedAtValidAngle();

            target.SetActive(isValid);

            if (!isValid)
            {
                return;
            }

            if (character == null)
            {
                Debug.LogError("Can't move null positioned character");
                return;
            }

            if (moveTrigger == null)
            {
                Debug.LogError("Can't position character without a move trigger to check");
                return;
            }

            if (moveTrigger.TriggerActive())
            {
                // Ask the character to move to pointed at position.
                character.SetTargetPosition(hitPosition);
                return;
            }
        }