Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
tmori committed Feb 28, 2024
1 parent 0c30b0c commit a4ebe6f
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 18 deletions.
40 changes: 35 additions & 5 deletions drone/Assets/Scenes/Hakoniwa.unity
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6827557655526971323}
- {fileID: 1197891462}
- {fileID: 160207952}
- {fileID: 337915244}
- {fileID: 6827557655526971323}
m_Father: {fileID: 964080885}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &337915243
Expand Down Expand Up @@ -600,6 +600,10 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 134018304}
m_Modifications:
- target: {fileID: 184487624363821427, guid: 895e5d4f8aa9641888c1b0204d15e4ca, type: 3}
propertyPath: Tr
value: 5
objectReference: {fileID: 0}
- target: {fileID: 2639913935002386441, guid: 895e5d4f8aa9641888c1b0204d15e4ca, type: 3}
propertyPath: m_LocalPosition.x
value: 0
Expand Down Expand Up @@ -824,6 +828,11 @@ Rigidbody:
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!23 &1474360363 stripped
MeshRenderer:
m_CorrespondingSourceObject: {fileID: 2731441741762715894, guid: d510e4aff5c3c419592bde28523108c6, type: 3}
m_PrefabInstance: {fileID: 1869278167701635054}
m_PrefabAsset: {fileID: 0}
--- !u!224 &1532889509 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 3915667477579360350, guid: 59bee6b6420d9c045bc657037e4cbf32, type: 3}
Expand Down Expand Up @@ -853,6 +862,14 @@ PrefabInstance:
propertyPath: minTemp
value: -40
objectReference: {fileID: 0}
- target: {fileID: 254714590206475862, guid: d510e4aff5c3c419592bde28523108c6, type: 3}
propertyPath: my_renderer.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 254714590206475862, guid: d510e4aff5c3c419592bde28523108c6, type: 3}
propertyPath: my_renderer.Array.data[0]
value:
objectReference: {fileID: 1726764810}
- target: {fileID: 2639913935002386441, guid: d510e4aff5c3c419592bde28523108c6, type: 3}
propertyPath: m_LocalScale.x
value: 30
Expand Down Expand Up @@ -949,6 +966,11 @@ Rigidbody:
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!23 &1726764810 stripped
MeshRenderer:
m_CorrespondingSourceObject: {fileID: 2731441741762715894, guid: d510e4aff5c3c419592bde28523108c6, type: 3}
m_PrefabInstance: {fileID: 1726764800}
m_PrefabAsset: {fileID: 0}
--- !u!4 &1881205575 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8609862147817314095, guid: 55bb05ea30c4448c08541df2c244ee51, type: 3}
Expand Down Expand Up @@ -1076,6 +1098,14 @@ PrefabInstance:
propertyPath: currentTemp
value: 60
objectReference: {fileID: 0}
- target: {fileID: 254714590206475862, guid: d510e4aff5c3c419592bde28523108c6, type: 3}
propertyPath: my_renderer.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 254714590206475862, guid: d510e4aff5c3c419592bde28523108c6, type: 3}
propertyPath: my_renderer.Array.data[0]
value:
objectReference: {fileID: 1474360363}
- target: {fileID: 2639913935002386441, guid: d510e4aff5c3c419592bde28523108c6, type: 3}
propertyPath: m_LocalScale.x
value: 30
Expand Down Expand Up @@ -1268,13 +1298,13 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2457905636381665599}
serializedVersion: 2
m_LocalRotation: {x: 0.012102357, y: 0.00006168113, z: -0.009721105, w: 0.99987954}
m_LocalPosition: {x: 0.7, y: 4, z: -27.2}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1.43, z: -7.25}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 301557850}
m_LocalEulerAnglesHint: {x: 1.387, y: -0.006, z: -1.114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!20 &8384179340703924919
Camera:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1308,7 +1338,7 @@ Camera:
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 35.630993
field of view: 48.8
orthographic: 0
orthographic size: 5
m_Depth: -1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ public class TemperatureColorExpression : MonoBehaviour
private float currentTemp = 20f; // 現在の温度
public float alpha = 1.0f; // 透明度の設定(0.0から1.0の範囲)

public MeshRenderer[] renderer;
public MeshRenderer[] my_renderer;

private void Start()
{
for (int i = 0; i < renderer.Length; i++)
for (int i = 0; i < my_renderer.Length; i++)
{
if (alpha != 1.0)
{
// マテリアルが透明度をサポートするように設定
renderer[i].material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
renderer[i].material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
renderer[i].material.SetInt("_ZWrite", 0);
renderer[i].material.DisableKeyword("_ALPHATEST_ON");
renderer[i].material.EnableKeyword("_ALPHABLEND_ON");
renderer[i].material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
renderer[i].material.renderQueue = 3000;
my_renderer[i].material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
my_renderer[i].material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
my_renderer[i].material.SetInt("_ZWrite", 0);
my_renderer[i].material.DisableKeyword("_ALPHATEST_ON");
my_renderer[i].material.EnableKeyword("_ALPHABLEND_ON");
my_renderer[i].material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
my_renderer[i].material.renderQueue = 3000;
}
}

Expand All @@ -46,7 +46,7 @@ void UpdateColorBasedOnTemperature()
{
float t = (currentTemp - minTemp) / (maxTemp - minTemp);

for (int i = 0; i < renderer.Length; i++)
for (int i = 0; i < my_renderer.Length; i++)
{
Color color;
if (t < 0.5f) // 低温から平温へ
Expand All @@ -61,7 +61,7 @@ void UpdateColorBasedOnTemperature()
color = Color.Lerp(Color.green, Color.red, t * 2);
}
color.a = alpha;
renderer[i].material.color = color;
my_renderer[i].material.color = color;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,14 @@ public void SetTemperature(double temperature)

public void IncrementTemperatureRegion()
{
this.temperation_region_count++;
this.temperation_region_count = 1;
Debug.LogWarning("Exnter:count: " + this.temperation_region_count);
}

public void DecrementTemperatureRegion()
{
this.temperation_region_count--;
this.temperation_region_count = 0;
Debug.LogWarning("Exit:count: " + this.temperation_region_count);
}
bool IRobotProperty.IsInTemeratureRegion()
{
Expand Down

0 comments on commit a4ebe6f

Please sign in to comment.