Skip to content

Commit

Permalink
Added sparks when enemy is damaged
Browse files Browse the repository at this point in the history
  • Loading branch information
Guriva committed Apr 23, 2018
1 parent bb688e2 commit fb3ab3c
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 4 deletions.
3 changes: 3 additions & 0 deletions ShowPT/Assets/Graphical Resources/Prefabs/PlayerNew.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -11885,6 +11885,7 @@ MonoBehaviour:
esferaRoja: {fileID: 1875600123601928, guid: f9e53e24f85fa9549adb0b70849208db, type: 2}
explosion: {fileID: 1538796440401936, guid: dc2e349666b67b147abf2bb01918ffd3, type: 2}
shootEffect: {fileID: 198198216888127518}
sparks: {fileID: 1149727948857286, guid: 81170b26490e59a45b57295281371104, type: 2}
numDrons: 0
typeAmmo: 0
wazPuntuation: {fileID: 0}
Expand Down Expand Up @@ -11992,6 +11993,7 @@ MonoBehaviour:
esferaRoja: {fileID: 1875600123601928, guid: a59f92463ea9a2b41aa7288b86acfeda, type: 2}
explosion: {fileID: 1538796440401936, guid: 02e088ba12ebc334f9c9f06de13f267b, type: 2}
shootEffect: {fileID: 198878964317542246}
sparks: {fileID: 1149727948857286, guid: 81170b26490e59a45b57295281371104, type: 2}
numDrons: 0
typeAmmo: 2
wazPuntuation: {fileID: 0}
Expand Down Expand Up @@ -12041,6 +12043,7 @@ MonoBehaviour:
esferaRoja: {fileID: 1875600123601928, guid: a59f92463ea9a2b41aa7288b86acfeda, type: 2}
explosion: {fileID: 1538796440401936, guid: 02e088ba12ebc334f9c9f06de13f267b, type: 2}
shootEffect: {fileID: 198008672147419078}
sparks: {fileID: 1149727948857286, guid: 81170b26490e59a45b57295281371104, type: 2}
numDrons: 0
typeAmmo: 1
shot: {fileID: 8300000, guid: eba2a5b7be178b042b2477624eccde55, type: 3}
Expand Down
21 changes: 17 additions & 4 deletions ShowPT/Assets/Graphical Resources/Prefabs/Weapons/Sparks.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ GameObject:
- component: {fileID: 4372771240180146}
- component: {fileID: 198110048108992374}
- component: {fileID: 199749373231686412}
- component: {fileID: 114616735894447762}
m_Layer: 0
m_Name: Sparks
m_TagString: Untagged
Expand Down Expand Up @@ -72,6 +73,18 @@ Transform:
m_Father: {fileID: 4372771240180146}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &114616735894447762
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1149727948857286}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f24be192f2e312242b4b492a7d0aaa6e, type: 3}
m_Name:
m_EditorClassIdentifier:
lifetime: 2
--- !u!198 &198110048108992374
ParticleSystem:
m_ObjectHideFlags: 1
Expand All @@ -84,7 +97,7 @@ ParticleSystem:
stopAction: 0
looping: 0
prewarm: 0
playOnAwake: 0
playOnAwake: 1
useUnscaledTime: 0
autoRandomSeed: 1
useRigidbodyForVelocity: 1
Expand Down Expand Up @@ -132,7 +145,7 @@ ParticleSystem:
moveWithTransform: 0
moveWithCustomTransform: {fileID: 0}
scalingMode: 2
randomSeed: 2119211827
randomSeed: 1083692332
InitialModule:
serializedVersion: 3
enabled: 1
Expand Down Expand Up @@ -3490,7 +3503,7 @@ ParticleSystem:
stopAction: 0
looping: 0
prewarm: 0
playOnAwake: 0
playOnAwake: 1
useUnscaledTime: 0
autoRandomSeed: 1
useRigidbodyForVelocity: 1
Expand Down Expand Up @@ -3538,7 +3551,7 @@ ParticleSystem:
moveWithTransform: 0
moveWithCustomTransform: {fileID: 0}
scalingMode: 1
randomSeed: -1102321603
randomSeed: -151327990
InitialModule:
serializedVersion: 3
enabled: 1
Expand Down
12 changes: 12 additions & 0 deletions ShowPT/Assets/Scripts/DestroyByTime.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DestroyByTime : MonoBehaviour {

public float lifetime = 2f;
void Start()
{
Destroy(gameObject, lifetime);
}
}
13 changes: 13 additions & 0 deletions ShowPT/Assets/Scripts/DestroyByTime.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions ShowPT/Assets/Scripts/GunController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class GunController : MonoBehaviour {
public GameObject esferaRoja;
public GameObject explosion;
public ParticleSystem shootEffect;
public GameObject sparks;

public int numDrons = 0;

Expand Down Expand Up @@ -161,6 +162,8 @@ void decreaseAmmo()
{
hitInfo.collider.gameObject.GetComponent<Enemy>().getHit(damage);
ScoreController.gunHit();
GameObject spark = Instantiate(sparks, hitInfo.point, Quaternion.Euler(0f, 0f, 0f));
spark.transform.up = hitInfo.normal;
}
}

Expand Down
3 changes: 3 additions & 0 deletions ShowPT/Assets/Scripts/RifleController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class RifleController : MonoBehaviour
public GameObject esferaRoja;
public GameObject explosion;
public ParticleSystem shootEffect;
public GameObject sparks;

public int numDrons = 0;

Expand Down Expand Up @@ -181,6 +182,8 @@ void decreaseAmmo()
{
hitInfo.collider.gameObject.GetComponent<Enemy>().getHit(damage);
ScoreController.rifleHit();
GameObject spark = Instantiate(sparks, hitInfo.point, Quaternion.Euler(0f, 0f, 0f));
spark.transform.up = hitInfo.normal;
}
}

Expand Down
3 changes: 3 additions & 0 deletions ShowPT/Assets/Scripts/WeaponController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class WeaponController : MonoBehaviour
public GameObject esferaRoja;
public GameObject explosion;
public ParticleSystem shootEffect;
public GameObject sparks;

public int numDrons = 0;

Expand Down Expand Up @@ -209,6 +210,8 @@ void decreaseAmmo()
{
hitInfo.collider.gameObject.GetComponent<Enemy>().getHit(damage);
ScoreController.weaponHit();
GameObject spark = Instantiate(sparks, hitInfo.point, Quaternion.Euler(0f, 0f, 0f));
spark.transform.up = hitInfo.normal;
}
}

Expand Down

0 comments on commit fb3ab3c

Please sign in to comment.