/// <inheritdoc /> public IEntitySpawnResults TrySpawnEntity(IPlayerSpawnContext context) { //Grabs a spawn point from the spawn point service. Transform spawnTransform = PlayerSpawnStrategy.GetSpawnpoint(); return(this.TrySpawnEntity(spawnTransform.position, spawnTransform.rotation, context)); }
/// <inheritdoc /> protected override IEntitySpawnResults OnEntityConstructionCompleted([NotNull] IPlayerSpawnContext context, [NotNull] IEntitySpawnResults result) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (result == null) { throw new ArgumentNullException(nameof(result)); } //Check if the spawn was a success. If not we don't want to add information about it to the network services. if (result.Result != SpawnResult.Success) { return(result); } //TODO: Verify that none of this is in the services/collections all ready. MAJOR ISSUES if we are getting multiple of the same entity. EntityCollection.Add(context.EntityGuid, new EntityContainer(context.EntityGuid, result.EntityGameObject)); PeerCollection.Add(context.OwnerPeer); ConnectionRegistry.Register(context.OwnerPeer.PeerDetails.ConnectionID, context.EntityGuid); return(result); }
public IEntitySpawnResults TrySpawnEntity(Vector3 position, Quaternion rotation, Vector3 scale, IPlayerSpawnContext context) { IEntitySpawnResults results = TrySpawnEntity(position, rotation, context); if (results.Result == SpawnResult.Success) { results.EntityGameObject.transform.localScale = scale; } return(results); }
protected virtual IEntitySpawnResults OnEntityConstructionCompleted(IPlayerSpawnContext context, IEntitySpawnResults result) { //Access point that allows implementers of this type to extend the construction process. return(result); }
protected virtual IGameObjectContextualBuilder OnEntityConstruction(IPlayerSpawnContext context, IGameObjectContextualBuilder builder) { //Access point that allows implementers of this type to extend the construction process. return(builder); }
/// <inheritdoc /> public IEntitySpawnResults TrySpawnEntity(Vector3 position, Quaternion rotation, IPlayerSpawnContext context) { GameObject entityObject = OnEntityConstruction(context, GameobjectFactory.CreateBuilder().With(context)) .Create(NetworkPlayerPrefab, position, rotation); return(OnEntityConstructionCompleted(context, new DefaultEntitySpawnDetails(entityObject))); }