Example #1
0
        public static Monster Create(Entity domain, long id)
        {
            var monster = EntityFactory.CreateWithId <Monster>(domain, id);

            monster.BodyView = GameObject.Instantiate(PrefabHelper.GetUnitPrefab("Monster"));
            GameObject.DontDestroyOnLoad(monster.BodyView);
            return(monster);
        }
Example #2
0
        public static Unit Create(Entity domain, long id)
        {
            var go = UnityEngine.Object.Instantiate(PrefabHelper.GetUnitPrefab("OtherCharacter"));

            GameObject.DontDestroyOnLoad(go);
            var unit = EntityFactory.CreateWithId <Unit>(domain, id);

            unit.Awake(go);
            UnitComponent.Instance.Add(unit);
            return(unit);
        }
Example #3
0
        public static Unit Create(Entity domain, long id)
        {
            ResourcesComponent resourcesComponent = Game.Scene.GetComponent <ResourcesComponent>();
            GameObject         bundleGameObject   = (GameObject)resourcesComponent.GetAsset("Unit.unity3d", "Unit");
            GameObject         prefab             = bundleGameObject.Get <GameObject>("Skeleton");

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

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

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

            unitComponent.Add(unit);
            return(unit);
        }