Ejemplo n.º 1
0
        private IEnumerator SimulateAsyncOperationImpl()
        {
            float time           = randomTimeGenerator.Next();
            int   currentEventID = eventID;
            var   token          = stateTracker.StartState(eventID++);

            GLDebug.Log("Event Info", "Event started (" + currentEventID + ") and will finish in " + time + " seconds.");

            yield return(new WaitForSeconds(time));

            GLDebug.Log("Event Info", "Event stopped (" + currentEventID + ").");
            stateTracker.StopState(token);
        }
Ejemplo n.º 2
0
        private void ProcessInput()
        {
            if (Input.GetMouseButtonDown(0) ||
                Input.GetMouseButtonDown(1) ||
                Input.GetMouseButtonDown(2))
            {
                var ray = Camera.main.ScreenPointToRay(Input.mousePosition);

                RaycastHit hit;

                if (Physics.Raycast(ray, out hit))
                {
                    Vector3 worldPosition = transform.InverseTransformPoint(hit.point);

                    var gridPoint = Map[worldPosition];

                    GLDebug.Log(worldPosition);

                    if (Grid.Contains(gridPoint))
                    {
                        if (Input.GetMouseButtonDown(0))
                        {
                            GLDebug.Log(gridPoint);
                            SendMessageToGridAndCell(MousePosition, "OnLeftClick");
                            SendMessageToGridAndCell(MousePosition, "OnClick");
                        }

                        if (Input.GetMouseButtonDown(1))
                        {
                            SendMessageToGridAndCell(MousePosition, "OnRightClick");
                            SendMessageToGridAndCell(MousePosition, "OnClick");
                        }

                        if (Input.GetMouseButtonDown(2))
                        {
                            SendMessageToGridAndCell(MousePosition, "OnMiddleClick");
                            SendMessageToGridAndCell(MousePosition, "OnClick");
                        }
                    }
                }
            }
        }