public void SetCheckpoint() { LevelCheckpoint levelState = new LevelCheckpoint(); levelState.state = sequencer.curState; levelState.curWave = mCurWave; levelState.playerScore = UIManager.instance.hud.score.score; levelState.playerPlanetPos = mPlayer.planetAttach.planetPos; Main.instance.sceneManager.SetCheckPoint(levelState); }
protected override void Awake() { mPlayer = GetComponentInChildren <Player>(); mPlanet = GetComponentInChildren <Planet>(); if (mCheckpoint != null) { mCurWave = mCheckpoint.curWave; mScore = mCheckpoint.playerScore; mPlayer.SetCheckpoint(mCheckpoint); mCheckpoint = null; } base.Awake(); }
void OnTriggerEnter2D(Collider2D hitObject) { Enemy obj = hitObject.GetComponent <Enemy>(); if (obj != null) { this.takeDamage(obj.damageWhenHit); } LevelCheckpoint checkpoint = hitObject.GetComponent <LevelCheckpoint>(); if (checkpoint != null) { string nextSceneName = "scene1"; // Change this to the according level/name checkpoint.nextLevel(nextSceneName); } OutOfBounds bound = hitObject.GetComponent <OutOfBounds>(); if (bound != null) { this.Die(); } }
public override void OnCheckPoint(SceneCheckpoint point) { base.OnCheckPoint(point); mCheckpoint = (LevelCheckpoint)point; }
protected override void Awake() { mPlayer = GetComponentInChildren<Player>(); mPlanet = GetComponentInChildren<Planet>(); if(mCheckpoint != null) { mCurWave = mCheckpoint.curWave; mScore = mCheckpoint.playerScore; mPlayer.SetCheckpoint(mCheckpoint); mCheckpoint = null; } base.Awake(); }