private void spawnObjectsInBackground(int totalObjNumber) { // Per ogni oggetto di indice objInd... for (int objInd = 1; objInd <= totalObjNumber; objInd++) { // Scegli un oggetto random GameObject obj = this.backgroundObjects[Random.Range(0, this.backgroundObjects.Count)]; IslandController objController = obj.GetComponent <IslandController>(); // Attribuisci proprietà random objController.position = new Vector3(Random.Range(-500, 500), Random.Range(-100, 100), Random.Range(this.minDistance, this.maxDistance)); Vector3 rotation = new Vector3(359f, 359f, 359f); if (Random.Range(0f, 1f) >= 0.5f) { rotation += new Vector3(-719f, 0f, 0f); } if (Random.Range(0f, 1f) >= 0.5f) { rotation += new Vector3(0, -719f, 0f); } if (Random.Range(0f, 1f) >= 0.5f) { rotation += new Vector3(0, 0f, -719f); } objController.rotation = rotation; objController.rotationSpeed = Random.Range(1f, maxRotationSpeed); int objectSize = Random.Range(1, this.maxScalingFactor); objController.size = new Vector3(objectSize, objectSize, objectSize); Instantiate(obj); } }
private void RemovePlayerFromFerry(IslandController island) { state = PlayerFerryState.None; var onFerry = OnFerry; if (onFerry) { player.transform.SetParent(null); player.transform.position = island.DockingArea.DockPosition; } player.Island = island ?? gameManager.Islands.FindPlayerIsland(player); player.Unlock(); if (player.Chunk != null) { player.GotoClosest(player.Chunk.ChunkType); } if (onFerry) { gameManager.Server?.Client?.SendCommand( player.PlayerName, "ferry_success", $"You have disembarked the ferry."); } }
// Start is called before the first frame update void Start() { arenaStartTimer = arenaStartTime; if (!gameCamera) { gameCamera = GameObject.FindObjectOfType <GameCamera>(); } island = GetComponentInParent <IslandController>(); }
// Start is called before the first frame update void Start() { var arena = GetComponentInChildren <ArenaController>(); Island = GetComponentInParent <IslandController>(); task = GetChunkTask(arena, Type); if (SecondaryType != TaskType.None) { secondaryTask = GetChunkTask(arena, SecondaryType); } var enemyContainer = gameObject.transform.Find("Enemies"); if (enemyContainer) { enemies = enemyContainer.GetComponentsInChildren <EnemyController>(); } var treeContainer = gameObject.transform.Find("Trees"); if (treeContainer) { trees = treeContainer.GetComponentsInChildren <TreeController>(); } var fishingContainer = gameObject.transform.Find("Fishingspots"); if (fishingContainer) { fishingSpots = fishingContainer.GetComponentsInChildren <FishingController>(); } var miningContainer = gameObject.transform.Find("Rocks"); if (miningContainer) { miningSpots = miningContainer.GetComponentsInChildren <RockController>(); } var craftingStationContainer = gameObject.transform.Find("CraftingStations"); if (craftingStationContainer) { craftingStations = craftingStationContainer.GetComponentsInChildren <CraftingStation>(); } var farmingPatchesContainer = gameObject.transform.Find("FarmingPatches"); if (farmingPatchesContainer) { farmingPatches = farmingPatchesContainer.GetComponentsInChildren <FarmController>(); } }
public IReadOnlyList <IChunk> GetChunksOfType(IslandController island, TaskType type) { if (chunks == null || chunks.Length == 0) { return(null); } return(chunks .Where(x => x.Island == island && (x.Type == type || x.SecondaryType == type)) .OrderByDescending(x => x.RequiredCombatLevel + x.RequiredSkilllevel) .Select(x => x.SecondaryType == type ? x.CreateSecondary() : x).ToList()); }
private void SetupIsland(string islansSide) { switch (islansSide) { case "left": playerIsland = GameObject.Find("LeftIsland").GetComponent <IslandController>(); break; case "right": playerIsland = GameObject.Find("RightIsland").GetComponent <IslandController>(); break; default: GameManager.instance.PlayErrorSound(false); break; } }
public void AddToRaiderTeam(PlayerController player) { if (Started || !player) { return; } lock (mutex) { raiders.Add(player); if (!raidWarIsland) { raidWarIsland = gameManager.Islands.Find("war"); } oldPlayerPosition[player.UserId] = gameManager.Chunks.GetStarterChunk().GetPlayerSpawnPoint(); player.Teleporter.Teleport(raidWarIsland.RaiderSpawningPoint.position); player.StreamRaid.OnEnter(); } }
public void AddToStreamerTeam(PlayerController player) { if (Started) { return; } lock (mutex) { defenders.Add(player); if (!raidWarIsland) { raidWarIsland = gameManager.Islands.Find("war"); } oldPlayerPosition[player.UserId] = player.transform.position; player.Teleporter.Teleport(raidWarIsland.StreamerSpawningPoint.position); player.StreamRaid.OnEnter(); } }
public void IslandExit() { island = null; }
public void IslandEnter(IslandController island) { this.island = island; }
public void Disembark(IslandController destination = null) { state = PlayerFerryState.Disembarking; this.destination = destination; }
public void Embark(IslandController destination = null) { player.Animations.ResetAnimationStates(); state = PlayerFerryState.Embarking; this.destination = destination; }
public void connectIsland(IslandController island) { childIslands.Add(island); }
public void setParent(IslandController island) { parentIsland = island; }
public void disconnectIsland(IslandController island) { if (parentIsland == island) { parentIsland = null; } else { childIslands.Remove(island); } }