Ejection de l'astronaute sur impact plaque et si atteint le maximum hauteur et toujours au sol..

This commit is contained in:
Jean-Sébastien Gervais 2016-04-09 00:34:00 -04:00
parent c0c7600e33
commit 3a7d1de39f
4 changed files with 42 additions and 51 deletions

View File

@ -36,7 +36,7 @@ ParticleSystem:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 120238} m_GameObject: {fileID: 120238}
serializedVersion: 2 serializedVersion: 2
lengthInSec: 3 lengthInSec: 0.75
startDelay: startDelay:
scalar: 0 scalar: 0
maxCurve: maxCurve:
@ -83,7 +83,7 @@ ParticleSystem:
serializedVersion: 2 serializedVersion: 2
enabled: 1 enabled: 1
startLifetime: startLifetime:
scalar: 3 scalar: 0.75
maxCurve: maxCurve:
serializedVersion: 2 serializedVersion: 2
m_Curve: m_Curve:
@ -237,7 +237,7 @@ ParticleSystem:
rgba: 4294967295 rgba: 4294967295
minMaxState: 0 minMaxState: 0
startSize: startSize:
scalar: 1 scalar: 0.5
maxCurve: maxCurve:
serializedVersion: 2 serializedVersion: 2
m_Curve: m_Curve:
@ -359,7 +359,7 @@ ParticleSystem:
length: 5 length: 5
boxX: 1 boxX: 1
boxY: 1 boxY: 1
boxZ: 35.55 boxZ: 1
arc: 360 arc: 360
placementMode: 0 placementMode: 0
m_Mesh: {fileID: 0} m_Mesh: {fileID: 0}

View File

@ -61,13 +61,23 @@ public class Astronaut : MonoBehaviour {
private float theta = 0; private float theta = 0;
private float height = 0; private float height = 0;
private float vSpeed = 0; public float vSpeed = 0;
private bool grounded = false; private bool grounded = false;
private float walkTime = 0; private float walkTime = 0;
private int nextStep = 1; private int nextStep = 1;
// Use this for initialization public float GetTheta()
{
return theta;
}
public bool IsGrounded()
{
return grounded;
}
// Use this for initialization
void Start() void Start()
{ {
_astronautAnimator = GetComponent<AstronautAnimator>(); _astronautAnimator = GetComponent<AstronautAnimator>();
@ -142,9 +152,10 @@ public class Astronaut : MonoBehaviour {
if (State == AstronautState.Jumping) if (State == AstronautState.Jumping)
State = AstronautState.Idle; State = AstronautState.Idle;
vSpeed = 0f; if (State < AstronautState.Ejecting) vSpeed = 0f;
} }
UpdatePosition(); UpdatePosition();
//float x, y; //float x, y;
@ -224,6 +235,7 @@ public class Astronaut : MonoBehaviour {
//TODO arreter mouvement lateral //TODO arreter mouvement lateral
State=AstronautState.Idle; State=AstronautState.Idle;
} }
} }
public void Jump() public void Jump()

View File

@ -33,6 +33,7 @@ public class PlanetManager : MonoBehaviour
var obj = Instantiate(WedgePrefab, new Vector3(0.0f,0.0f, 0.0f), Quaternion.Euler(0, 0, debutAngleTheta)); var obj = Instantiate(WedgePrefab, new Vector3(0.0f,0.0f, 0.0f), Quaternion.Euler(0, 0, debutAngleTheta));
obj.name = "wedge_" + i; obj.name = "wedge_" + i;
w.sprite = GameObject.Find(obj.name); w.sprite = GameObject.Find(obj.name);
w.gameObject = (GameObject)obj;
wedges.Add(w); //pushes at end. wedges.Add(w); //pushes at end.
} }
} }
@ -99,9 +100,25 @@ public class PlanetManager : MonoBehaviour
var v = wedges[indexOppose]; var v = wedges[indexOppose];
v.offset = v.offset + CartierStepSize; v.offset = v.offset + CartierStepSize;
if (v.offset > CartierMaxRatio) if (v.offset >= CartierMaxRatio)
{
v.offset = CartierMaxRatio; v.offset = CartierMaxRatio;
//checker si on éjecte des players
var players = FindObjectsOfType<Astronaut>();
foreach (var p in players)
{
if (v.tMax >= p.GetTheta() && p.GetTheta() >= v.tMin && p.IsGrounded())
{
p.Eject();
}
}
}
v.sprite.transform.localScale = new Vector3(v.offset, v.offset, 1); v.sprite.transform.localScale = new Vector3(v.offset, v.offset, 1);
// call fill gauge after every hit. // call fill gauge after every hit.
@ -233,6 +250,6 @@ public class PlanetManager : MonoBehaviour
public float tMax = 0; public float tMax = 0;
public GameObject sprite; //sprite et collider 2D public GameObject sprite; //sprite et collider 2D
public GameObject gameObject; //wedge prefab avec collider
} }
} }

View File

@ -104,48 +104,6 @@ MonoBehaviour:
WalkAnimSpeed: 0 WalkAnimSpeed: 0
WalkAnimAngle: 0 WalkAnimAngle: 0
EjectSpinSpeed: 0 EjectSpinSpeed: 0
--- !u!1001 &595727044
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
propertyPath: m_LocalPosition.x
value: 8.22
objectReference: {fileID: 0}
- target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
propertyPath: m_LocalPosition.y
value: 1.36
objectReference: {fileID: 0}
- target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
propertyPath: m_RootOrder
value: 6
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
m_IsPrefabParent: 0
--- !u!114 &1027139440 stripped --- !u!114 &1027139440 stripped
MonoBehaviour: MonoBehaviour:
m_PrefabParentObject: {fileID: 11471614, guid: 198e988adacced646a19f757f6237ae1, m_PrefabParentObject: {fileID: 11471614, guid: 198e988adacced646a19f757f6237ae1,
@ -367,6 +325,10 @@ Prefab:
propertyPath: SpriteWalk propertyPath: SpriteWalk
value: value:
objectReference: {fileID: 1106066633} objectReference: {fileID: 1106066633}
- target: {fileID: 11494368, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
propertyPath: EjectSpeed
value: 50
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2} m_ParentPrefab: {fileID: 100100000, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
m_IsPrefabParent: 0 m_IsPrefabParent: 0