Ejemplo n.º 1
0
        void LayoutEnemyObject(ref List <Vector2Int> emptyCells, EnemyPreset enemyPreset)
        {
            var cell = VExt.NextFromList(emptyCells);

            _world.RLCreateEnemy(cell, enemyPreset);

            emptyCells.Remove(cell);
        }
Ejemplo n.º 2
0
        public static void RLCreateEnemy(this EcsWorld world, Vector2 position, EnemyPreset enemyPreset)
        {
            var go = VExt.LayoutAnimationObject(ObjData.r_PrefabPhysicsAnimation, position, enemyPreset.PresetName, ObjData.t_GameObjectsRoot, SortingLayer.Character.ToString(), enemyPreset.Animation);
            var e  = world.NewEntityWithGameObject(go, true);

            e.Set <EnemyComponent>();
            var data = e.Set <NPCDataSheetComponent>();

            data.Stats           = new NPCStats(enemyPreset);
            data.PrimaryWeapon   = new NPCWeapon(enemyPreset.PrimaryWeaponItem, new WB_DamageOnContact());
            data.SecondaryWeapon = new NPCWeapon(enemyPreset.PrimaryWeaponItem, new WB_DamageOnContact());
            data.StatusEffects   = new List <StatusEffect>();
        }