Skip to content

Commit

Permalink
finally fixed dissolve animation
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueIceshard committed Jun 30, 2018
1 parent 3c48048 commit 4e5b63c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Neonmania/Assets/Materials/EnemyMaterial.mat
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- Vector1_30FACB43: 1.5
- Vector1_30FACB43: 0
- Vector1_57F42619: 2
- Vector1_80FF0A22: 1
- Vector1_A132DC88: 0.05
Expand Down
4 changes: 2 additions & 2 deletions Neonmania/Assets/Prefabs/Projectile.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Transform:
m_GameObject: {fileID: 1931415397430566}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
m_LocalScale: {x: 0.3, y: 0.3, z: 0.3}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
Expand Down Expand Up @@ -124,5 +124,5 @@ SphereCollider:
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Radius: 5
m_Radius: 2
m_Center: {x: 0, y: 0, z: 0}
16 changes: 11 additions & 5 deletions Neonmania/Assets/Scripts/EnemyController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ public class EnemyController : MonoBehaviour {
private Rigidbody rb;
private EnemyProperties enemy;

private float lifetime;

// Use this for initialization
void Start () {
rb = GetComponent<Rigidbody>();
enemy = GetComponent<EnemyPropertyController>().properties;
Debug.Log(GetComponent<Renderer>().material.GetFloat(Shader.PropertyToID("Vector1_30FACB43")));
lifetime = 0f;
}

// Update is called once per frame
void Update () {

Expand All @@ -43,9 +45,13 @@ void Update () {
return;
}

lastCheck += Time.deltaTime;

if(lastCheck >= checkFrequency) {
lastCheck += Time.deltaTime;

lifetime += Time.deltaTime;

GetComponent<Renderer>().material.SetFloat(Shader.PropertyToID("Vector1_30FACB43"), lifetime);

if (lastCheck >= checkFrequency) {
lastCheck = 0;

UpdateEnemyPath();
Expand Down
14 changes: 0 additions & 14 deletions Neonmania/Assets/Scripts/EnemyPropertyController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,4 @@
public class EnemyPropertyController : MonoBehaviour {

public EnemyProperties properties;

private float lifetime;

void Start() {
lifetime = 0f;


}

void Update() {
lifetime += Time.deltaTime;

GetComponent<Renderer>().material.SetFloat(Shader.PropertyToID("Vector1_30FACB43"), lifetime);
}
}

0 comments on commit 4e5b63c

Please sign in to comment.