Advertisement
shadowplaycoding

P019_FleetManager

Apr 29th, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.31 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5.  
  6. public class FleetManager : MonoBehaviour {
  7.  
  8.     public List<Fleet> fleetList;
  9.  
  10.     public Dictionary<Fleet, GameObject> fleetToObjectMap;
  11.  
  12.     int shipCount;
  13.  
  14.     // Use this for initialization
  15.     void Start () {
  16.         fleetList = new List<Fleet>();
  17.         fleetToObjectMap = new Dictionary<Fleet, GameObject>();
  18.     }
  19.  
  20.     public void BuildShip()
  21.     {
  22.         Ship ship = new Ship("Ship " + shipCount, 10, 10);
  23.         Fleet fleet = new Fleet("Fleet " + (fleetList.Count + 1), ship);
  24.  
  25.         fleetList.Add(fleet);
  26.  
  27.         GameObject shipObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
  28.         shipObject.transform.position = PositionMath.RandomPosition(-50, 50);
  29.         shipObject.transform.parent = this.transform;
  30.  
  31.         fleetToObjectMap.Add(fleet, shipObject);
  32.     }
  33.  
  34.     public void DestroyShip()
  35.     {
  36.  
  37.     }
  38.  
  39.     public void DisableFleets()
  40.     {
  41.         this.gameObject.SetActive(false);
  42.     }
  43.  
  44.     public void EnableFleets()
  45.     {
  46.         this.gameObject.SetActive(true);
  47.     }
  48.  
  49.     /*
  50.     Copyright Shadowplay Coding 2017 - see www.shadowplaycoding.com for licensing details
  51.     Removing this comment forfits any rights given to the user under licensing.
  52.     */
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement