示例#1
0
    private void SwitchVisuals(bool state)
    {
        _outline.OutlineWidth = state ? _outlineWidthOnHover : 0;

        if (state)
        {
            _hint.Show(interactableName, interactableHint);
        }
        else
        {
            _hint.Hide();
        }
    }
示例#2
0
 public void HideHint()
 {
     if (Hint)
     {
         Hint.Hide();
     }
 }
示例#3
0
    public void OnEvent(StopInteractionConceptEvent e)
    {
        if (e.oldConcept == InteractionConcept.Selection)
        {
            VRTK_ControllerEvents rightController = VRTK.VRTK_DeviceFinder.GetControllerRightHand().GetComponent <VRTK_ControllerEvents>();

            rightController.TriggerTouchEnd -= startIdle;
            rightController.TouchpadPressed -= selectionConfirmed;

            Hint.Hide("BuildingSelectionConfirmHint");
        }
    }
示例#4
0
    public void OnEvent(StopInteractionConceptEvent e)
    {
        if (e.oldConcept == InteractionConcept.Idle)
        {
            VRTK_ControllerEvents leftController  = VRTK.VRTK_DeviceFinder.GetControllerLeftHand().GetComponent <VRTK_ControllerEvents>();
            VRTK_ControllerEvents rightController = VRTK.VRTK_DeviceFinder.GetControllerRightHand().GetComponent <VRTK_ControllerEvents>();

            leftController.TriggerTouchStart  -= startScaleRotate;
            rightController.TriggerTouchStart -= startSelectNavigate;

            Hint.Hide("BuildingSelectionTriggerHint");
            Hint.Hide("ScaleTranslateTriggerHint");
        }
    }
示例#5
0
        protected override void OnStateExited()
        {
            // cleanup battle here
            BattlePlayerTeams.ClearTeams();
            BattleRecyclables.Clear();
            PlayerSpawner.CleanupAllPlayers();
            AISpawner.CleanupAllPlayers();

            InGameConstants.AllowChargingLasers = true;
            InGameConstants.EnableQuacking      = false;

            celebrateActionAccumulator_.EndAccumulating();

            Hint.Hide();
        }
 public void OnEvent(StopInteractionConceptEvent e)
 {
     if (e.oldConcept == InteractionConcept.Selection)
     {
         Hint.Hide("HowToNavigateHint");
         if (navigationHint != null)
         {
             Destroy(navigationHint);
         }
         if (currentSelectionObject != null)
         {
             Destroy(currentSelectionObject);
         }
     }
 }
示例#7
0
    public void OnEvent(StopInteractionConceptEvent e)
    {
        if (e.oldConcept == InteractionConcept.ScaleRotate)
        {
            VRTK_ControllerEvents leftController = VRTK.VRTK_DeviceFinder.GetControllerLeftHand().GetComponent <VRTK_ControllerEvents>();

            leftController.TriggerAxisChanged -= showScaleRotateMenu;
            leftController.TriggerTouchEnd    -= startIdle;

            // reset animation and hide menu
            scaleRotateMenu.gameObject.GetComponent <ScaleAnimator>().ResetAnimation();
            scaleRotateMenu.SetActive(false);

            Hint.Hide("HowToScaleTranslate1Hint");
            Hint.Hide("HowToScaleTranslate2Hint");
        }
    }
示例#8
0
 // Запуск уничтожения корабля со взрывом
 public void Delete(bool AExplosion)
 {
     Hint.Hide();
     FScript.Delete(AExplosion);
 }
    // Update is called once per frame
    void Update()
    {
        if (Time.time > timeNextSample)
        {
            ray.origin     = transform.position;
            ray.direction  = transform.forward;
            timeNextSample = Time.time + samplingIntervalInSeconds;

            float    nearestDist      = float.MaxValue;
            Building selectedBuilding = null;

            Decoration cube = null;

            foreach (RaycastHit hit in Physics.RaycastAll(ray, 100))
            {
                if (hit.distance > nearestDist)
                {
                    continue;
                }
                nearestDist = hit.distance;
                if (hit.collider.transform.GetComponent <Building>() != null)
                {
                    selectedBuilding             = hit.collider.transform.GetComponent <Building>();
                    lastSelectedBuildingPosition = hit.point;
                }
                if (hit.collider.transform.GetComponent <Floor>() != null)
                {
                    lastSelectedFloorPosition = hit.point;
                    selectionOnFloor          = true;
                }
                else
                {
                    selectionOnFloor = false;
                }
                if (hit.collider.transform.GetComponent <Decoration>() != null)
                {
                    cube = hit.collider.transform.GetComponent <Decoration>();
                }
                else
                {
                    cube = null;
                }
            }

            if (selectionOnFloor)
            {
                if (navigationHint == null)
                {
                    navigationHint = (GameObject)GameObject.Instantiate(navigationHintPrefab);
                }
                navigationHint.transform.position = new Vector3(lastSelectedFloorPosition.x, 0, lastSelectedFloorPosition.z);
                navigationHint.transform.rotation = Quaternion.LookRotation(new Vector3(ray.direction.x, 0, ray.direction.z).normalized, Vector3.up);
            }
            else if (navigationHint != null)
            {
                GameObject.Destroy(navigationHint);
            }

            if (cube != null)
            {
                cube.TractorBeamToPosition(ray.origin);
            }

            if (selectedBuilding != lastSelectedBuilding)
            {
                if (selectedBuilding != null)
                {
                    transform.FindChild("TextHolder/FileNameLabel").GetComponent <TextMesh>().text = selectedBuilding.node.name;
                    transform.FindChild("TextHolder/PathNameLabel").GetComponent <TextMesh>().text = selectedBuilding.node.pathName;
                    AnimateThis anim = transform.FindChild("TextHolder").GetComponent <AnimateThis>();
                    anim.CancelAll();
                    anim.Transformate().Duration(1).FromScale(new Vector3(1, 0, 1)).ToScale(Vector3.one).Ease(AnimateThis.EaseOutElastic).Start();

                    if (currentSelectionObject != null)
                    {
                        Destroy(currentSelectionObject);
                    }
                    currentSelectionObject = (GameObject)GameObject.Instantiate(selectionPrefab);
                    Bounds bounds = selectedBuilding.gameObject.GetComponent <Renderer>().bounds;
                    currentSelectionObject.transform.position   = bounds.center;
                    currentSelectionObject.transform.localScale = selectedBuilding.transform.parent.lossyScale + new Vector3(0.001f, 0.001f, 0.001f);
                    currentSelectionObject.transform.rotation   = GameObject.Find("SoftwareCity").transform.rotation;

                    VRTK_DeviceFinder.GetControllerRightHand().GetComponent <VRTK_ControllerActions>().TriggerHapticPulse((ushort)(0.1f * 3999));

                    Hint.Display("BuildingSelectionConfirmHint");
                    //VRTK_DeviceFinder.GetControllerRightHand().GetComponent<VRTK_ControllerActions>().ToggleHighlightTouchpad(true, new Color(0, 0, 1, 0.5f));
                }
                else
                {
                    transform.FindChild("TextHolder/FileNameLabel").GetComponent <TextMesh>().text = "";
                    transform.FindChild("TextHolder/PathNameLabel").GetComponent <TextMesh>().text = "";

                    if (currentSelectionObject != null)
                    {
                        Destroy(currentSelectionObject);
                        currentSelectionObject = null;
                    }

                    Hint.Hide("BuildingSelectionConfirmHint");
                    //VRTK_DeviceFinder.GetControllerRightHand().GetComponent<VRTK_ControllerActions>().ToggleHighlightTouchpad(false);
                }
                lastSelectedBuilding = selectedBuilding;
            }
        }
    }