mirror of
https://github.com/ConjureETS/PixelSphinx.git
synced 2026-03-25 02:50:58 +00:00
win check
This commit is contained in:
parent
66e19edb03
commit
9753ed511b
@ -7,7 +7,7 @@ public class Astronaut : MonoBehaviour {
|
|||||||
private AstronautAnimator _astronautAnimator;
|
private AstronautAnimator _astronautAnimator;
|
||||||
public enum AstronautState
|
public enum AstronautState
|
||||||
{
|
{
|
||||||
Idle, Walking, Jumping, Dashing, Ejecting, Dead
|
Idle, Walking, Jumping, Dashing, Stun, Ejecting, Dead
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameObject Rotator;
|
public GameObject Rotator;
|
||||||
@ -93,6 +93,7 @@ public class Astronaut : MonoBehaviour {
|
|||||||
{
|
{
|
||||||
planet = FindObjectOfType<PlanetManager>();
|
planet = FindObjectOfType<PlanetManager>();
|
||||||
}
|
}
|
||||||
|
planet.addPlayer();
|
||||||
|
|
||||||
State = AstronautState.Idle;
|
State = AstronautState.Idle;
|
||||||
theta = 0;
|
theta = 0;
|
||||||
@ -290,6 +291,8 @@ public class Astronaut : MonoBehaviour {
|
|||||||
vSpeed = EjectSpeed;
|
vSpeed = EjectSpeed;
|
||||||
_astronautAnimator.Eject();
|
_astronautAnimator.Eject();
|
||||||
grounded = false;
|
grounded = false;
|
||||||
|
|
||||||
|
planet.playerDeath(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -297,7 +300,7 @@ public class Astronaut : MonoBehaviour {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Stun()
|
public void Stun()
|
||||||
{
|
{
|
||||||
print("Stunned");
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnGUI()
|
public void OnGUI()
|
||||||
|
|||||||
@ -18,9 +18,11 @@ public class PlanetManager : MonoBehaviour
|
|||||||
private float disbalance = 0f;
|
private float disbalance = 0f;
|
||||||
public GameObject WedgePrefab = null;
|
public GameObject WedgePrefab = null;
|
||||||
public List<Wedge> wedges = new List<Wedge>();
|
public List<Wedge> wedges = new List<Wedge>();
|
||||||
|
private int numPlayer;
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
public void Awake () {
|
public void Awake () {
|
||||||
|
numPlayer = 0;
|
||||||
TailleCartiersEnDegres = 360.0f / NbCartiers;
|
TailleCartiersEnDegres = 360.0f / NbCartiers;
|
||||||
balanceValue = (CartierMaxRatio + CartierMinRatio) / 2;
|
balanceValue = (CartierMaxRatio + CartierMinRatio) / 2;
|
||||||
|
|
||||||
@ -46,6 +48,11 @@ public class PlanetManager : MonoBehaviour
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addPlayer()
|
||||||
|
{
|
||||||
|
numPlayer++;
|
||||||
|
}
|
||||||
|
|
||||||
public void setColor(float val)
|
public void setColor(float val)
|
||||||
{
|
{
|
||||||
foreach (Wedge w in wedges) {
|
foreach (Wedge w in wedges) {
|
||||||
@ -171,7 +178,7 @@ public class PlanetManager : MonoBehaviour
|
|||||||
//si player sur la plateforme et grounded
|
//si player sur la plateforme et grounded
|
||||||
if (w.tMax >= p.GetTheta() && p.GetTheta() >= w.tMin && p.IsGrounded())
|
if (w.tMax >= p.GetTheta() && p.GetTheta() >= w.tMin && p.IsGrounded())
|
||||||
{
|
{
|
||||||
p.Eject();
|
p.Eject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,6 +186,23 @@ public class PlanetManager : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void playerDeath(Astronaut aPlayer)
|
||||||
|
{
|
||||||
|
numPlayer--;
|
||||||
|
//check if all players are dead
|
||||||
|
if (numPlayer < 2)
|
||||||
|
{
|
||||||
|
if (numPlayer < 1)
|
||||||
|
{
|
||||||
|
print("game is lost");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print("winner is you!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//public void PushWedge(float thetaPlayerX)
|
//public void PushWedge(float thetaPlayerX)
|
||||||
//{
|
//{
|
||||||
// var index = GetWedgeIndex(thetaPlayerX);
|
// var index = GetWedgeIndex(thetaPlayerX);
|
||||||
@ -277,7 +301,6 @@ public class PlanetManager : MonoBehaviour
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Wedge GetWedgeFromTheta(float thetaPlayerX)
|
public Wedge GetWedgeFromTheta(float thetaPlayerX)
|
||||||
{
|
{
|
||||||
print(GetWedgeIndex((thetaPlayerX)%360));
|
|
||||||
return wedges[GetWedgeIndex((thetaPlayerX) % 360)];
|
return wedges[GetWedgeIndex((thetaPlayerX) % 360)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user