Exemplo n.º 1
0
    public static void SpawnPopUpText(string text, Vector3 position, PopColor toSet)
    {
        GameObject popUp = Resources.Load("PopUpText") as GameObject;

        GameObject instance = Instantiate(popUp, new Vector3(position.x, position.y + .5f, position.z), Quaternion.identity);

        instance.GetComponentInChildren <Text>().text = text;

        if (toSet == PopColor.red)
        {
            instance.GetComponentInChildren <Text>().color = new Color32(0xAA, 0x44, 0x65, 0xFF);
        }
        else if (toSet == PopColor.green)
        {
            instance.GetComponentInChildren <Text>().color = new Color32(0x96, 0xE0, 0x72, 0xFF);
        }
    }
Exemplo n.º 2
0
    void OutputResult(int xb, int yb, PointHit?Hit)
    {
        var SetBWidth  = RaySetB.FrameColour.width;
        var SetBHeight = RaySetB.FrameColour.height;

        if (!BestHitOutput)
        {
            BestHitOutput = new Texture2D(SetBWidth, SetBHeight, TextureFormat.RGBA32, false);
        }

        if (Hit.HasValue)
        {
            OnBestHitFound.Invoke(Hit.Value.Position);
        }

        //	output colour
        Color Rgba = Color.black;

        if (Hit.HasValue)
        {
            Debug.Log(Hit.Value.Position);
            if (OutputDistance)
            {
                var DistanceNorm = Hit.Value.Distance / MaxDistance;
                if (DistanceNorm > 1)
                {
                    DistanceNorm = 1;
                }
                Rgba = PopColor.NormalToRedGreenClamped(DistanceNorm);
            }
            else
            {
                Rgba.r = Hit.Value.Position.x;
                Rgba.g = Hit.Value.Position.y;
                Rgba.b = Hit.Value.Position.z;
            }
            Rgba.a = 1;
        }
        BestHitOutput.SetPixel(xb, yb, Rgba);
        //BestHitOutput.Apply(false,false);
        //OnHitOutput.Invoke(BestHitOutput);
    }