コード例 #1
0
        public void Spawn(IEntity entity, Coords at)
        {
            if (entities.ContainsKey(entity))
            {
                Debug.LogWarning(Warnings.EntityAlreadyPresent(entity));
                return;
            }

            var prefab   = assetLoaders.EntityType.Get(entity.Type);
            var position = tilemap.GetCellCenterWorld(at.ToCell());
            var parent   = entitiesParent;
            var entityGO = GameObject.Instantiate(prefab, position, Quaternion.identity, parent);

            entityGO.name = entity.Name;
            entities.Add(entity, entityGO);
        }