Beispiel #1
0
 public Planet(string name)
 {
     TilesX = Random.Range(minTile, maxTile + 1);
     TilesY = Random.Range(minTile, maxTile + 1);
     tiles  = new PlanetTile[TilesX, TilesY];
     for (int x = 0; x < TilesX; x++)
     {
         for (int y = 0; y < TilesY; y++)
         {
             tiles[x, y] = new PlanetTile();
         }
     }
 }
Beispiel #2
0
    public void ReturnToScrapyard()
    {
        if (mTilePlacedOn != null)
        {
            mTilePlacedOn.occupyingShip = null;
        }

        mTilePlacedOn = null;

        Reconfigure();

        AllianceBelongingTo.ScrapyardRef.AddShip(this);
    }
Beispiel #3
0
    /// <summary>
    /// Deploys ship to given tile, like move, but not use up an MP
    /// </summary>
    /// <param name="tile">Tile.</param>
    public void DeployToTile(PlanetTile tile)
    {
        // delete reference on old tile
        if (mTilePlacedOn != null)
        {
            mTilePlacedOn.occupyingShip = null;
        }

        // set reference and pos on new tile
        mTilePlacedOn               = tile;
        mPlanetPlacedOn             = tile.planetBelongingTo;
        mTilePlacedOn.occupyingShip = this;
        transform.localPosition     = new Vector3(tile.transform.localPosition.x + mPlanetPlacedOn.WorldPos.x * 6, tile.transform.localPosition.y + mPlanetPlacedOn.WorldPos.y * 6, 0);

        AllianceBelongingTo.ScrapyardRef.RemoveShip(this);
    }
Beispiel #4
0
    /// <summary>
    /// Moves ship to given tile
    /// </summary>
    /// <param name="tile">Tile.</param>
    public void MoveToTile(PlanetTile tile)
    {
        // delete reference on old tile
        if (mTilePlacedOn != null)
        {
            mTilePlacedOn.occupyingShip = null;
        }

        // set reference and pos on new tile
        mTilePlacedOn               = tile;
        mPlanetPlacedOn             = tile.planetBelongingTo;
        mTilePlacedOn.occupyingShip = this;
        transform.localPosition     = new Vector3(tile.transform.localPosition.x + mPlanetPlacedOn.WorldPos.x * 6, tile.transform.localPosition.y + mPlanetPlacedOn.WorldPos.y * 6, 0);

        // reduce Movement Points left by 1
        if (mMPLeft > 0)
        {
            mMPLeft -= 1;
        }
    }
Beispiel #5
0
 public void GetInfo(PlanetTile _tile)
 {
     gridPanel.GetInfo(_tile);
 }
Beispiel #6
0
 public void GetInfo(PlanetTile _tile)
 {
     tile = _tile;
 }