Example #1
0
 public Ship(ShipDirection direction, SquareType shipType)
 {
     ShipName   = shipType.ToString();
     Direction  = direction;
     SquareType = shipType;
     IsSunk     = false;
     Size       = ShipSize();
 }
Example #2
0
    // Creat Block
    public GameObject CreateSquare(SquareType type)
    {
        int        indexColor = Random.Range(0, colors.Length);
        GameObject prefab     = Resources.Load <GameObject>("Prefab/Square/" + type);

        if (prefab != null)
        {
            GameObject clone = Instantiate(prefab, view.CreatePoint) as GameObject;
            clone.name = type.ToString();

            clone.transform.position = view.CreatePoint.transform.position;
            currentShape             = clone.AddComponent <SquareControl>();
            currentShape.SetColor(colors[indexColor]);
            return(clone);
        }
        return(null);
    }
        public override string ToString()
        {
            var squareText = SquareType == SquareType.Empty ? "" : SquareType.ToString();

            return(String.Format("{0}: {1},{2}", squareText, X, Y));
        }