Example #1
0
    /*!
     * Add a reflection line with the specified Rotation on the specified face.
     *
     * \param cubemap The Cubemap to add to.
     * \param rotation Rotation of the reflection line
     * \param faces The Cubemap faces to add the line to.
     */

    public static void addReflectionlineToCubemap(Cubemap cubemap, float rotation, int lineWidth, params CubemapFace[] faces)
    {
        UnityDebug.assert(cubemap.width == cubemap.height, "Cubemap is not square!");

        foreach (CubemapFace face in faces)
        {
            var colors = cubemap.GetPixels(face);

            int middle = (cubemap.width / 2) - 1;

            var center = new int[] { middle, middle };

            var origStart = new int[] { middle, 0 };
            var newStart  = rotatePointAroundPoint2D(origStart, center, rotation);

            var origEnd = new int[] { middle, cubemap.height - 2 };
            var newEnd  = rotatePointAroundPoint2D(origEnd, center, rotation);

            LineDrawer.plotThickLineAA(newStart[0], newStart[1], newEnd[0], newEnd[1], lineWidth, delegate(int x, int y, float i) {
                colors[y * cubemap.width + (cubemap.width - 1 - x)] = new Color(i, i, i);
            });

            cubemap.SetPixels(colors, face);
        }

        if (faces.Length > 0)
        {
            cubemap.Apply();
        }
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        PhaseLoop();

        //Placed just after they've bought a city, make a new event:
        var gameEvent = new GameEvent("BUY_CITY", boughtCityValue);

        //Log it to the file
        UnityDebug.Log(gameEvent.ToJsonString());

        if (step == 1)
        {
            steps.StepOne();
        }

        else if (step == 2)
        {
            steps.StepTwo();
        }

        else if (step == 3)
        {
            steps.StepThree();
        }
        else
        {
            EndGame();
        }
        //myLogger.Log(EndGame, "");

        //foreach (var player in players)
        //{
        //    //Check if the game has been won:
        //    int playerScore = player.playerBuildings.Count;

        //    //Step Two trigger
        //    if (playerScore > 7)
        //        step = 2;
        //    //myLogger.Log(EndGame, "");

        //    //End game if needed
        //    if (playerScore > 17)
        //        EndGame();
        //    //myLogger.Log(EndGame, "");
        //}


        //if (Score >= 17)
        //{
        //    Endgame();
        //}

        //if (Score >= 17)
        //{
        //    Endgame();
        //}
    }
Example #3
0
        IEnumerator Start()
        {
            _requestUrl = null;
            // Wait for additional init.
            yield return(null);

#if UNITY_EDITOR
            if (string.IsNullOrEmpty(_trackerID))
            {
                Debug.LogWarning("GA.TrackerID not defined");
            }
#endif
            if (!string.IsNullOrEmpty(_trackerID))
            {
                _requestUrl = string.Format(
                    AnalyticsUrl,
                    _trackerID,
                    DeviceHash,
                    Screen.width, Screen.height,
                    Application.bundleIdentifier,
                    Application.version
                    );
            }

            string url  = null;
            string data = null;

            while (true)
            {
                if (_requests.Count > 0)
                {
                    data = _requests.Dequeue();
                    // If tracking id defined and url inited.
                    if (!string.IsNullOrEmpty(_requestUrl))
                    {
                        url = string.Format("{0}{1}&{2}&ul={3}",
                                            _requestUrl, UnityEngine.Random.Range(1, 99999), data, Localizer.Language);
                    }
                }

                if (url != null)
                {
                    UnityDebug.LogInfo("[GA REQUEST] " + url);

                    using (var www = new WWW(url)) {
                        yield return(www);
                    }
                    url = null;
                }
                else
                {
                    yield return(null);
                }
            }
        }
Example #4
0
 public static void Error(string message)
 {
     if (UseNewLogging)
     {
         QudDebug.buildLog.Error(Format(message));
     }
     else
     {
         UnityDebug.LogError(Format(message, "Error"));
     }
 }
Example #5
0
 public static void Info(string message)
 {
     if (UseNewLogging)
     {
         QudDebug.buildLog.Info(Format(message));
     }
     else
     {
         UnityDebug.Log(Format(message, "Info"));
     }
 }
Example #6
0
 private static void HookToUnityDebug()
 {
     try
     {
         UnityDebug.Enable();
     }
     catch (Exception ex)
     {
         CODebugBase <LogChannel> .Error(LogChannel.Core, ex.GetType().ToString() + " Message: " + ex.Message);
     }
 }
Example #7
0
 public static void Error(string message)
 {
     if (!PerformDebugging)
     {
         return;
     }
     if (UseNewLogging)
     {
         QudDebug.gameLog.Error(Format(message), EmptyArgs);
     }
     else
     {
         UnityDebug.LogError(Format(message, "Error"));
     }
 }
Example #8
0
 public static void Info(string message)
 {
     if (!PerformDebugging)
     {
         return;
     }
     if (UseNewLogging)
     {
         QudDebug.gameLog.Info(Format(message), EmptyArgs);
     }
     else
     {
         UnityDebug.Log(Format(message, "Info"));
     }
 }
 public void IsDisplayUnityDebugLog(bool isDisplay)
 {
     if (isDisplay)
     {
         if (unityDebugLogEventUnsubscriber == null)
         {
             unityDebugLogEventUnsubscriber = UnityDebug.Subscribe(consoleStringBuilder);
         }
     }
     else
     {
         if (unityDebugLogEventUnsubscriber != null)
         {
             unityDebugLogEventUnsubscriber.Dispose();
         }
     }
 }
Example #10
0
            static void Execute(Command command)
            {
                if (string.IsNullOrEmpty(command.delightedTexturePath))
                {
                    throw new Exception("-output must be defined");
                }

                var service = Delighting.NewService();

                var input = new Input()
                            .SetSwitchYZ(command.switchYZ)
                            .SetForceLocalDelighting(command.forceLocalDelighting)
                            .SetSeparateDarkAreas(command.separateDarkAreas)
                            .SetRemoveHighlights(command.removeHighlights)
                            .SetRemoveDarkNoise(command.removeDarkNoise);

                if (!string.IsNullOrEmpty(command.inputFolderPath))
                {
                    var loadOp = service.LoadInputFolderAsync(command.inputFolderPath);
                    loadOp.Execute();
                    if (loadOp.error != null)
                    {
                        var width  = 0;
                        var height = 0;
                        if (loadOp.data != null && loadOp.data.baseTexture != null)
                        {
                            width  = loadOp.data.baseTexture.width;
                            height = loadOp.data.baseTexture.height;
                        }
                        var errors = new List <string>();
                        DelightingHelpers.GetErrorMessagesFrom(((ProcessException)loadOp.error).errorCode, errors, width, height);
                        for (int i = 0; i < errors.Count; i++)
                        {
                            UnityDebug.LogError(errors[i]);
                        }

                        return;
                    }

                    input
                    .SetBaseTexture(loadOp.data.baseTexture)
                    .SetNormalsTexture(loadOp.data.normalsTexture)
                    .SetBentNormalsTexture(loadOp.data.bentNormalsTexture)
                    .SetAmbientOcclusionTexture(loadOp.data.ambientOcclusionTexture)
                    .SetPositionTexture(loadOp.data.positionTexture)
                    .SetMaskTexture(loadOp.data.maskTexture);

                    service.SetInput(loadOp.data);
                }
                else
                {
                    input
                    .SetBaseTexture(command.baseTexturePath)
                    .SetNormalsTexture(command.normalsTexturePath)
                    .SetBentNormalsTexture(command.bentNormalsTexturePath)
                    .SetAmbientOcclusionTexture(command.ambientOcclusionTexturePath)
                    .SetPositionTexture(command.positionTexturePath)
                    .SetMaskTexture(command.maskTexturePath);
                    service.SetInput(input);
                }

                var processOp = service.ProcessAsync(new ProcessArgs {
                    fromStep = ProcessStep.Gather, calculateResult = true
                });

                processOp.Execute();

                if (processOp.error != null)
                {
                    UnityDebug.LogException(processOp.error);
                    return;
                }

                var bytes = processOp.data.result.EncodeToPNG();

                File.WriteAllBytes(command.delightedTexturePath, bytes);
            }
 // Update is called once per frame
 void Update()
 {
     UnityDebug.DrawCapsule(transform.position, new Vector3(0, 0, 0), transform.localScale,
                            CapsuleDirection.YAxis, controller.radius, controller.height, Color.blue);
 }