Color Dice based on Item
This commit is contained in:
+1
-1
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -39,6 +39,8 @@ public class Client : MonoBehaviour
|
||||
|
||||
[SerializeField] private Image imageCurrentItem;
|
||||
[SerializeField] private Image[] playerItemInfoImages;
|
||||
|
||||
private Dice diceScript;
|
||||
|
||||
//Icon
|
||||
[SerializeField] private Image[] playerIconInfoImages;
|
||||
@@ -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
|
||||
|
||||
@@ -15,7 +15,7 @@ public class NoPlayablePlayer : Player
|
||||
private float interPol = 0;
|
||||
private int wurfelZahl = 0;
|
||||
public Client client;
|
||||
|
||||
|
||||
private bool wait = false;
|
||||
private bool lastActivated = false;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class NoPlayablePlayer : Player
|
||||
private Vector3 useLess = new Vector3();
|
||||
|
||||
private bool checkDoubleDice = false;
|
||||
|
||||
|
||||
//Animation:
|
||||
private Vector3 lastPosAnim = Vector3.zero;
|
||||
private bool jumpRequest = false;
|
||||
@@ -35,7 +35,7 @@ public class NoPlayablePlayer : Player
|
||||
{
|
||||
TMP_Text[] playerTexts = GetComponentsInChildren<TMP_Text>();
|
||||
playerTexts[0].text = playerTexts[1].text = name;
|
||||
|
||||
|
||||
activated = false;
|
||||
diceScript = dice.GetComponent<Dice>();
|
||||
}
|
||||
@@ -54,13 +54,13 @@ public class NoPlayablePlayer : Player
|
||||
{
|
||||
animator.SetInteger("value", 1);
|
||||
}
|
||||
else if(jumpRequest)
|
||||
else if (jumpRequest)
|
||||
{
|
||||
jumpRequest = false;
|
||||
animator.SetInteger("value", 2);
|
||||
lastTimeDoneIdleAction = Time.time;
|
||||
}
|
||||
else if(Time.time - lastTimeDoneIdleAction > idleActionDelay)
|
||||
else if (Time.time - lastTimeDoneIdleAction > idleActionDelay)
|
||||
{
|
||||
lastTimeDoneIdleAction = Time.time;
|
||||
idleActionDelay = Random.Range(2f, 5f);
|
||||
@@ -72,7 +72,7 @@ public class NoPlayablePlayer : Player
|
||||
animator.SetInteger("value", 0);
|
||||
}
|
||||
//END
|
||||
|
||||
|
||||
lastPosAnim = transform.position;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class NoPlayablePlayer : Player
|
||||
AddCoins(-20);
|
||||
AddStars(1);
|
||||
}
|
||||
|
||||
|
||||
public void CoinFieldAction(int action)
|
||||
{
|
||||
if (action == 0)
|
||||
@@ -97,17 +97,27 @@ public class NoPlayablePlayer : Player
|
||||
|
||||
public void Wurfeln(int wurfelZahl)
|
||||
{
|
||||
jumpRequest = true;
|
||||
diceScript.SetMaterial(0);
|
||||
|
||||
jumpRequest = true;
|
||||
|
||||
wurfelt = true;
|
||||
this.wurfelZahl = wurfelZahl;
|
||||
|
||||
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
|
||||
TargetNextField();
|
||||
|
||||
@@ -125,19 +135,19 @@ public class NoPlayablePlayer : Player
|
||||
{
|
||||
a.Deactivate();
|
||||
}
|
||||
|
||||
nextField = nextField.Target[idx];
|
||||
|
||||
nextField = nextField.Target[idx];
|
||||
moveTo = nextField.transform.position;
|
||||
wait = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
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
|
||||
@@ -156,12 +166,12 @@ public class NoPlayablePlayer : Player
|
||||
InterPolerate();
|
||||
wurfelZahl--;
|
||||
textLeftMoves.text = wurfelZahl + "";
|
||||
|
||||
|
||||
//the next field is the current field XD
|
||||
currentField = nextField;
|
||||
|
||||
//Visiere das nächste Feld an falls noch ein Zug übrig ist (Player steht gerade auf einem Feld oder läuft darüber)
|
||||
if (wurfelZahl > 0)
|
||||
if (wurfelZahl > 0)
|
||||
{
|
||||
TargetNextField();
|
||||
}
|
||||
@@ -174,8 +184,8 @@ public class NoPlayablePlayer : Player
|
||||
if (currentField.placedItem != null)
|
||||
{
|
||||
Trap t = currentField.placedItem.GetComponent<Trap>();
|
||||
|
||||
if(t.target.index != index)
|
||||
|
||||
if (t.target.index != index)
|
||||
{
|
||||
int coinsAmount = (int)(coins * 0.1f);
|
||||
AddCoins(-coinsAmount);
|
||||
@@ -189,18 +199,18 @@ public class NoPlayablePlayer : Player
|
||||
Vector3 currentRotation = Quaternion.ToEulerAngles(transform.rotation);
|
||||
currentRotation.y = -34;
|
||||
transform.rotation = Quaternion.Euler(currentRotation);
|
||||
|
||||
|
||||
|
||||
|
||||
if (!wurfelt)
|
||||
{
|
||||
StartDice();
|
||||
StartDice();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (checkDoubleDice)
|
||||
{
|
||||
checkDoubleDice = false;
|
||||
wurfelt = false;
|
||||
wurfelt = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,12 +253,13 @@ public class NoPlayablePlayer : Player
|
||||
//Rotation in move direction
|
||||
Vector3 lookPos = nextPoint - transform.position;
|
||||
lookPos.y = 0;
|
||||
if(lookPos != Vector3.zero)
|
||||
if (lookPos != Vector3.zero)
|
||||
{
|
||||
Quaternion rotation = Quaternion.LookRotation(lookPos);
|
||||
|
||||
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));
|
||||
@@ -256,7 +267,7 @@ public class NoPlayablePlayer : Player
|
||||
}
|
||||
|
||||
private Star currentStar;
|
||||
|
||||
|
||||
private void OnTriggerEnter(Collider collider)
|
||||
{
|
||||
if (collider.name.Equals("ItemShopTrigger"))
|
||||
@@ -267,7 +278,7 @@ public class NoPlayablePlayer : Player
|
||||
{
|
||||
currentStar = collider.GetComponent<Star>();
|
||||
|
||||
if(currentStar.IsActive)
|
||||
if (currentStar.IsActive)
|
||||
{
|
||||
base.OnTriggerEnter(collider);
|
||||
}
|
||||
@@ -286,4 +297,4 @@ public class NoPlayablePlayer : Player
|
||||
{
|
||||
itemInfoImages[index].color = new Color(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
Generated
+1
-1
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user