public override void RaisePillars(TileSolution.PillarLocation pillarLocation, int[] tilePillar)
 {
     //HACK to stop pillars from moving on load
     if (!StopFirstMovement)
     {
         this.raisePillars(pillarLocation, tilePillar);
     }
 }
Ejemplo n.º 2
0
    public bool CheckForColorChange(GameObject[] tilesToCheck, TileSolution.PillarLocation pillarLocation, int[] tilePillars)
    {
        //TODO see if tileTocheck.Length can replace 4
        Color[] tilesColorToCheck = new Color[4];
        tilesColorToCheck = assignCheckedColors(tilesToCheck, tilePillars);

        //TODO Remove and replace with below if works.

        if (tilePillars.Length == 0)
        {
            prevColorClass[(int)pillarLocation].InitialColorToCheck(tilesColorToCheck);
        }
        else
            prevColorClass[(int)pillarLocation].InitialColorToCheck(tilesColorToCheck);

        for (int i = 0; i < tilesColorToCheck.Length; i++)
        {
            //Add pillarLocation back if i in prevColorClass doesn't work.
            if (prevColorClass[(int)pillarLocation].PrevColorToCheck[i] == tilesColorToCheck[i])
            {
                if (i == (tilesColorToCheck.Length - 1))
                {
                    return true;
                }
                else if (tilePillars.Length == 1 && i == 0)
                {
                    return true;
                }
            }
            else
            {
                prevColorClass[(int)pillarLocation].SetPrevColor(tilesColorToCheck);

                return false;
            }

        }
        return false;
    }
Ejemplo n.º 3
0
 public virtual void RaisePillars(TileSolution.PillarLocation pillarLocation, int[][] tilePillars)
 {
     raisePillars(pillarLocation, tilePillars[(int)pillarLocation]);
 }
Ejemplo n.º 4
0
 //Have multiple observers and one subject
 void Awake()
 {
     tileSolution = GameObject.Find("Tiles").GetComponent<TileSolution>();
     tileSolution.Attach(this);
     tileSolution.Notify();
     //TODO add in detach after object has attached.
 }
Ejemplo n.º 5
0
    //TODO Remove PillarLocaion if you can think of it.
    protected virtual void raisePillars(TileSolution.PillarLocation pillarLocation, int[] tilePillar)
    {
        switch (pillarLocation)
        {
            case TileSolution.PillarLocation.FIRST:
                if (colorManager.CheckForColorChange(tilesToCheck, pillarLocation, tilePillar))
                {
                    raisePillarToHeight(Pillars[0], heights[(int)TileSolution.PillarLocation.FIRST]);
                }

                break;
            case TileSolution.PillarLocation.SECOND:
                if (colorManager.CheckForColorChange(tilesToCheck, pillarLocation, tilePillar))
                    raisePillarToHeight(Pillars[1], heights[(int)TileSolution.PillarLocation.SECOND]);
                break;
            case TileSolution.PillarLocation.THIRD:
                if (colorManager.CheckForColorChange(tilesToCheck, pillarLocation, tilePillar))
                    raisePillarToHeight(Pillars[2], heights[(int)TileSolution.PillarLocation.THIRD]);
                break;
            case TileSolution.PillarLocation.FOURTH:
                if (colorManager.CheckForColorChange(tilesToCheck, pillarLocation, tilePillar))
                    raisePillarToHeight(Pillars[3], heights[(int)TileSolution.PillarLocation.FOURTH]);
                break;
            default:
                break;
        }
    }
 public override void RaisePillars(TileSolution.PillarLocation pillarLocation, int[][] tilePillars)
 {
     if(!this.StopFirstMovement)
         raisePillars(pillarLocation, tilePillars[(int)pillarLocation]);
 }