shield color change on lifetime

This commit is contained in:
joonasp
2022-04-18 14:14:48 +03:00
parent b3c991bd09
commit 4922174840
12 changed files with 845 additions and 822 deletions
@@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 772404450966566002}
- component: {fileID: 3268723311598239928}
- component: {fileID: 7564575873016353892}
- component: {fileID: 3597675138378626114}
m_Layer: 0
m_Name: shield_spell
m_TagString: Untagged
@@ -97,3 +98,18 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 3.8, y: 0.3, z: 2.0000007}
m_Center: {x: 0, y: -0.0046907673, z: 0.000000001118366}
--- !u!114 &3597675138378626114
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3917053023338471789}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: add865683e185ac43b2093091d499b6a, type: 3}
m_Name:
m_EditorClassIdentifier:
health: 5
startColor: {r: 0.019607844, g: 0.77254903, b: 0.77254903, a: 0}
endColor: {r: 0.8666667, g: 0.43137255, b: 0.13333334, a: 0}
@@ -55,7 +55,6 @@ public class ActionGestureInteraction : MonoBehaviour
Vector3 spawnPoint = transform.position + playerCamera.transform.forward;
spawnPoint = new Vector3(spawnPoint.x, spawnPoint.y + 1, spawnPoint.z);
GameObject shield = Instantiate(objects[1], spawnPoint, Quaternion.Euler(-90, playerCamera.transform.eulerAngles.y - 180, 180));
Destroy(shield, 5);
}
else
{
@@ -4,6 +4,12 @@ using UnityEngine;
public class ShieldController : MonoBehaviour
{
public float health = 5;
public Color startColor;
public Color endColor;
// Start is called before the first frame update
void Start()
{
@@ -13,6 +19,8 @@ public class ShieldController : MonoBehaviour
// Update is called once per frame
void Update()
{
health -= Time.deltaTime;
GetComponent<Renderer>().material.SetColor("_Color0", Color.Lerp(endColor, startColor, health / 5));
if (health <= 0) Destroy(gameObject);
}
}
File diff suppressed because one or more lines are too long
+11 -11
View File
@@ -90,19 +90,19 @@ Material:
- _HorizonCloudSize: 4.91
- _HorizonCloudStartPosition: -0.1
- _HorizonCloudStep: 25
- _HorizonExponent: 4.5262575
- _HorizonExponent: 3.7730148
- _HorizonStep: 500
- _HorizonThickness: 1
- _MoonGlow: 0
- _MoonLightIntensity: 0.00007462764
- _MoonLightIntensity: 0.000008518849
- _MoonSize: 0
- _MoonSoftEdge: 0
- _OverheadCloudAltitude: 1000
- _OverheadCloudAnimationSpeed: 50
- _OverheadCloudFlowDirectionX: 1
- _OverheadCloudFlowDirectionZ: 1
- _OverheadCloudRemapMax: 1.6860074
- _OverheadCloudRemapMin: 0.3994308
- _OverheadCloudRemapMax: 1.2531662
- _OverheadCloudRemapMin: 0.2223462
- _OverheadCloudSize: 10
- _OverheadCloudStep: 2
- _StarsDensity0: 0.4
@@ -121,25 +121,25 @@ Material:
- _StarsTwinkle1: 6
- _StarsTwinkle2: 2
- _SunGlow: 0.45
- _SunLightIntensity: 0.76967657
- _SunLightIntensity: 0.41087142
- _SunSize: 0.1
- _SunSoftEdge: 0.5
m_Colors:
- _DetailOverlayTintColor: {r: 0, g: 0, b: 0, a: 0}
- _FogColor: {r: 0, g: 0, b: 0, a: 0}
- _GroundColor: {r: 0.45972604, g: 0.45057073, b: 0.46830416, a: 1}
- _GroundColor: {r: 0.42758024, g: 0.41111732, b: 0.44300514, a: 1}
- _HorizonCloudColor: {r: 1, g: 1, b: 1, a: 1}
- _HorizonColor: {r: 0.8838805, g: 0.91821855, b: 0.86816055, a: 1}
- _HorizonColor: {r: 0.89793044, g: 0.87553227, b: 0.78631103, a: 1}
- _MoonColor: {r: 1, g: 1, b: 1, a: 0}
- _MoonDirection: {r: 1, g: 1, b: 1, a: 0}
- _MoonLightColor: {r: 0, g: 0, b: 0, a: 0}
- _OverheadCloudColor: {r: 1, g: 1, b: 1, a: 0.99385715}
- _SkyColor: {r: 0.29709646, g: 0.59141034, b: 0.8612809, a: 1}
- _OverheadCloudColor: {r: 1, g: 1, b: 1, a: 0.989025}
- _SkyColor: {r: 0.23766041, g: 0.4377789, b: 0.6844221, a: 1}
- _StarsColor0: {r: 0.96470594, g: 0.9450981, b: 0.76470596, a: 1}
- _StarsColor1: {r: 1, g: 0.5294118, b: 0.93725497, a: 1}
- _StarsColor2: {r: 0, g: 0.92549026, b: 1, a: 1}
- _SunColor: {r: 0.9716981, g: 0.92388135, b: 0.8443182, a: 1}
- _SunDirection: {r: 0, g: -0.83296573, b: 0.5533246, a: 0}
- _SunColor: {r: 0.9716981, g: 0.924848, b: 0.84745574, a: 1}
- _SunDirection: {r: 0, g: -0.49374878, b: 0.8696046, a: 0}
- _SunLightColor: {r: 1, g: 0.9929226, b: 0.9009434, a: 1}
m_BuildTextureStacks: []
--- !u!114 &11400000
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -27,17 +27,17 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorBlend:
m_Texture: {fileID: -6556316676253526225, guid: b6bbea2e1167a7346822545139402874,
m_Texture: {fileID: 8383841428176927265, guid: b6bbea2e1167a7346822545139402874,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorByHeight:
m_Texture: {fileID: -6870677732268956318, guid: b6bbea2e1167a7346822545139402874,
m_Texture: {fileID: -4470815328621003127, guid: b6bbea2e1167a7346822545139402874,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorByNormal:
m_Texture: {fileID: 647227324473049, guid: b6bbea2e1167a7346822545139402874,
m_Texture: {fileID: -1220541512051535516, guid: b6bbea2e1167a7346822545139402874,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
@@ -40,17 +40,17 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorBlend:
m_Texture: {fileID: 3578454826137520848, guid: 726ce83d589353742be6b48ff467fc48,
m_Texture: {fileID: 1318365803902414219, guid: 726ce83d589353742be6b48ff467fc48,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorByHeight:
m_Texture: {fileID: -2524911961136045829, guid: 726ce83d589353742be6b48ff467fc48,
m_Texture: {fileID: -4211186723990843148, guid: 726ce83d589353742be6b48ff467fc48,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorByNormal:
m_Texture: {fileID: 6071937167051093205, guid: 726ce83d589353742be6b48ff467fc48,
m_Texture: {fileID: -3561777244638167171, guid: 726ce83d589353742be6b48ff467fc48,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
@@ -40,17 +40,17 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorBlend:
m_Texture: {fileID: -318453109426760785, guid: 7f589c682d367b442b8cf75918f5aa55,
m_Texture: {fileID: -5933223485886743397, guid: 7f589c682d367b442b8cf75918f5aa55,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorByHeight:
m_Texture: {fileID: 2599907500881124078, guid: 7f589c682d367b442b8cf75918f5aa55,
m_Texture: {fileID: -5251282745750488854, guid: 7f589c682d367b442b8cf75918f5aa55,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorByNormal:
m_Texture: {fileID: 3396191670951455934, guid: 7f589c682d367b442b8cf75918f5aa55,
m_Texture: {fileID: -1312613134760715702, guid: 7f589c682d367b442b8cf75918f5aa55,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
+1 -1
View File
@@ -100,7 +100,7 @@ Material:
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Color0: {r: 1.5507064, g: 15.19919, b: 29.6185, a: 0}
- _Color0: {r: 7.3553696, g: 17.679485, b: 28.351603, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []