Exemplo n.º 1
0
 private void MeetIsland(OceanIsland island, bool isRandom)
 {
     activeIsland   = island;
     isIslandRandom = isRandom;
     SetInteractableObject(activeIsland);
     ToggleWindowVisibility(true);
 }
Exemplo n.º 2
0
 private void FixedUpdate()
 {
     if (swimming)
     {
         Vector3 boatPosition = activeMovement.GetPosition();
         if (activeIsland)
         {
             float distance = (boatPosition - activeIsland.transform.position).magnitude;
             if (distance > islandInteractionDistance)
             {
                 LeaveIsland();
             }
         }
         else
         {
             OceanIsland island = map.GetIslandByCoordinates(boatPosition);
             nearIsland = island;
             if (nearIsland)
             {
                 float distance = (boatPosition - island.transform.position).magnitude;
                 if (distance < islandInteractionDistance)
                 {
                     MeetIsland(island, false);
                 }
             }
         }
         float magnitude = (boatPosition - prevBoatPosition).magnitude;
         currentDaytime += magnitude;
         if (currentDaytime > dayLength)
         {
             EndDay();
         }
         prevBoatPosition = boatPosition;
     }
 }
Exemplo n.º 3
0
 private void LeaveIsland()
 {
     DropInteractableObject();
     if (isIslandRandom)
     {
         Destroy(activeIsland.gameObject);
     }
     activeIsland = null;
 }
Exemplo n.º 4
0
    public OceanIsland CreateIsland(int day, int gearScore, bool isTrading, Vector3 position)
    {
        GameObject islandObject;

        if (isTrading)
        {
            islandObject = Instantiate(tradingIslandMapPrefabs[Random.Range(0, tradingIslandMapPrefabs.Length)], position, Quaternion.identity);
        }
        else
        {
            islandObject = Instantiate(resourceIslandMapPrefabs[Random.Range(0, resourceIslandMapPrefabs.Length)], position, Quaternion.identity);
        }
        islandObject.name = possibleNames[Random.Range(0, possibleNames.Length)];
        OceanIsland island = islandObject.AddComponent <OceanIsland>();

        island.islandType = isTrading ? IslandTypes.Trading : IslandTypes.Resource;
        int value = day * gearScore;

        if (value > 100)
        {
            island.value = 2;
        }
        else if (value > 20)
        {
            island.value = 1;
        }
        else
        {
            island.value = 0;
        }
        if (isTrading)
        {
            island.surfaceIsland = tradingIslandPatterns[Random.Range(0, tradingIslandPatterns.Length)].CreateIsland();
        }
        else
        {
            island.surfaceIsland = resourceIslandPatterns[Random.Range(0, resourceIslandPatterns.Length)].CreateIsland();
        }
        return(island);
    }