/// <summary> /// When player exit, disable teleporters and kill ennemies (if any) to reduce lag and remove events /// </summary> public void PlayerExit() { TeleporterManager tpm = teleportersExit.GetComponent <TeleporterManager>(); tpm.SetPlayerHere(false); OnPlayerExit?.Invoke(this, EventArgs.Empty); }
private void InitTeleports(GameController.GameState gameState) { if (!teleporterManager) { teleporterManager = Instantiate <TeleporterManager>(teleporterManagerPrefab); teleporterManager.SetBoardManager(this); } }
/// <summary> /// When player enter, initialize the level and spawn ennemies /// </summary> public void PlayerEnter() { // Indicate teleporter manager that the player is here TeleporterManager tpm = teleportersExit.GetComponent <TeleporterManager>(); tpm.SetPlayerHere(true); tpm.SetLevelComplete(IsSublevelComplete, levelIndex); if (OnPlayerEnter == null) { tpm.EnableTeleporters(); } else { OnPlayerEnter?.Invoke(this, EventArgs.Empty); } }
/// <summary> /// Default Constructor. Initialize the teleporter manager <see cref="TM"/>, and import the maze from file. /// </summary> /// <param name="game">The game instance, different from <c>null</c></param> /// <param name="path">The path of the file where the maze data is stored. If it is empty, a default file is chosen</param> /// <exception cref="ArgumentNullException">Throw if <paramref name="game"/> is null</exception> public Maze(Game game, string path = "") : base(game) { if (game == null) { throw new ArgumentNullException(); } TM = new TeleporterManager(); Width = 0; Height = 0; if (path.Equals("")) { Path = "Resources/Maps/maze1.txt"; } else { Path = path; } Import(Path); this.Game.Components.Add(this); }
private void Start() { turnType = TurnType.Wating; teleporter = FindObjectOfType <TeleporterManager>(); }
void Start() { teleporterManager = GameObject.FindGameObjectWithTag("Teleporters").GetComponent <TeleporterManager>(); gem = GameObject.FindGameObjectWithTag("Gem").GetComponent <Gem>(); gameObject.SetActive(false); }
private void Awake() { boxCollider = GetComponent <BoxCollider2D>(); initialScale = transform.localScale; teleporterManager = transform.parent.GetComponent <TeleporterManager>(); }