public void AddActor(int whichActor, Vector2 pos) { // Adds an actor // Count and return if non-existant actor tried added if (whichActor < 0 || whichActor >= ActorBlueprints.Count) { Debug.Log("GameManager/AddActor: Actor does not exist"); NumNonExistantActorsAdded++; return; } if (pos.x < 0 || pos.x >= mapGen.placedWalls.GetLength(1) || pos.y < 0 || pos.y >= mapGen.placedWalls.GetLength(0)) { Debug.Log("GameManager/AddActor: Actor placed outside map"); NumActorsAddedOutsideMap++; return; } // Count and return if tried to add on static map part if (mapGen.IsWallAt((int)pos.x, (int)pos.y)) { Debug.Log("GameManager/AddActor: Actor placed on wall"); NumActorsAddedOnStatic++; return; } // Instantiate and add gameobject //ActorGameobjs.Add(Instantiate(ActorPrefab, new Vector3(pos.x + (mapGen.scaleFactor/2), pos.y + (mapGen.scaleFactor / 2), 0), Quaternion.identity) as GameObject); ActorGameobjs.Add(Instantiate(ActorPrefab, new Vector3(pos.x, pos.y, 0), Quaternion.identity) as GameObject); Actors.Add(ActorGameobjs.Last().GetComponent <Actor>()); Actors.Last().ID = NumActors; Actors.Last().Type = whichActor; Actors.Last().Setup(ActorBlueprints[whichActor], NumActors, pos, this); NumActors++; // Check if should replace event method with end if (Actors.Last().Type == EndEvents[0]) { Actors.Last().Methods[EndEvents[1]] = End.Do; Debug.Log(String.Format("GameManager/AddActor: End event added to actor #{0} on event {1}", Actors.Last().ID, EndEvents[1])); } // Tie events to methods/mechanics Debug.Log("GameManager/AddActor: Actor added"); }