//External calls used by the other developers, I include may overloads for ease of use. /// <summary> /// Creates a random monster at random location /// </summary> public Monster CreateMonster() { string monsterName = GV.GetRandomElemFromArr <string>(monsterNames); Vector2 location = GV.GetRandomSpotInMap(); return(CreateMonster(monsterName, location, Ingredient.RandomIngredient())); }
public void Initialize() { vrCam = GameObject.FindObjectOfType <Cinemachine.CinemachineVirtualCamera>(); Vector2 playerpos = GV.GetRandomSpotInMap(); SpawnPlayerAtLoc(playerpos); SetupCauldron(playerpos); }
public static Monolith SpawnRandomMonolith() { GameObject monoObj = GameObject.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/Monolith/Monolith")); Monolith toRet = monoObj.GetComponent <Monolith>(); toRet.Initialize(); monoObj.transform.position = GV.GetRandomSpotInMap(); return(toRet); }
private Vector2 GetValidPlantLocation(Vector2 plantSize) { int attempts = 0; while (attempts < 100) { Vector2 randPlace = GV.GetRandomSpotInMap(); randPlace = new Vector2((int)randPlace.x, (int)randPlace.y); //making the map more like a grid RaycastHit2D rh = Physics2D.BoxCast(randPlace, plantSize, 0, new Vector2(), 0, plantPlacementLayerCheck); if (!rh) { return(randPlace); } attempts++; } Debug.Log("No place found for plant, returning null"); return(new Vector2(-1, -1)); }
/// <summary> /// Creates named monster at random location /// </summary> public Monster CreateMonster(string monsterName, Ingredient ingr) { Vector2 location = GV.GetRandomSpotInMap(); return(CreateMonster(monsterName, location, ingr)); }
public void PlayerDied() { SpawnPlayerAtLoc(GV.GetRandomSpotInMap()); }