public IEntitySpawnResults TrySpawnEntity(ISpawnContext context) { //Grabs a spawn point from the spawn point service. Transform spawnTransform = playerSpawnStrategy.GetSpawnpoint(); return(this.TrySpawnEntity(spawnTransform.position, spawnTransform.rotation, context)); }
public IEntitySpawnResults TrySpawnEntity(Vector3 position, Quaternion rotation, Vector3 scale, ISpawnContext context) { IEntitySpawnResults results = TrySpawnEntity(position, rotation, context); if (results.Result == SpawnResult.Success) { results.EntityGameObject.transform.localScale = scale; } return(results); }
public IEntitySpawnResults TrySpawnEntity(ISpawnContext context) { //We don't have spawn points so if a spawn is requested with just ID use defaults return(TrySpawnEntity(Vector3.zero, Quaternion.identity, context)); }
public IEntitySpawnResults TrySpawnEntity(Vector3 position, Quaternion rotation, ISpawnContext context) { GameObject playerGo = gameobjectFactory.CreateBuilder() .With(context) .Create(prefabProvider.GetPrefab(PrefabType.NetworkPlayer), position, rotation) as GameObject; return(new DefaultEntitySpawnDetails(playerGo)); }
/// <summary> /// Adds the <see cref="ISpawnContext"/> to the <see cref="IGameObjectContextualBuilder"/>. /// </summary> /// <param name="builder"></param> /// <param name="context"></param> /// <returns></returns> public static IGameObjectContextualBuilder With(this IGameObjectContextualBuilder builder, ISpawnContext context) { //Add the context and return the builder. return(context.ProvideContext(builder)); }
/// <summary> /// Creates a player entity in the instance world. /// </summary> /// <param name="position">Position of the entity.</param> /// <param name="rotation">Rotation of the entity.</param> /// <returns>A gameobject that represents the base player entity.</returns> public static IEntitySpawnResults SpawnPlayerEntity(this IPlayerEntityFactory factory, ISpawnContext context) { return(factory.TrySpawnEntity(context)); }
/// <summary> /// Creates a player entity in the instance world. /// </summary> /// <param name="position">Position of the entity.</param> /// <param name="rotation">Rotation of the entity.</param> /// <returns>A gameobject that represents the base player entity.</returns> public static IEntitySpawnResults SpawnPlayerEntity(this IPlayerEntityFactory factory, Vector3 position, Quaternion rotation, ISpawnContext context) { return(factory.TrySpawnEntity(position, rotation, context)); }