コード例 #1
0
    public void TileHit(Vector2Int HitDirection, TileColor newColour)
    {
        inputColours.Add(newColour);

        //Update Output Colour
        outputColour = TileColor.CombineColors(inputColours.ToArray());


        if (lineRenderer != null)
        {
            lineRenderer.material.color = outputColour.ToColour();
        }

        RefreshingPaths();
    }
コード例 #2
0
ファイル: FilterTile.cs プロジェクト: DDewy/GGJ_2018
    void Start()
    {
        //Update Line Renderer with Output Colour
        if (lineRenderer == null)
        {
            if (transform.childCount > 0)
            {
                lineRenderer = transform.GetChild(0).GetComponent <LineRenderer>();
            }
        }

        if (lineRenderer != null)
        {
            lineRenderer.material.color = FilterColour.ToColour();
        }
    }
コード例 #3
0
    IEnumerator Start()
    {
        //Update Line Renderer with Output Colour
        if (lineRenderer == null)
        {
            if (transform.childCount > 0)
            {
                lineRenderer = transform.GetChild(0).GetComponent <LineRenderer>();
            }
        }

        if (lineRenderer != null)
        {
            lineRenderer.material.color = OutputColour.ToColour();
        }

        yield return(new WaitForSeconds(0.1f));

        creator.PathUpdated += UpdatePath;
        UpdatePath();
    }
コード例 #4
0
 private void Update()
 {
     outputColor  = tempColour.ToColour();
     outputString = tempColour.ToString();
 }
コード例 #5
0
ファイル: SplitterSatellite.cs プロジェクト: DDewy/GGJ_2018
    public void TileHit(Vector2Int HitDirection, TileColor inputColour)
    {
        //If we currently already have some lights hitting us then stop the new one.
        if (lightHitPaths[0] != null || lightHitPaths[1] != null)
        {
            return;
        }

        //why doesn't this get hit and debug, please tell me. It is your mission to find out

        //Tile Hit, Split that nigger
        Vector2Int[] outputDirection = new Vector2Int[2];

        //Calculate 135 Degrees and 225 Degrees
        outputDirection[0] = Satellite.RotateVec(HitDirection, -45f);
        outputDirection[1] = Satellite.RotateVec(HitDirection, 45f);

        //Get the Calculated Path
        lightHitPaths[0] = creator.LightBouncePositions(arrayPosition, outputDirection[0], inputColour);
        lightHitPaths[1] = creator.LightBouncePositions(arrayPosition, outputDirection[1], inputColour);

        //Set Line Render Color
        Color newColor = inputColour.ToColour();

        lineRenderers[0].material.color = newColor;
        lineRenderers[1].material.color = newColor;


        Vector3[][] lightPaths = new Vector3[lightHitPaths.Length][];

        for (int p = 0; p < lightHitPaths.Length; p++)
        {
            lineRenderers[p].positionCount = bInstantBeam ? 0 : lightHitPaths[p].Length;

            lightPaths[p] = new Vector3[lightHitPaths[p].Length];

            for (int i = 0; i < lightHitPaths[p].Length; i++)
            {
                lightPaths[p][i] = (Vector2)lightHitPaths[p][i].lightPosition;

                if (!bInstantBeam)
                {
                    continue;
                }

                lineRenderers[p].SetPosition(i, lightPaths[p][i]);

                if (lightHitPaths[p][i].hitTile != null)
                {
                    lightHitPaths[p][i].hitTile.TileHit(Utility.NormalizeVec2Int(lightHitPaths[p][i].lightPosition - lightHitPaths[p][i - 1].lightPosition), inputColour);
                }
            }
        }

        if (!bInstantBeam)
        {
            //Pass Path to a coroutine which travels each path
            for (int i = 0; i < lightHitPaths.Length; i++)
            {
                StartCoroutine(MoveLightBeam(i, lightPaths[i], inputColour));
            }
        }
    }