public override bool CastSpellServer(ConnectedPlayer caster, Vector3 clickPosition) { PortalSpawnInfo settings = PortalSpawnInfo.DefaultSettings(); settings.EntityRotate = false; // A rotated large rock doesn't look great on landing. var rockPortalSpawn = new SpawnByPortal(mainRockPrefab, portalPrefab, clickPosition, settings); rockPortalSpawn.OnObjectSpawned += (GameObject mainRock) => { mainRock.GetComponent <RegisterObject>().SetPassable(false, true); // Passable until it lands. }; rockPortalSpawn.OnObjectLanded += (GameObject mainRock) => { OnRockLanded(mainRock, 120); mainRock.GetComponent <RegisterObject>().SetPassable(false, false); }; StartCoroutine(SpawnSmallRocks(clickPosition)); return(true); }
/// <summary> /// <inheritdoc cref="SpawnByPortal"/> /// </summary> public SpawnByPortal(GameObject entityPrefab, GameObject portalPrefab, Vector3 worldPosition) { ServerSpawnPortalAndObject(entityPrefab, portalPrefab, worldPosition, PortalSpawnInfo.DefaultSettings()); }