Kill Player on win
This commit is contained in:
parent
8ffc34f2d0
commit
db72c6a707
3 changed files with 6 additions and 3 deletions
|
@ -976,7 +976,7 @@ Prefab:
|
||||||
- target: {fileID: 224150154901314796, guid: 460d856ea4eb14cedb5fecde1fe6d743,
|
- target: {fileID: 224150154901314796, guid: 460d856ea4eb14cedb5fecde1fe6d743,
|
||||||
type: 2}
|
type: 2}
|
||||||
propertyPath: m_AnchoredPosition.x
|
propertyPath: m_AnchoredPosition.x
|
||||||
value: 65.89836
|
value: 63.233368
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 224150154901314796, guid: 460d856ea4eb14cedb5fecde1fe6d743,
|
- target: {fileID: 224150154901314796, guid: 460d856ea4eb14cedb5fecde1fe6d743,
|
||||||
type: 2}
|
type: 2}
|
||||||
|
|
|
@ -55,6 +55,6 @@ public class Player : Mob {
|
||||||
protected override void Death() {
|
protected override void Death() {
|
||||||
Debug.Log("Player died...");
|
Debug.Log("Player died...");
|
||||||
Destroy(this.gameObject);
|
Destroy(this.gameObject);
|
||||||
GameController.instance.ChangeState(GameController.GameState.ENDED);
|
GameController.instance.EndGame(GameController.EndedCause.DIED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,7 +300,8 @@ public class GameController : MonoBehaviour {
|
||||||
cam.GetComponent<AudioControl>().GameOverBgm();
|
cam.GetComponent<AudioControl>().GameOverBgm();
|
||||||
ui.GetComponent<UIController>().ShowGameOverUI();
|
ui.GetComponent<UIController>().ShowGameOverUI();
|
||||||
} else if(endCause == EndedCause.WIN) {
|
} else if(endCause == EndedCause.WIN) {
|
||||||
//cam.GetComponent<AudioControl>().SfxPlay(2);
|
//cam.GetComponent<AudioControl>().SfxPlay(2);
|
||||||
|
player.InflictDamage(int.MaxValue/2);
|
||||||
ui.GetComponent<UIController>().ShowWinUI();
|
ui.GetComponent<UIController>().ShowWinUI();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -325,6 +326,8 @@ public class GameController : MonoBehaviour {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EndGame(EndedCause cause) {
|
public void EndGame(EndedCause cause) {
|
||||||
|
if (endCause != null && state == GameState.ENDED)
|
||||||
|
return; // Already ended game
|
||||||
endCause = cause;
|
endCause = cause;
|
||||||
ChangeState(GameState.ENDED);
|
ChangeState(GameState.ENDED);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue