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

            foreach (Unit unit in this.idUnits.Values)
            {
                unit.Dispose();
            }

            this.idUnits.Clear();

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

            MonsterUnitComponent unitComponent = Game.Scene.GetComponent <MonsterUnitComponent>();

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

            unit.AddComponent <AnimatorComponent>();
            unit.AddComponent <MoveComponent>();
            unit.AddComponent <TurnComponent>();
            unit.AddComponent <UnitPathComponent>();

            unitComponent.Add(unit);
            return(unit);
        }
Exemplo n.º 3
0
 public void Awake()
 {
     Instance = this;
 }