Merge branch 'master' of github.com:ETSConjure/PixelSphinx

This commit is contained in:
Jean-Sébastien Gervais 2016-04-09 13:23:35 -04:00
commit 296b0ca2b7
7 changed files with 1623 additions and 24 deletions

View File

@ -145,7 +145,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ab270b0cb2475114ab8eb45661af0df1, type: 3}
m_Name:
m_EditorClassIdentifier:
PlayerNumber: 1
PlayerNumber: 0
--- !u!114 &11491252
MonoBehaviour:
m_ObjectHideFlags: 1
@ -158,8 +158,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
aspi: {fileID: 0}
WalkAnimSpeed: 0
WalkAnimAngle: 0
WalkAnimSpeed: 4
WalkAnimAngle: 15
EjectSpinSpeed: 80
DustParticlesEmitter: {fileID: 138982, guid: 6233079c5a9a756458811f283fdca112, type: 2}
--- !u!114 &11494368

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a63c057a7a113a349b55d0ae61d0c936
timeCreated: 1460210347
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -7,7 +7,7 @@ public class Astronaut : MonoBehaviour {
private AstronautAnimator _astronautAnimator;
public enum AstronautState
{
Idle, Walking, Jumping, Dashing, Ejecting, Dead
Idle, Walking, Jumping, Dashing, Stun, Ejecting, Dead
}
public GameObject Rotator;
@ -56,11 +56,10 @@ public class Astronaut : MonoBehaviour {
SpriteDash.gameObject.SetActive(false);
}*/
/*if (_state == AstronautState.Walking)
if (State == AstronautState.Walking)
{
//StartCoroutine(WalkingStance());
_astronautAnimator.Walk();
}*/
_astronautAnimator.Walk(walkRight);
}
}
}
@ -68,6 +67,7 @@ public class Astronaut : MonoBehaviour {
private float height = 0;
private float vSpeed = 0;
private bool grounded = false;
private bool walkRight = false;
private float walkTime = 0;
private int nextStep = 1;
@ -93,6 +93,7 @@ public class Astronaut : MonoBehaviour {
{
planet = FindObjectOfType<PlanetManager>();
}
planet.addPlayer();
State = AstronautState.Idle;
theta = 0;
@ -221,6 +222,7 @@ public class Astronaut : MonoBehaviour {
}
else
{
walkRight = move > 0;
State = AstronautState.Walking;
walkTime = 0f;
}
@ -237,7 +239,7 @@ public class Astronaut : MonoBehaviour {
float newHeight = GetGroundRadius(newTheta);
if (newHeight > height)
{
Debug.Log("Blocked by wall");
//Debug.Log("Blocked by wall");
return; // Blocked by wall
}
@ -296,6 +298,8 @@ public class Astronaut : MonoBehaviour {
vSpeed = EjectSpeed;
_astronautAnimator.Eject();
grounded = false;
planet.playerDeath(this);
}
/// <summary>
@ -303,7 +307,7 @@ public class Astronaut : MonoBehaviour {
/// </summary>
public void Stun()
{
print("Stunned");
//TODO
}
public void OnGUI()
@ -311,7 +315,14 @@ public class Astronaut : MonoBehaviour {
if (GUI.Button(new Rect(10, 10, 150, 50), State.ToString()))
{
Debug.Log("Clicked the button with an image");
Eject();
}
//_astronautAnimator.Walk();
//Eject();
}
/* if (GUI.Button(new Rect(60, 10, 150, 50), "Stop"))
{
Debug.Log("Clicked the button with an image");
_astronautAnimator.StopWalk();
//Eject();
}*/
}
}

View File

@ -39,9 +39,10 @@ public class AstronautAnimator : MonoBehaviour {
aspi.SpriteDash.gameObject.SetActive(false);
}
public void Walk()
public void Walk(bool right)
{
StartCoroutine(Rotate());
Debug.Log("Walking!");
StartCoroutine(Rotate(right? -1 : 1));
}
public void Eject()
@ -58,9 +59,9 @@ public class AstronautAnimator : MonoBehaviour {
}
}
IEnumerator Rotate()
IEnumerator Rotate(float side)
{
for (float i = 0.5f; i < 2.5f; i+= Time.deltaTime*WalkAnimSpeed)
for (float i = 0.5f; i < 1.5f; i+= Time.deltaTime*WalkAnimSpeed)
{
/*int roundDown = 10;
//0.5, 1.5 et 2.5
@ -70,15 +71,18 @@ public class AstronautAnimator : MonoBehaviour {
aspi.SpriteWalk.flipX = !aspi.SpriteWalk.flipX;
}*/
float position = Mathf.PingPong(i, 1f);
transform.rotation = Quaternion.Euler(0, 0, (position - 0.5f) * WalkAnimAngle * 2);
transform.localRotation = Quaternion.Euler(0, 0, side * (position - 0.5f) * WalkAnimAngle * 2);
yield return null;
}
if (aspi.State == Astronaut.AstronautState.Walking)
{
StartCoroutine(Rotate());
Debug.Log("Walking again");
StartCoroutine(Rotate(-side));
}
yield return null;
else
Debug.Log("Walking stop");
//yield return null;
}
public void EmitDustParticules()

View File

@ -19,9 +19,11 @@ public class PlanetManager : MonoBehaviour
private float disbalance = 0f;
public GameObject WedgePrefab = null;
public List<Wedge> wedges = new List<Wedge>();
private int numPlayer;
// Use this for initialization
public void Awake () {
numPlayer = 0;
TailleCartiersEnDegres = 360.0f / NbCartiers;
balanceValue = (CartierMaxRatio + CartierMinRatio) / 2;
@ -47,6 +49,11 @@ public class PlanetManager : MonoBehaviour
}
public void addPlayer()
{
numPlayer++;
}
public void setColor(float val)
{
foreach (Wedge w in wedges) {
@ -187,7 +194,7 @@ public class PlanetManager : MonoBehaviour
//si player sur la plateforme et grounded
if (w.tMax >= p.GetTheta() && p.GetTheta() >= w.tMin && p.IsGrounded())
{
p.Eject();
p.Eject();
}
}
}
@ -195,6 +202,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)
//{
// var index = GetWedgeIndex(thetaPlayerX);

View File

@ -132,10 +132,6 @@ Prefab:
propertyPath: m_Name
value: Astronaut_0
objectReference: {fileID: 0}
- target: {fileID: 11434752, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
propertyPath: PlayerNumber
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
m_IsPrefabParent: 0
@ -515,6 +511,10 @@ Prefab:
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11434752, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
propertyPath: PlayerNumber
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
m_IsPrefabParent: 0