Color Dice based on Item

This commit is contained in:
brausjonas
2023-04-14 23:01:04 +02:00
parent d63c43deb5
commit 481f0d1577
12 changed files with 255 additions and 34 deletions
+1 -1
View File
@@ -165,7 +165,7 @@
<workItem from="1680813239896" duration="4155000" />
<workItem from="1681056387914" duration="882000" />
<workItem from="1681415672515" duration="5000" />
<workItem from="1681479671396" duration="8956000" />
<workItem from="1681479671396" duration="10055000" />
</task>
<servers />
</component>
@@ -0,0 +1,80 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Dice3
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.25943398, g: 0.8374978, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 65c98776af70e114e805be306f2f8350
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,80 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Dice4
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 0.28311464, b: 0.2588235, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 21c33fce8dc2d6445a68ef6d6bce8ea0
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
@@ -37835,6 +37835,22 @@ PrefabInstance:
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2180264, guid: d06671affd8526948a76e0ac9aae126e, type: 2}
- target: {fileID: 6391402203742902167, guid: 06e960ba226dd6e4c972ec724166cc0d, type: 3}
propertyPath: materials.Array.size
value: 3
objectReference: {fileID: 0}
- target: {fileID: 6391402203742902167, guid: 06e960ba226dd6e4c972ec724166cc0d, type: 3}
propertyPath: materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 45b47f99d1549dd409d0132b7f4e23ab, type: 2}
- target: {fileID: 6391402203742902167, guid: 06e960ba226dd6e4c972ec724166cc0d, type: 3}
propertyPath: materials.Array.data[1]
value:
objectReference: {fileID: 2100000, guid: 65c98776af70e114e805be306f2f8350, type: 2}
- target: {fileID: 6391402203742902167, guid: 06e960ba226dd6e4c972ec724166cc0d, type: 3}
propertyPath: materials.Array.data[2]
value:
objectReference: {fileID: 2100000, guid: 21c33fce8dc2d6445a68ef6d6bce8ea0, type: 2}
- target: {fileID: 6528083627130749425, guid: 06e960ba226dd6e4c972ec724166cc0d, type: 3}
propertyPath: m_fontAsset
value:
@@ -12,12 +12,20 @@ public class Dice : MonoBehaviour
[SerializeField] private Rigidbody rb;
private bool started;
private float timeLastNumberChanged = 0;
//0 = default, 1 = double dice, 2 = red
[SerializeField] private Material[] materials;
private Renderer renderer;
public void SetMaterial(int mat)
{
renderer.material = materials[mat];
}
private void Start()
{
rb.useGravity = false;
gameObject.SetActive(false);
renderer = GetComponent<Renderer>();
}
private void Update()
@@ -66,4 +74,6 @@ public class Dice : MonoBehaviour
t.text = random.ToString();
}
}
}
+5
View File
@@ -40,6 +40,8 @@ public class Client : MonoBehaviour
[SerializeField] private Image imageCurrentItem;
[SerializeField] private Image[] playerItemInfoImages;
private Dice diceScript;
//Icon
[SerializeField] private Image[] playerIconInfoImages;
[SerializeField] private Sprite[] playerIconInfoImagesPrefabs;
@@ -61,6 +63,8 @@ public class Client : MonoBehaviour
private void Start()
{
diceScript = dice.GetComponent<Dice>();
Application.targetFrameRate = 60;
thisClient = this;
@@ -225,6 +229,7 @@ public class Client : MonoBehaviour
//---------------------------------------------------------
//-----Activate a Player
case 2:
diceScript.SetMaterial(0);
Activate(job.data[1]);
break;
//Jemand hat gewürfelt
@@ -97,6 +97,8 @@ public class NoPlayablePlayer : Player
public void Wurfeln(int wurfelZahl)
{
diceScript.SetMaterial(0);
jumpRequest = true;
wurfelt = true;
@@ -104,8 +106,16 @@ public class NoPlayablePlayer : Player
switch (activeItem)
{
case Item.Type.Mushroom: wurfelZahl += 3; activeItem = Item.Type.None; break;
case Item.Type.DoubleDice: checkDoubleDice = true; activeItem = Item.Type.None; break;
case Item.Type.Mushroom:
wurfelZahl += 3;
activeItem = Item.Type.None;
diceScript.SetMaterial(2);
break;
case Item.Type.DoubleDice:
checkDoubleDice = true;
activeItem = Item.Type.None;
diceScript.SetMaterial(1);
break;
}
//nächstes Feld anvisieren
@@ -134,10 +144,10 @@ public class NoPlayablePlayer : Player
private void FixedUpdate()
{
if (activated && !name.Equals(""))
{
camera.transform.position = Vector3.SmoothDamp(camera.transform.position, transform.position + cameraOffset, ref velocity, 0.2f);
camera.transform.position = Vector3.SmoothDamp(camera.transform.position, transform.position + cameraOffset,
ref velocity, 0.2f);
if (!wait)
{
//Laufe zum nöchsten Feld, falls noch Züge übrig sind
@@ -249,6 +259,7 @@ public class NoPlayablePlayer : Player
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * rotationDamping);
}
//END
transform.position = new Vector3(nextPoint.x, transform.position.y, nextPoint.z);
interPol += (Time.deltaTime * speed) / Mathf.Abs(Vector3.Distance(moveTo, lastPos));
@@ -107,6 +107,8 @@ public class PlayablePlayer : Player
private void DiceRollRoutine()
{
diceScript.SetMaterial(0);
jumpRequest = true;
wurfelt = true;
@@ -117,10 +119,12 @@ public class PlayablePlayer : Player
case Item.Type.Mushroom:
wurfelZahl += 3;
activeItem = Item.Type.None;
diceScript.SetMaterial(2);
break;
case Item.Type.DoubleDice:
checkDoubleDice = true;
activeItem = Item.Type.None;
diceScript.SetMaterial(1);
break;
}
@@ -399,6 +403,7 @@ public class PlayablePlayer : Player
private void Finish()
{
imageCurrentItem.color = new Color(0, 0, 0, 0);
diceScript.SetMaterial(0);
client.SendFinished();
}
@@ -97,8 +97,6 @@ public abstract class Player : MonoBehaviour
break;
}
}
Debug.Log(item.type);
}
public void ActivateItem(int index)
+1 -1
View File
@@ -101,7 +101,7 @@
<workItem from="1681130452664" duration="6192000" />
<workItem from="1681217780586" duration="94000" />
<workItem from="1681218296017" duration="162000" />
<workItem from="1681481242206" duration="3770000" />
<workItem from="1681481242206" duration="4364000" />
</task>
<servers />
</component>