highlighted enemies

fixed flamethrower
added lives
This commit is contained in:
Bruno Rybársky 2022-04-28 19:47:24 +02:00
parent 49757aaab7
commit 7130abf7c0
5 changed files with 47 additions and 16 deletions

@ -2310,6 +2310,10 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_text: 'Score: 0 m_text: 'Score: 0
Highscore: 0
Lives: 0
' '
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
@ -2373,7 +2377,7 @@ MonoBehaviour:
m_VertexBufferAutoSizeReduction: 0 m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1 m_useMaxVisibleDescender: 1
m_pageToDisplay: 1 m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0} m_margin: {x: -102.74609, y: -21.916016, z: -45.703125, w: -134.10547}
m_isUsingLegacyAnimationComponent: 0 m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0 m_isVolumetricText: 0
m_hasFontAssetChanged: 0 m_hasFontAssetChanged: 0
@ -3010,7 +3014,7 @@ ParticleSystem:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1570390063} m_GameObject: {fileID: 1570390063}
serializedVersion: 8 serializedVersion: 8
lengthInSec: 1 lengthInSec: 0.05
simulationSpeed: 1 simulationSpeed: 1
stopAction: 0 stopAction: 0
cullingMode: 0 cullingMode: 0
@ -3085,7 +3089,7 @@ ParticleSystem:
startLifetime: startLifetime:
serializedVersion: 2 serializedVersion: 2
minMaxState: 0 minMaxState: 0
scalar: 0.63 scalar: 1.2
minScalar: 5 minScalar: 5
maxCurve: maxCurve:
serializedVersion: 2 serializedVersion: 2
@ -3138,7 +3142,7 @@ ParticleSystem:
startSpeed: startSpeed:
serializedVersion: 2 serializedVersion: 2
minMaxState: 0 minMaxState: 0
scalar: 11.42 scalar: 3.8
minScalar: 5 minScalar: 5
maxCurve: maxCurve:
serializedVersion: 2 serializedVersion: 2
@ -3573,7 +3577,7 @@ ParticleSystem:
m_RotationOrder: 4 m_RotationOrder: 4
randomizeRotationDirection: 0 randomizeRotationDirection: 0
gravitySource: 0 gravitySource: 0
maxNumParticles: 997 maxNumParticles: 9
customEmitterVelocity: {x: 0, y: 0, z: 0} customEmitterVelocity: {x: 0, y: 0, z: 0}
size3D: 0 size3D: 0
rotation3D: 0 rotation3D: 0
@ -3839,7 +3843,7 @@ ParticleSystem:
rateOverTime: rateOverTime:
serializedVersion: 2 serializedVersion: 2
minMaxState: 0 minMaxState: 0
scalar: 86.8 scalar: 2
minScalar: 10 minScalar: 10
maxCurve: maxCurve:
serializedVersion: 2 serializedVersion: 2
@ -3892,7 +3896,7 @@ ParticleSystem:
rateOverDistance: rateOverDistance:
serializedVersion: 2 serializedVersion: 2
minMaxState: 0 minMaxState: 0
scalar: 0 scalar: 30.49
minScalar: 0 minScalar: 0
maxCurve: maxCurve:
serializedVersion: 2 serializedVersion: 2
@ -7740,6 +7744,8 @@ MonoBehaviour:
text: {fileID: 1294596441} text: {fileID: 1294596441}
part: {fileID: 1570390066} part: {fileID: 1570390066}
score: 0 score: 0
highscore: 0
lives: 3
--- !u!1 &1816246829 --- !u!1 &1816246829
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

@ -78,6 +78,6 @@ Material:
- _UVSec: 0 - _UVSec: 0
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: [] m_BuildTextureStacks: []

@ -78,6 +78,6 @@ Material:
- _UVSec: 0 - _UVSec: 0
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 0.48825955, g: 1, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: [] m_BuildTextureStacks: []

@ -39,8 +39,13 @@ public class dragoncontrols : MonoBehaviour
//control flames //control flames
if (flamethrover) if (flamethrover)
{ {
//if not playing
if (!flames.isPlaying)
{
//play flames
flames.Play(); flames.Play();
} }
}
else else
{ {
flames.Stop(); flames.Stop();

@ -12,6 +12,8 @@ public class enemykiller : MonoBehaviour
public ParticleSystem part; public ParticleSystem part;
public List<ParticleCollisionEvent> collisionEvents; public List<ParticleCollisionEvent> collisionEvents;
public int score = 0; public int score = 0;
public int highscore = 0;
public int lives = 3;
void Start() void Start()
{ {
part = GetComponent<ParticleSystem>(); part = GetComponent<ParticleSystem>();
@ -31,10 +33,16 @@ public class enemykiller : MonoBehaviour
while (i < numCollisionEvents) while (i < numCollisionEvents)
{ {
GameObject other = collisionEvents[i].colliderComponent.gameObject; GameObject other = collisionEvents[i].colliderComponent.gameObject;
//check if object exists
if (other == null)
{
i++;
continue;
}
if (other.tag == "enemy") if (other.tag == "enemy")
{ {
Destroy(other); Destroy(other);
Debug.Log("enemy killed"); Debug.Log("enemy killed (" + other.name+ ")");
//spawn new enemy //spawn new enemy
GameObject enemyclone = Instantiate(other, new Vector3(Random.Range(10, 100), Random.Range(-70, -60), Random.Range(-90, 0)), Quaternion.identity); GameObject enemyclone = Instantiate(other, new Vector3(Random.Range(10, 100), Random.Range(-70, -60), Random.Range(-90, 0)), Quaternion.identity);
//set enemy name //set enemy name
@ -42,23 +50,35 @@ public class enemykiller : MonoBehaviour
enemyclone.tag = "enemy"; enemyclone.tag = "enemy";
//increase score //increase score
score++; score++;
if (score > highscore)
{
highscore = score;
}
//update text //update text
text.text = "Score: " + score; text.text = "Score: " + score + "\nHighscore: " + highscore + "\nLives: " + lives;
} }
if (other.tag == "king") if (other.tag == "king")
{ {
Destroy(other); Destroy(other);
Debug.Log("killed king"); Debug.Log("killed king" + other.name);
//spawn new king //spawn new king
GameObject kingclone = Instantiate(other, new Vector3(Random.Range(10, 100), Random.Range(-70, -60), Random.Range(-90, -20)), Quaternion.identity); GameObject kingclone = Instantiate(other, new Vector3(Random.Range(10, 100), Random.Range(-70, -60), Random.Range(-90, -20)), Quaternion.identity);
//set king name //set king name
kingclone.name = "king" + i; kingclone.name = "king" + i;
kingclone.tag = "king"; kingclone.tag = "king";
GameObject kingclone2 = Instantiate(other, new Vector3(Random.Range(10, 100), Random.Range(-70, -60), Random.Range(-90, -20)), Quaternion.identity);
//set king name
kingclone2.name = "kingy" + i;
kingclone2.tag = "king";
//decrease score //decrease score
score-= 10; score-= 20;
lives--;
if (lives <= 0)
{
text.text = "GAME OVER";
}
//update text //update text
text.text = "Score: " + score; text.text = "Score: " + score + "\nHighscore: " + highscore + "\nLives: " + lives;
} }
i++; i++;
} }