Skip to content

Commit

Permalink
✨Feature: Change Matis color when hp is bellow 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
amandou committed Oct 14, 2023
1 parent 0216626 commit dbce109
Show file tree
Hide file tree
Showing 4 changed files with 184 additions and 86 deletions.
2 changes: 1 addition & 1 deletion Assets/Materials/Shader Graphs_LitEnrageGraph.mat
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ Material:
- _FillRate: 1.0000001
- _IsEnraging: 0
m_Colors:
- _Color: {r: 1, g: 0.4196078, b: 0.4196078, a: 0}
- _Color: {r: 0.41960785, g: 0, b: 0, a: 0.39215687}
m_BuildTextureStacks: []
10 changes: 9 additions & 1 deletion Assets/Scripts/Entity/Boss/MadMantis/EffectsManager.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Spriter2UnityDX;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
Expand All @@ -17,17 +18,24 @@ public class EffectsManager : MonoBehaviour

[SerializeField] float lerpTime;
[SerializeField] Color changeColor;
private Material mantisMaterial;


private void Start()
{
startScale = outerCircle.transform.localScale;
time = 0;
outerCircleSprite = outerCircle.GetComponent<SpriteRenderer>();

mantisMaterial = gameObject.GetComponent<EntityRenderer>().Material;
Color baseEnragedColor = new Color32(255, 107, 107, 100);
mantisMaterial.SetColor("_Color", baseEnragedColor);
}

public void BeginDeath()
{
{
Color color2 = new Color32(107, 0, 0, 100);
mantisMaterial.SetColor("_Color", color2);
outerCircle.SetActive(true);
}

Expand Down
202 changes: 124 additions & 78 deletions Assets/Shaders/FillWithColor.shadersubgraph
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@
},
{
"m_Id": "016c8fc6a72f421da1c645f0607e83a5"
},
{
"m_Id": "385e21ad56c3416cb328496b01174024"
}
],
"m_Keywords": [],
"m_Dropdowns": [],
"m_CategoryData": [],
"m_CategoryData": [
{
"m_Id": "354f8baae320480fab82686a6b5f2b28"
}
],
"m_Nodes": [
{
"m_Id": "5b9f48f41e67483580b806e0f2d00f24"
Expand All @@ -32,9 +39,6 @@
{
"m_Id": "a21ea09e96d44af7b90e07658cd130c6"
},
{
"m_Id": "23583dc910404641852c775fafccd906"
},
{
"m_Id": "7fc4de351f7f4314990c3b79a4d80584"
},
Expand All @@ -46,6 +50,9 @@
},
{
"m_Id": "86a2d51ee7544642b2ba5122d740755a"
},
{
"m_Id": "3244c6ce86bb459ba49fdf47165e04b6"
}
],
"m_GroupDatas": [],
Expand All @@ -68,29 +75,29 @@
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "23583dc910404641852c775fafccd906"
"m_Id": "2bfc22b3b1334d32bf82cc802fedd6db"
},
"m_SlotId": 0
"m_SlotId": 2
},
"m_InputSlot": {
"m_Node": {
"m_Id": "fd4dc02717e54aa6a94e98e97dd446b7"
},
"m_SlotId": 2
"m_SlotId": 0
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "2bfc22b3b1334d32bf82cc802fedd6db"
"m_Id": "3244c6ce86bb459ba49fdf47165e04b6"
},
"m_SlotId": 2
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "fd4dc02717e54aa6a94e98e97dd446b7"
},
"m_SlotId": 0
"m_SlotId": 2
}
},
{
Expand Down Expand Up @@ -369,49 +376,6 @@
}
}

{
"m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.ColorNode",
"m_ObjectId": "23583dc910404641852c775fafccd906",
"m_Group": {
"m_Id": ""
},
"m_Name": "Color",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 78.0,
"y": 112.50006103515625,
"width": 207.99993896484376,
"height": 126.99993896484375
}
},
"m_Slots": [
{
"m_Id": "b668ad566c6b4ec9b4f1fcf18a80fcdd"
}
],
"synonyms": [
"rgba"
],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_Color": {
"color": {
"r": 1.0,
"g": 0.41981130838394167,
"b": 0.41981130838394167,
"a": 0.0
},
"mode": 0
}
}

{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
Expand Down Expand Up @@ -470,6 +434,41 @@
"m_ComparisonType": 5
}

{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.PropertyNode",
"m_ObjectId": "3244c6ce86bb459ba49fdf47165e04b6",
"m_Group": {
"m_Id": ""
},
"m_Name": "Property",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 181.00003051757813,
"y": 111.99999237060547,
"width": 104.99993896484375,
"height": 34.00000762939453
}
},
"m_Slots": [
{
"m_Id": "dfcd03791c514e7abefe958126d19ad9"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_Property": {
"m_Id": "385e21ad56c3416cb328496b01174024"
}
}

{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot",
Expand All @@ -494,6 +493,53 @@
}
}

{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.CategoryData",
"m_ObjectId": "354f8baae320480fab82686a6b5f2b28",
"m_Name": "",
"m_ChildObjectList": [
{
"m_Id": "d264d0879c1a4dffbede63a81aa37ee4"
},
{
"m_Id": "016c8fc6a72f421da1c645f0607e83a5"
},
{
"m_Id": "385e21ad56c3416cb328496b01174024"
}
]
}

{
"m_SGVersion": 3,
"m_Type": "UnityEditor.ShaderGraph.Internal.ColorShaderProperty",
"m_ObjectId": "385e21ad56c3416cb328496b01174024",
"m_Guid": {
"m_GuidSerialized": "987fea63-d5b0-42aa-b26e-b32697b4e37d"
},
"m_Name": "Color",
"m_DefaultRefNameVersion": 1,
"m_RefNameGeneratedByDisplayName": "Color",
"m_DefaultReferenceName": "_Color",
"m_OverrideReferenceName": "",
"m_GeneratePropertyBlock": true,
"m_UseCustomSlotLabel": false,
"m_CustomSlotLabel": "",
"m_Precision": 0,
"overrideHLSLDeclaration": false,
"hlslDeclarationOverride": 0,
"m_Hidden": false,
"m_Value": {
"r": 1.0,
"g": 0.41960784792900088,
"b": 0.41960784792900088,
"a": 0.0
},
"isMainColor": false,
"m_ColorMode": 0
}

{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
Expand Down Expand Up @@ -937,31 +983,6 @@
"m_Labels": []
}

{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot",
"m_ObjectId": "b668ad566c6b4ec9b4f1fcf18a80fcdd",
"m_Id": 0,
"m_DisplayName": "Out",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_Labels": []
}

{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.DynamicValueMaterialSlot",
Expand Down Expand Up @@ -1185,6 +1206,31 @@
}
}

{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot",
"m_ObjectId": "dfcd03791c514e7abefe958126d19ad9",
"m_Id": 0,
"m_DisplayName": "Color",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_Labels": []
}

{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot",
Expand Down
Loading

0 comments on commit dbce109

Please sign in to comment.