예제 #1
0
        private void GamePaused()
        {
            _laserPointer.SetActive(true);

            if (_audio != null)
            {
                _audio.volume = _minVolume;
            }

            _pausedGame.Raise(true);

            foreach (Collider collider in _canvasColliders)
            {
                collider.enabled = true;
            }

            _countingDown.Value    = false;
            _startedWcPuzzle.Value = false;

            for (int i = 0; i < _teleport.Length; i++)
            {
                _teleport[i].enabled = false;
            }
            for (int j = 0; j < _interactable.Length; j++)
            {
                _interactable[j].enabled = false;
            }

            _pauseMenuCs.enabled = true;
        }
예제 #2
0
    private void HandleHeroSelection()
    {
        if (Input.GetMouseButtonDown(0))
        {
            hit = DetectHit(Input.mousePosition);
        }
        else if (Input.GetMouseButtonUp(0))
        {
            if (hit.collider == null && isHeroSelected)   // Action to unselect

            {
                clickCounter++;

                if (clickCounter == 1 && isCoroutineAllowedSelection)
                {
                    firstClickTime = Time.time;
                    StartCoroutine(HeroUnselection());
                }
            }
            else if (hit.collider == heroColider)     // Action to select

            {
                isHeroSelected = true;
                heroSelectEvent.Raise(isHeroSelected);
                Debug.Log("Hero Selected!");
            }
        }
    }
예제 #3
0
 public void CheckForNeighborHolding(Vector2 neighborPos)
 {
     if (neighborPos == -Vector2.one)
     {
         sendNeighborHoldingEvent.Raise(false);
     }
     else
     {
         // Checks if holder in given grid position is holding a bucket
         sendNeighborHoldingEvent.Raise(grid.gridArray[(int)neighborPos.x, (int)neighborPos.y].GetComponent <Holder>().isHoldingBucket);
     }
 }
예제 #4
0
 public void PlaceObject()
 {
     // Place objects on AR plane
     if (hits.Count > 0 || Input.GetKey(KeyCode.Space))
     {
         // placedObjects = FindObjectsOfType<PlacementObject>();
         //ChangeSelectedObject(lastSelectedObject);
         // lastSelectedObject.oriScale = lastSelectedObject.transform.localScale;
         ChangeSelectedObject(Instantiate(placePrefab, placementPose.position, placementPose.rotation).GetComponent <PlacementObject>());
         Debug.Log("Place instantiated");
         onObjectPrefabSelectedEvent.Raise(false);
     }
 }
예제 #5
0
        public void RemoveKey()
        {
            if (_unlocked || _paused)
            {
                return;
            }

            if (_currentInput.Value.Length > 0)
            {
                PlayClip(_removeClip);
                _currentInput.Value = _currentInput.Value.Remove(_currentInput.Value.Length - 1);
            }
            else
            {
                _attemptSuccesful.Raise(false);
                PlayClip(_incorrectClip);
            }
            _displayUpdate.Raise();
        }
예제 #6
0
 private void Update()
 {
     if (AllTargetsHit)
     {
         allTargetsHit.Value = true;
     }
     if (!_unlocked && allTargetsHit.Value)
     {
         finishedPuzzle.Raise(true);
         _unlocked = true;
     }
 }
예제 #7
0
            public override void OnInspectorGUI()
            {
                base.OnInspectorGUI();
                _invokeValue = EditorGUILayout.Toggle("Invoke value", _invokeValue);
                var buttonStyle = new GUIStyle(GUI.skin.button);

                buttonStyle.fontSize = 32;
                if (GUILayout.Button("Raise", buttonStyle, _buttonHeight))
                {
                    _target.Raise(_invokeValue);
                }
            }
예제 #8
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        GUI.enabled = Application.isPlaying;

        BoolEvent e = target as BoolEvent;

        if (GUILayout.Button("Raise"))
        {
            e.Raise(e.testRaiseData);
        }
    }
예제 #9
0
 void ChangeSelectedObject(PlacementObject selected)
 {
     placedObjects = FindObjectsOfType <PlacementObject>();
     foreach (PlacementObject cur in placedObjects)
     {
         MeshRenderer meshRenderer = cur.GetComponent <MeshRenderer>();
         if (selected != cur)
         {
             cur.IsSelected = false;
             // meshRenderer.material.color = inactiveColor;
             cur.GetComponent <Outline>().enabled = false;
         }
         else
         {
             lastSelectedObject = cur;
             cur.IsSelected     = true;
             // meshRenderer.material.color = activeColor;
             cur.GetComponent <Outline>().enabled = true;
             placementObjectEvent.Raise(cur);
             onObjectSelected.Raise(true);
         }
     }
     // uIManager.UpdateUIAccordingToSelectedObject();
 }
예제 #10
0
        void CheckCollisions()
        {
            //Use the OverlapBox to detect if there are any other colliders within this box area.
            Collider[] hitColliders    = Physics.OverlapBox(gameObject.transform.position, boxSize / 2, Quaternion.identity, cranePuzzleLayers);
            int        gapCollidersHit = 0;

            foreach (Collider col in hitColliders)
            {
                gapCollidersHit++;
            }

            // If colliding with both sides trigger the puzzle completed event
            if (gapCollidersHit == 2 && !_triggered)
            {
                _triggered = true;
                _cranePuzzleCompleted.Raise(true);
            }
        }
예제 #11
0
 public void DoAction()
 {
     onPickup.Raise(true);
     actionEvent.Raise(null);
     Destroy(gameObject);
 }
예제 #12
0
 private void ToggleMenu()
 {
     _menuOpen.Toggle();
     _pauseToggleEvent.Raise(_menuOpen.Value);
 }
예제 #13
0
    public void RiseOnChange()
    {
        onChange?.Raise(Value);

        m_CurrentValue = Value;
    }
예제 #14
0
 public void ToggleMute()
 {
     IsMuted = !IsMuted;
     AudioToggleEvent.Raise(IsMuted);
 }
        protected override void Triggered(Component other)
        {
            base.Triggered(other);

            Event.Raise(Random.value > 0.5f, Key);
        }
예제 #16
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     winEvent.Raise(true);
 }
예제 #17
0
파일: Room.cs 프로젝트: Fededark/GGJ_2019
 public void SetVisible(bool visible)
 {
     roomChange.Raise(visible);
 }