Commit c45580fa by David Colmenero Chica

Merge remote-tracking branch 'origin/Release' into Diseño-menu-extras

parents 03cac2e5 918e834f
Showing with 105 additions and 6 deletions
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5764835571609392104
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 694183434271897141}
- component: {fileID: 473257042043114732}
m_Layer: 0
m_Name: LimiteCaida
m_TagString: Caida
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &694183434271897141
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5764835571609392104}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 8, y: -6, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!61 &473257042043114732
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5764835571609392104}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
oldSize: {x: 0, y: 0}
newSize: {x: 0, y: 0}
adaptiveTilingThreshold: 0
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 15, y: 1}
m_EdgeRadius: 0
fileFormatVersion: 2
guid: 3f846f2b1ae2eab4c8681ee81bf96ca2
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -19,22 +19,50 @@ public class Jugador : MonoBehaviour
// Update is called once per frame
void Update()
{
tInvulnerable -= Time.deltaTime;
//Se va reduciendo el tiempo de invulnerabilidad
if (tInvulnerable >= 0)
{
tInvulnerable -= Time.deltaTime;
}
}
private void OnTriggerEnter2D(Collider2D collision)
{
//Si colisiona con un enemigose le quita una vida
if (collision.tag == "Enemigo" && tInvulnerable<=0)
{
Dañado();
}
if (collision.tag == "Caida")
{
Muerte();
}
//Si colisiona con un power up se comprueba cuál es y se hacen sus efectos
//if (collision.tag == "PowerUp")
//{
//}
}
void Dañado()
{
vidas--;
tInvulnerable = 1.5f;
Debug.Log("Vida actual: "+vidas+"/3");
if (vidas > 1)
{
//Si el jugador es dañado se baja una vida y se le da un tiempo de invulnerabilidad
vidas--;
tInvulnerable = 1.5f;
Debug.Log("Vida actual: " + vidas + "/3");
}
else
{
//Si las vidas se reducen a cero, el jugador muere
Muerte();
}
}
public void Muerte()
{
//El jugador muere
Debug.Log("Muerte");
}
}
{"m_ExpandedPrefabGameObjectFileIDs":[],"m_ExpandedSceneGameObjectInstanceIDs":[],"m_ScrollY":0.0,"m_LastClickedFileID":0,"m_LastClickedInstanceID":0}
\ No newline at end of file
{"cameraMode":{"drawMode":0,"name":"Shaded","section":"Shading Mode"},"sceneLighting":false,"audioPlay":false,"sceneViewState":{"showFog":true,"showMaterialUpdate":false,"showSkybox":false,"showFlares":true,"showImageEffects":true,"showParticleSystems":true},"in2DMode":true,"pivot":{"x":8.0,"y":-6.0,"z":0.0},"rotation":{"x":0.0,"y":0.0,"z":0.0,"w":1.0},"size":22.0,"orthographic":true}
\ No newline at end of file
Base path: C:/Program Files/Unity/Hub/Editor/2019.1.11f1/Editor/Data
Base path: C:/Program Files/Unity/Editor/Data
Cmd: initializeCompiler
......@@ -12,6 +12,7 @@ TagManager:
- Enemigo
- BalaGuitarra
- BalaFlauta
- Caida
layers:
- Default
- TransparentFX
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment