private void Start() { this.grid = this.gridObject.GetComponent <GridManagerScript>(); this.startingPosition = transform.position; this.ship = new ShipUnity(transform.gameObject.name, int.Parse(transform.gameObject.name.ElementAt(4).ToString()), -1, -1); transform.parent.gameObject.GetComponent <ShipManager>().InstantiateShip(this.ship); }
public void InstantiateShip(ShipUnity ship) { if (this.shipsUnity == null) { this.shipsUnity = new List <ShipUnity>(); } this.shipsUnity.Add(ship); }
public void UpdateShipList(ShipUnity ship) { this.shipsUnity.ElementAt(this.shipsUnity.IndexOf(ship)).PosX = ship.PosX; this.shipsUnity.ElementAt(this.shipsUnity.IndexOf(ship)).PosY = ship.PosY; this.shipsUnity.ElementAt(this.shipsUnity.IndexOf(ship)).Rotated = ship.Rotated; }