Ejemplo n.º 1
0
        public override void Dispose()
        {
            if (this.IsDisposed)
            {
                return;
            }
            base.Dispose();

            foreach (Ship ship in this.idShips.Values)
            {
                ship.Dispose();
            }

            this.idShips.Clear();

            Instance = null;
        }
Ejemplo n.º 2
0
        public static Ship Create(long id)
        {
            ResourcesComponent resourcesComponent = Game.Scene.GetComponent <ResourcesComponent>();
            GameObject         bundleGameObject   = (GameObject)resourcesComponent.GetAsset("Unit.unity3d", "Unit");
            //GameObject prefab = bundleGameObject.Get<GameObject>("Skeleton");
            GameObject prefab = bundleGameObject.Get <GameObject>("SpaceShip");

            ShipComponent shipComponent = Game.Scene.GetComponent <ShipComponent>();

            GameObject go   = UnityEngine.Object.Instantiate(prefab);
            Ship       ship = ComponentFactory.CreateWithId <Ship, GameObject>(id, go);

            //ship.AddComponent<AnimatorComponent>();
            //ship.AddComponent<MoveComponent>();
            //ship.AddComponent<TurnComponent>();
            //ship.AddComponent<UnitPathComponent>();

            shipComponent.Add(ship);
            return(ship);
        }
Ejemplo n.º 3
0
 public void Awake()
 {
     Instance = this;
 }