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

@ -78,6 +78,6 @@ Material:
- _UVSec: 0
- _ZWrite: 1
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}
m_BuildTextureStacks: []

@ -78,6 +78,6 @@ Material:
- _UVSec: 0
- _ZWrite: 1
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}
m_BuildTextureStacks: []

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

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