コード例 #1
0
 //hit the closest alien with a laser
 void fireLaser(Tile.States state)
 {
     if (currentAlien != null)
     {
         currentAlien.TakeHit(state);
     }
 }
コード例 #2
0
    public static Color TileStateToColor(Tile.States state)
    {
        switch (state)
        {
        case Tile.States.NONE:
            return(Color.None);

        case Tile.States.SET:
            return(Color.Red);

        case Tile.States.SHAPEANIMATION:
            return(Color.Red);

        case Tile.States.FLIP:
            return(Color.Purple);

        case Tile.States.RED:
            return(Color.Red);

        case Tile.States.ORANGE:
            return(Color.Orange);

        case Tile.States.YELLOW:
            return(Color.Yellow);

        case Tile.States.GREEN:
            return(Color.Green);

        case Tile.States.BLUE:
            return(Color.Blue);

        case Tile.States.PURPLE:
            return(Color.Purple);

        case Tile.States.WHITE:
            return(Color.White);

        case Tile.States.SELECTOR:
            return(Color.Green);

        case Tile.States.NOTE:
            return(Color.Blue);

        case Tile.States.NOTEBAROFF:
            return(Color.Red);

        case Tile.States.NOTEBARON:
            return(Color.Purple);

        case Tile.States.MOLE:
            return(Color.Red);

        default:
            break;
        }

        return(Color.None);
    }
コード例 #3
0
 public void TakeHit(Tile.States state)
 {
     if (state == listOfShields[currentShield])
     {
         if (currentShield == 0)
         {
             isAlive = false;
             Destroy(this.gameObject);
         }
         else
         {
             currentShield--;
             setColor(listOfShields[currentShield]);
         }
     }
 }
コード例 #4
0
    Tile spawnLaser(Tile.States state)
    {
        allTiles = floor.getAllTiles();
        for (int i = allTiles.Count - 1; i >= 0; i--)          //remove all spots where there is a mole or player
        {
            if (allTiles[i].isPlayerHere() ||
                allTiles[i].myState == Tile.States.GREEN ||
                allTiles[i].myState == Tile.States.BLUE ||
                allTiles[i].myState == Tile.States.RED)
            {
                allTiles.RemoveAt(i);
            }
        }

        int randomTile = Random.Range(0, allTiles.Count);

        allTiles[randomTile].myState = state;
        return(allTiles[randomTile]);
    }
コード例 #5
0
    void setColor(Tile.States state)
    {
        switch (state)
        {
        case Tile.States.GREEN:
            mr.material = materials[0];
            break;

        case Tile.States.BLUE:
            mr.material = materials[1];
            break;

        case Tile.States.RED:
            mr.material = materials[2];
            break;

        default:
            break;
        }
    }
コード例 #6
0
 public void setTile(int x, int z, Tile.States state)
 {
     tiles[x, z].myState = state;
 }