public void Init(OceanManager manager, Vector2Int WorldGridPosition, IslandGenerator Generator) { this.Ocean = manager; this.WorldGridPosition = WorldGridPosition; this.Generator = Generator; this.Chunks = new List <GameObject>(); this.CollidersToUpdate = new List <GameObject>(); transform.position = new Vector3(WorldGridPosition.x * manager.OneGridPointToWorld, 0, WorldGridPosition.y * manager.OneGridPointToWorld); Generator.SetupIslandForGeneration(this); Generate(Generator.GetSeed()); }
public bool IsIsland(int GridX, int GridY, OceanManager manager) { float noiseFactor = noise.GetSimplex((GridX + 50) * OceanScale, (GridY + 13) * OceanScale) + 0.5f; if(noiseFactor > OceanThreshold) { //check if it is not going to collide with other islands foreach(Island island in manager.Islands) { float dst = Vector2.Distance(new Vector2(GridX, GridY), island.WorldGridPosition); if(dst * manager.OneGridPointToWorld < island.Size * 2) { return false; } } return true; } return false; }
void OnDestroy() { OceanManager.RemoveFishHome(this.gameObject); }
// Start is called before the first frame update void Start() { oceanManager = GetComponentInParent <OceanManager>(); width = oceanManager.width; ChangeFloorWidth(); }
void Awake() { instance = this; allFishHomes = new List <GameObject>(); }