mirror of
https://github.com/ConjureETS/PixelSphinx.git
synced 2026-03-25 19:10:58 +00:00
Merge branch 'master' of github.com:ETSConjure/PixelSphinx
This commit is contained in:
commit
038748f96d
BIN
Assets/Art/T_Char_Stunned_03.png
Normal file
BIN
Assets/Art/T_Char_Stunned_03.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 142 KiB |
57
Assets/Art/T_Char_Stunned_03.png.meta
Normal file
57
Assets/Art/T_Char_Stunned_03.png.meta
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f232242ccad7e3842bad3905b644b140
|
||||||
|
timeCreated: 1460228310
|
||||||
|
licenseType: Free
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
linearTexture: 0
|
||||||
|
correctGamma: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 0
|
||||||
|
cubemapConvolution: 0
|
||||||
|
cubemapConvolutionSteps: 7
|
||||||
|
cubemapConvolutionExponent: 1.5
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: -1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -1
|
||||||
|
wrapMode: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
rGBM: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
textureType: 8
|
||||||
|
buildTargetSettings: []
|
||||||
|
spriteSheet:
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -46,7 +46,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!1 &170392
|
--- !u!1 &170392
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -69,6 +69,22 @@ GameObject:
|
|||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 1
|
||||||
|
--- !u!1 &183028
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
serializedVersion: 4
|
||||||
|
m_Component:
|
||||||
|
- 4: {fileID: 497504}
|
||||||
|
- 212: {fileID: 21293154}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Sprite_Stun
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 0
|
||||||
--- !u!4 &403646
|
--- !u!4 &403646
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 1
|
m_ObjectHideFlags: 1
|
||||||
@ -81,6 +97,7 @@ Transform:
|
|||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 418246}
|
- {fileID: 418246}
|
||||||
- {fileID: 406446}
|
- {fileID: 406446}
|
||||||
|
- {fileID: 497504}
|
||||||
m_Father: {fileID: 494126}
|
m_Father: {fileID: 494126}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
--- !u!4 &406446
|
--- !u!4 &406446
|
||||||
@ -120,6 +137,18 @@ Transform:
|
|||||||
- {fileID: 403646}
|
- {fileID: 403646}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
|
--- !u!4 &497504
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 183028}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 403646}
|
||||||
|
m_RootOrder: 2
|
||||||
--- !u!54 &5462614
|
--- !u!54 &5462614
|
||||||
Rigidbody:
|
Rigidbody:
|
||||||
m_ObjectHideFlags: 1
|
m_ObjectHideFlags: 1
|
||||||
@ -220,7 +249,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: ab270b0cb2475114ab8eb45661af0df1, type: 3}
|
m_Script: {fileID: 11500000, guid: ab270b0cb2475114ab8eb45661af0df1, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
PlayerNumber: 0
|
PlayerNumber: 1
|
||||||
--- !u!114 &11491252
|
--- !u!114 &11491252
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 1
|
m_ObjectHideFlags: 1
|
||||||
@ -253,7 +282,9 @@ MonoBehaviour:
|
|||||||
Rotator: {fileID: 154602}
|
Rotator: {fileID: 154602}
|
||||||
SpriteWalk: {fileID: 21220066}
|
SpriteWalk: {fileID: 21220066}
|
||||||
SpriteDash: {fileID: 157058}
|
SpriteDash: {fileID: 157058}
|
||||||
|
SpriteStun: {fileID: 183028}
|
||||||
Width: 0.4
|
Width: 0.4
|
||||||
|
Height: 0.3
|
||||||
DashTime: 0.4
|
DashTime: 0.4
|
||||||
StepTime: 5
|
StepTime: 5
|
||||||
JumpSpeed: 5
|
JumpSpeed: 5
|
||||||
@ -347,6 +378,36 @@ SpriteRenderer:
|
|||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_FlipX: 0
|
m_FlipX: 0
|
||||||
m_FlipY: 0
|
m_FlipY: 0
|
||||||
|
--- !u!212 &21293154
|
||||||
|
SpriteRenderer:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 100100000}
|
||||||
|
m_GameObject: {fileID: 183028}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 0
|
||||||
|
m_ReceiveShadows: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_SubsetIndices:
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_UseLightProbes: 0
|
||||||
|
m_ReflectionProbeUsage: 0
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingOrder: 15
|
||||||
|
m_Sprite: {fileID: 21300000, guid: f232242ccad7e3842bad3905b644b140, type: 3}
|
||||||
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_FlipX: 0
|
||||||
|
m_FlipY: 0
|
||||||
--- !u!1001 &100100000
|
--- !u!1001 &100100000
|
||||||
Prefab:
|
Prefab:
|
||||||
m_ObjectHideFlags: 1
|
m_ObjectHideFlags: 1
|
||||||
|
|||||||
@ -74,7 +74,7 @@ ParticleSystem:
|
|||||||
minMaxState: 0
|
minMaxState: 0
|
||||||
speed: 1
|
speed: 1
|
||||||
randomSeed: 0
|
randomSeed: 0
|
||||||
looping: 1
|
looping: 0
|
||||||
prewarm: 0
|
prewarm: 0
|
||||||
playOnAwake: 1
|
playOnAwake: 1
|
||||||
moveWithTransform: 1
|
moveWithTransform: 1
|
||||||
|
|||||||
@ -13,8 +13,10 @@ public class Astronaut : MonoBehaviour {
|
|||||||
public GameObject Rotator;
|
public GameObject Rotator;
|
||||||
public SpriteRenderer SpriteWalk;
|
public SpriteRenderer SpriteWalk;
|
||||||
public GameObject SpriteDash;
|
public GameObject SpriteDash;
|
||||||
|
public GameObject SpriteStun;
|
||||||
|
|
||||||
public float Width;
|
public float SpriteWidth;
|
||||||
|
public float SpriteHeight;
|
||||||
public float DashTime = 0.4f; //Temps de l'animation et rate limiting
|
public float DashTime = 0.4f; //Temps de l'animation et rate limiting
|
||||||
private float lastDashTime = 0f;
|
private float lastDashTime = 0f;
|
||||||
public float StepTime;
|
public float StepTime;
|
||||||
@ -43,10 +45,9 @@ public class Astronaut : MonoBehaviour {
|
|||||||
|
|
||||||
if (oldState == AstronautState.Dashing)
|
if (oldState == AstronautState.Dashing)
|
||||||
{
|
{
|
||||||
_astronautAnimator.Land();
|
_astronautAnimator.Idle();
|
||||||
}
|
}
|
||||||
|
else if (State == AstronautState.Walking)
|
||||||
if (State == AstronautState.Walking)
|
|
||||||
{
|
{
|
||||||
_astronautAnimator.Walk(walkRight);
|
_astronautAnimator.Walk(walkRight);
|
||||||
}
|
}
|
||||||
@ -55,6 +56,10 @@ public class Astronaut : MonoBehaviour {
|
|||||||
|
|
||||||
private float theta = 0;
|
private float theta = 0;
|
||||||
private float height = 0;
|
private float height = 0;
|
||||||
|
public float Height
|
||||||
|
{
|
||||||
|
get { return height; }
|
||||||
|
}
|
||||||
private float vSpeed = 0;
|
private float vSpeed = 0;
|
||||||
private bool grounded = false;
|
private bool grounded = false;
|
||||||
private bool walkRight = false;
|
private bool walkRight = false;
|
||||||
@ -94,7 +99,7 @@ public class Astronaut : MonoBehaviour {
|
|||||||
private void UpdatePosition()
|
private void UpdatePosition()
|
||||||
{
|
{
|
||||||
//float heightAtPos = planet.GetPlanetRadius(theta);
|
//float heightAtPos = planet.GetPlanetRadius(theta);
|
||||||
transform.localPosition = new Vector3(0, height, 0);
|
transform.localPosition = new Vector3(0, height + SpriteHeight / 2, 0);
|
||||||
Rotator.transform.localRotation = Quaternion.Euler(0, 0, theta - 108);
|
Rotator.transform.localRotation = Quaternion.Euler(0, 0, theta - 108);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +110,7 @@ public class Astronaut : MonoBehaviour {
|
|||||||
|
|
||||||
private float GetGroundRadius(float theta)
|
private float GetGroundRadius(float theta)
|
||||||
{
|
{
|
||||||
float displacement = PlanetUtilities.GetDisplacementAngle(Width / 2, height);
|
float displacement = PlanetUtilities.GetDisplacementAngle(SpriteWidth / 2, height);
|
||||||
float radius1 = planet.GetPlanetRadius(Repeat(theta + displacement, 360));
|
float radius1 = planet.GetPlanetRadius(Repeat(theta + displacement, 360));
|
||||||
float radius2 = planet.GetPlanetRadius(Repeat(theta - displacement, 360));
|
float radius2 = planet.GetPlanetRadius(Repeat(theta - displacement, 360));
|
||||||
//float x1, y1, x2, y2;
|
//float x1, y1, x2, y2;
|
||||||
@ -156,6 +161,9 @@ public class Astronaut : MonoBehaviour {
|
|||||||
|
|
||||||
public void Move(float x, float y)
|
public void Move(float x, float y)
|
||||||
{
|
{
|
||||||
|
if (State >= AstronautState.Dashing )
|
||||||
|
return;
|
||||||
|
|
||||||
float playerX, playerY;
|
float playerX, playerY;
|
||||||
PlanetUtilities.Spheric2Cartesian(theta - 108, height, out playerX, out playerY);
|
PlanetUtilities.Spheric2Cartesian(theta - 108, height, out playerX, out playerY);
|
||||||
|
|
||||||
@ -166,9 +174,6 @@ public class Astronaut : MonoBehaviour {
|
|||||||
|
|
||||||
float move = proj;
|
float move = proj;
|
||||||
|
|
||||||
if (State >= AstronautState.Dashing )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (State < AstronautState.Jumping)
|
if (State < AstronautState.Jumping)
|
||||||
{
|
{
|
||||||
if (Mathf.Approximately(move, 0))
|
if (Mathf.Approximately(move, 0))
|
||||||
@ -183,8 +188,6 @@ public class Astronaut : MonoBehaviour {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (State < AstronautState.Dashing)
|
|
||||||
{
|
|
||||||
if (-0.2 < move && move < 0.2) return;
|
if (-0.2 < move && move < 0.2) return;
|
||||||
|
|
||||||
float movement = PlanetUtilities.GetDisplacementAngle(Speed * -move, height) * Time.deltaTime;
|
float movement = PlanetUtilities.GetDisplacementAngle(Speed * -move, height) * Time.deltaTime;
|
||||||
@ -200,12 +203,6 @@ public class Astronaut : MonoBehaviour {
|
|||||||
|
|
||||||
theta = newTheta;
|
theta = newTheta;
|
||||||
}
|
}
|
||||||
if (State == AstronautState.Dashing && grounded)
|
|
||||||
{
|
|
||||||
//TODO arreter mouvement lateral
|
|
||||||
State=AstronautState.Idle;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Jump()
|
public void Jump()
|
||||||
{
|
{
|
||||||
@ -259,13 +256,32 @@ public class Astronaut : MonoBehaviour {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Stun()
|
public void Stun()
|
||||||
{
|
{
|
||||||
//TODO
|
if (State < AstronautState.Ejecting)
|
||||||
|
{
|
||||||
|
State = AstronautState.Stun;
|
||||||
|
StartCoroutine(StunTimeout());
|
||||||
|
_astronautAnimator.Stun();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerator StunTimeout()
|
||||||
|
{
|
||||||
|
for (float i = 0f; i <0.6f; i += Time.deltaTime)
|
||||||
|
{
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
if (State < AstronautState.Ejecting)
|
||||||
|
{
|
||||||
|
State = AstronautState.Idle;
|
||||||
|
_astronautAnimator.Idle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnGUI()
|
public void OnGUI()
|
||||||
{
|
{
|
||||||
if (GUI.Button(new Rect(10, 10, 150, 50), State.ToString()))
|
if (GUI.Button(new Rect(10, 10, 150, 50), State.ToString()))
|
||||||
{
|
{
|
||||||
|
Stun();
|
||||||
Debug.Log("Clicked the button with an image");
|
Debug.Log("Clicked the button with an image");
|
||||||
//_astronautAnimator.Walk();
|
//_astronautAnimator.Walk();
|
||||||
//Eject();
|
//Eject();
|
||||||
|
|||||||
@ -27,12 +27,22 @@ public class AstronautAnimator : MonoBehaviour {
|
|||||||
{
|
{
|
||||||
aspi.SpriteWalk.gameObject.SetActive(true);
|
aspi.SpriteWalk.gameObject.SetActive(true);
|
||||||
aspi.SpriteDash.gameObject.SetActive(false);
|
aspi.SpriteDash.gameObject.SetActive(false);
|
||||||
|
aspi.SpriteStun.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dash()
|
public void Dash()
|
||||||
{
|
{
|
||||||
aspi.SpriteWalk.gameObject.SetActive(false);
|
aspi.SpriteWalk.gameObject.SetActive(false);
|
||||||
aspi.SpriteDash.gameObject.SetActive(true);
|
aspi.SpriteDash.gameObject.SetActive(true);
|
||||||
|
aspi.SpriteStun.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Idle()
|
||||||
|
{
|
||||||
|
|
||||||
|
aspi.SpriteWalk.gameObject.SetActive(true);
|
||||||
|
aspi.SpriteDash.gameObject.SetActive(false);
|
||||||
|
aspi.SpriteStun.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Land()
|
public void Land()
|
||||||
@ -42,14 +52,13 @@ public class AstronautAnimator : MonoBehaviour {
|
|||||||
runninParticleEmitter.transform.Rotate(0,180f,0.0f);
|
runninParticleEmitter.transform.Rotate(0,180f,0.0f);
|
||||||
|
|
||||||
Destroy(runninParticleEmitter, runninParticleEmitter.GetComponent<ParticleSystem>().duration);
|
Destroy(runninParticleEmitter, runninParticleEmitter.GetComponent<ParticleSystem>().duration);
|
||||||
|
Idle();
|
||||||
|
|
||||||
var impactAudio = DashImpactSound.GetComponent<AudioSource>();
|
var impactAudio = DashImpactSound.GetComponent<AudioSource>();
|
||||||
impactAudio.bypassListenerEffects = true;
|
impactAudio.bypassListenerEffects = true;
|
||||||
AudioSource.PlayClipAtPoint(impactAudio.clip, transform.position, impactAudio.volume);
|
AudioSource.PlayClipAtPoint(impactAudio.clip, transform.position, impactAudio.volume);
|
||||||
|
|
||||||
|
|
||||||
aspi.SpriteWalk.gameObject.SetActive(true);
|
|
||||||
aspi.SpriteDash.gameObject.SetActive(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -64,6 +73,14 @@ public class AstronautAnimator : MonoBehaviour {
|
|||||||
var audio = aspi.GetComponent<AudioSource>(); //eject sound
|
var audio = aspi.GetComponent<AudioSource>(); //eject sound
|
||||||
audio.bypassListenerEffects = true;
|
audio.bypassListenerEffects = true;
|
||||||
AudioSource.PlayClipAtPoint(audio.clip, transform.position, audio.volume);
|
AudioSource.PlayClipAtPoint(audio.clip, transform.position, audio.volume);
|
||||||
|
Stun();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Stun()
|
||||||
|
{
|
||||||
|
aspi.SpriteWalk.gameObject.SetActive(false);
|
||||||
|
aspi.SpriteDash.gameObject.SetActive(false);
|
||||||
|
aspi.SpriteStun.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerator Spin()
|
IEnumerator Spin()
|
||||||
|
|||||||
@ -6,26 +6,30 @@ public class Earthquake : MonoBehaviour {
|
|||||||
|
|
||||||
public float CriticalMin;
|
public float CriticalMin;
|
||||||
public float CriticalMax;
|
public float CriticalMax;
|
||||||
//public float testValue;
|
public float ExplosionTime;
|
||||||
|
public GameObject ExplosionParticle;
|
||||||
|
private const float WaveSpeed = 1f;
|
||||||
|
private const float WaveOffset = 1.3f;
|
||||||
|
|
||||||
//public float gaugeLevel;
|
|
||||||
//public int gaugeMax=100;
|
|
||||||
private SpriteRenderer core;
|
private SpriteRenderer core;
|
||||||
PlanetManager pmgr;
|
PlanetManager pmgr;
|
||||||
|
|
||||||
|
bool isExploding;
|
||||||
|
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
|
isExploding = false;
|
||||||
pmgr = FindObjectOfType<PlanetManager>();
|
pmgr = FindObjectOfType<PlanetManager>();
|
||||||
//gaugeLevel = 0;
|
|
||||||
core = this.GetComponent<SpriteRenderer>();
|
core = this.GetComponent<SpriteRenderer>();
|
||||||
//InvokeRepeating("FillGauge", 1, 1F);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
public void Update () {
|
public void Update () {
|
||||||
|
|
||||||
|
if(!isExploding) return;
|
||||||
|
|
||||||
float disbalance = pmgr.GetDisbalance();
|
float disbalance = pmgr.GetDisbalance();
|
||||||
float val = Mathf.Clamp((disbalance-CriticalMin) / (CriticalMax-CriticalMin),0,1);
|
float val = Mathf.Clamp((disbalance-CriticalMin) / (CriticalMax-CriticalMin),0,1);
|
||||||
|
|
||||||
@ -34,47 +38,37 @@ public class Earthquake : MonoBehaviour {
|
|||||||
|
|
||||||
core.color = new Color(1f, 1f - val, 1f - val);
|
core.color = new Color(1f, 1f - val, 1f - val);
|
||||||
|
|
||||||
}
|
if (val2 >= 1f)
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Actualiser l'affichage de la gauge
|
|
||||||
/// </summary>
|
|
||||||
public void UpdateFixed()
|
|
||||||
{
|
{
|
||||||
|
EarthquakeBoom();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
void OnGUI()
|
||||||
/// à être Appelé à chaque fois qu'on enfonce un plateau, le gage se remplis plus vite. (et par le temps)
|
|
||||||
/// </summary>
|
|
||||||
public void FillGauge()
|
|
||||||
{
|
{
|
||||||
|
if (GUI.Button(new Rect(100, 100, 50, 50), "BOOM"))
|
||||||
/*if (gaugeLevel < gaugeMax)
|
|
||||||
{
|
{
|
||||||
gaugeLevel += 1;
|
Debug.Log("Clicked the button with an image");
|
||||||
|
EarthquakeBoom();
|
||||||
//anim state [0-90] normale, rotation
|
|
||||||
|
|
||||||
//color hue de plus en plus vers le rouge
|
|
||||||
|
|
||||||
//[90-100]
|
|
||||||
//anim avec les ripples
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
|
||||||
|
private void EarthquakeBoom()
|
||||||
{
|
{
|
||||||
|
isExploding = true;
|
||||||
var planet = FindObjectOfType<PlanetManager>();
|
StartCoroutine(Explode());
|
||||||
|
Instantiate(ExplosionParticle);
|
||||||
planet.CallEarthQuake();
|
|
||||||
|
|
||||||
gaugeLevel = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
print("gauge is at: " + gaugeLevel);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IEnumerator Explode()
|
||||||
|
{
|
||||||
|
float realPosition;
|
||||||
|
for (float i = 0; i < ExplosionTime; i += Time.deltaTime)
|
||||||
|
{
|
||||||
|
realPosition = WaveSpeed * i + WaveOffset;
|
||||||
|
Debug.Log(realPosition);
|
||||||
|
pmgr.EjectPlayers(realPosition);
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -172,13 +172,19 @@ public class PlanetManager : MonoBehaviour
|
|||||||
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.
|
||||||
var earthQuakeGauge = FindObjectOfType<Earthquake>();
|
//var earthQuakeGauge = FindObjectOfType<Earthquake>();
|
||||||
earthQuakeGauge.FillGauge();
|
//earthQuakeGauge.FillGauge();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EjectPlayers(float range)
|
||||||
|
{
|
||||||
|
Astronaut[] players = FindObjectsOfType<Astronaut>();
|
||||||
|
foreach (Astronaut p in players)
|
||||||
|
{
|
||||||
|
if (p.State < Astronaut.AstronautState.Ejecting && p.Height <= range)
|
||||||
|
p.Eject();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
39
Assets/Test/EarthquakeTest.cs
Normal file
39
Assets/Test/EarthquakeTest.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
|
public class EarthquakeTest : MonoBehaviour {
|
||||||
|
|
||||||
|
public GameObject particle;
|
||||||
|
private GameObject obj;
|
||||||
|
|
||||||
|
public float Mod1, Mod2;
|
||||||
|
|
||||||
|
float timeSinceStart = 0;
|
||||||
|
|
||||||
|
// Use this for initialization
|
||||||
|
void Start () {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
timeSinceStart += Time.deltaTime;
|
||||||
|
|
||||||
|
if (Input.GetKeyDown(KeyCode.Space))
|
||||||
|
{
|
||||||
|
if(obj!=null)
|
||||||
|
Destroy(obj);
|
||||||
|
obj = (GameObject)Instantiate(particle);
|
||||||
|
timeSinceStart = 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Input.GetKeyDown(KeyCode.C))
|
||||||
|
{
|
||||||
|
Destroy(obj);
|
||||||
|
obj = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.DrawLine(Vector3.zero, new Vector3(Mod1 * timeSinceStart + Mod2, 0f, 0f));
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Assets/Test/EarthquakeTest.cs.meta
Normal file
12
Assets/Test/EarthquakeTest.cs.meta
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b478dc9d54d60fe4cb0b8a261ec5f65b
|
||||||
|
timeCreated: 1460226796
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -169,6 +169,18 @@ Prefab:
|
|||||||
propertyPath: playOnAwake
|
propertyPath: playOnAwake
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 21293154, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
|
||||||
|
propertyPath: m_Color.g
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 21293154, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
|
||||||
|
propertyPath: m_Color.b
|
||||||
|
value: 0.96862745
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 11434752, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
|
||||||
|
propertyPath: PlayerNumber
|
||||||
|
value: 0
|
||||||
|
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
|
||||||
@ -517,6 +529,14 @@ Prefab:
|
|||||||
propertyPath: m_Color.b
|
propertyPath: m_Color.b
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 21293154, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
|
||||||
|
propertyPath: m_Color.g
|
||||||
|
value: 0.96862745
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 21293154, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
|
||||||
|
propertyPath: m_Color.b
|
||||||
|
value: 0
|
||||||
|
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
|
||||||
@ -579,6 +599,14 @@ Prefab:
|
|||||||
propertyPath: CriticalMax
|
propertyPath: CriticalMax
|
||||||
value: 0.75
|
value: 0.75
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 11401034, guid: 198e988adacced646a19f757f6237ae1, type: 2}
|
||||||
|
propertyPath: ExplosionParticle
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 120238, guid: 1a5b0b5645fa6104087fd9f96b6104b9, type: 2}
|
||||||
|
- target: {fileID: 11401034, guid: 198e988adacced646a19f757f6237ae1, type: 2}
|
||||||
|
propertyPath: ExplosionTime
|
||||||
|
value: 10
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_ParentPrefab: {fileID: 100100000, guid: 198e988adacced646a19f757f6237ae1, type: 2}
|
m_ParentPrefab: {fileID: 100100000, guid: 198e988adacced646a19f757f6237ae1, type: 2}
|
||||||
m_IsPrefabParent: 0
|
m_IsPrefabParent: 0
|
||||||
@ -731,6 +759,18 @@ Prefab:
|
|||||||
propertyPath: m_Color.b
|
propertyPath: m_Color.b
|
||||||
value: 0.09803922
|
value: 0.09803922
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 21293154, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
|
||||||
|
propertyPath: m_Color.r
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 21293154, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
|
||||||
|
propertyPath: m_Color.g
|
||||||
|
value: 0.72156864
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 21293154, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
|
||||||
|
propertyPath: m_Color.b
|
||||||
|
value: 0.09803922
|
||||||
|
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
|
||||||
@ -829,6 +869,14 @@ Prefab:
|
|||||||
propertyPath: m_Color.b
|
propertyPath: m_Color.b
|
||||||
value: 1
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 21293154, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
|
||||||
|
propertyPath: m_Color.r
|
||||||
|
value: 0.07450981
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 21293154, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
|
||||||
|
propertyPath: m_Color.g
|
||||||
|
value: 0
|
||||||
|
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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user