Item Shop Stop

This commit is contained in:
AlexE030
2023-02-07 20:55:29 +01:00
parent c6589f2d56
commit f36dd36d21
9 changed files with 163 additions and 36 deletions
+29 -18
View File
@@ -1,15 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="f0abe486-ee58-49bd-ad63-04a8b3fc78ec" name="Changes" comment="" />
<list default="true" id="f0abe486-ee58-49bd-ad63-04a8b3fc78ec" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.FlufflParty/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.FlufflParty/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Prefabs/Player.prefab" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Prefabs/Player.prefab" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Scenes/WesternMap.unity" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scenes/WesternMap.unity" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Client.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Client.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Players/NoPlayablePlayer.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Players/NoPlayablePlayer.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Players/PlayablePlayer.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Players/PlayablePlayer.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Players/Player.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Players/Player.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json" beforeDir="false" afterPath="$PROJECT_DIR$/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/UserSettings/EditorUserSettings.asset" beforeDir="false" afterPath="$PROJECT_DIR$/UserSettings/EditorUserSettings.asset" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/4746c126b0b54f3b834845974d1a9190159000/8a/b3330996/MonoBehaviour.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Client.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Client.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Fields/EventField.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Fields/Field.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Fields/GetCoinsField.cs" root0="FORCE_HIGHLIGHTING" />
@@ -18,8 +27,9 @@
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Fields/LuckField.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Fields/UnluckyField.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Fields/VSField.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Players/AnimationHandler.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Players/PlayablePlayer.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Players/AnimationHandler.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Players/NoPlayablePlayer.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Players/PlayablePlayer.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Players/Player.cs" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Players/PlayerInfoElements.cs" root0="FORCE_HIGHLIGHTING" />
</component>
@@ -31,22 +41,22 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;Discover.Launch.Via.Unity&quot;: &quot;true&quot;,
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"Discover.Launch.Via.Unity": "true",
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"WebServerToolWindowFactoryState": "false",
"vue.rearranger.settings.migration": "true"
},
&quot;keyToStringList&quot;: {
&quot;rider.external.source.directories&quot;: [
&quot;C:\\Users\\braus\\AppData\\Roaming\\JetBrains\\Rider2022.3\\resharper-host\\DecompilerCache&quot;,
&quot;C:\\Users\\braus\\AppData\\Roaming\\JetBrains\\Rider2022.3\\resharper-host\\SourcesCache&quot;,
&quot;C:\\Users\\braus\\AppData\\Local\\Symbols\\src&quot;
"keyToStringList": {
"rider.external.source.directories": [
"C:\\Users\\aer\\AppData\\Roaming\\JetBrains\\Rider2022.3\\resharper-host\\DecompilerCache",
"C:\\Users\\aer\\AppData\\Roaming\\JetBrains\\Rider2022.3\\resharper-host\\SourcesCache",
"C:\\Users\\aer\\AppData\\Local\\Symbols\\src"
]
}
}</component>
}]]></component>
<component name="RunManager" selected="Attach to Unity Editor.Attach to Unity Editor">
<configuration name="Standalone Player" type="RunUnityExe" factoryName="Unity Executable">
<option name="EXE_PATH" value="$USER_HOME$/OneDrive/Desktop/FlufflPartyBuild/FlufflParty.exe" />
@@ -120,6 +130,7 @@
<workItem from="1675541927675" duration="3056000" />
<workItem from="1675598313139" duration="8968000" />
<workItem from="1675795702707" duration="512000" />
<workItem from="1675797317461" duration="2331000" />
</task>
<servers />
</component>
+17
View File
@@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 711685448941949431}
- component: {fileID: 711685448941949430}
- component: {fileID: 711685448941949429}
- component: {fileID: 4002111064334437516}
m_Layer: 0
m_Name: Player
m_TagString: Untagged
@@ -99,6 +100,22 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!54 &4002111064334437516
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 711685448941949428}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 0
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 126
m_CollisionDetection: 0
--- !u!1 &3284309164958886127
GameObject:
m_ObjectHideFlags: 0
@@ -5020,6 +5020,51 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3283c2131aad7954fac11b8f7a76af0e, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1202275722
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1202275724}
- component: {fileID: 1202275723}
m_Layer: 0
m_Name: ItemShopTrigger
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!65 &1202275723
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1202275722}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!4 &1202275724
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1202275722}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 84.85, y: 1.08, z: 103.37}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 14
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1257267486
GameObject:
m_ObjectHideFlags: 0
+8
View File
@@ -128,6 +128,9 @@ public class Client : MonoBehaviour
case 6:
((NoPlayablePlayer)players[job.data[1]]).CoinFieldAction(job.data[2]);
break;
case 7:
((NoPlayablePlayer)players[job.data[1]]).EventStopFinished();
break;
case 126:
stream.Write(new byte[]{126, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, 10);
break;
@@ -198,4 +201,9 @@ public class Client : MonoBehaviour
{
stream.Write(new byte[]{6, (byte)action, 0, 0, 0, 0, 0, 0, 0, 0});
}
public void EventStopFinshed()
{
stream.Write(new byte[]{7, 0, 0, 0, 0, 0, 0, 0, 0, 0});
}
}
@@ -21,6 +21,8 @@ public class NoPlayablePlayer : Player
private float timeSinceWurfeln = 0;
private Vector3 useLess = new Vector3();
public override void Init()
{
@@ -142,9 +144,17 @@ public class NoPlayablePlayer : Player
//Bewegt den Player von einem Punkt(lastPos) zu einem anderen Punkt(moveTo) mit konstanter Geschwindigkeit
private void InterPolerate()
{
nextPoint = Vector3.Lerp(lastPos, moveTo, interPol);
transform.position = new Vector3(nextPoint.x, transform.position.y, nextPoint.z);
interPol += (Time.deltaTime * speed) / Mathf.Abs(Vector3.Distance(moveTo, lastPos));
if (!eventstop)
{
nextPoint = Vector3.Lerp(lastPos, moveTo, interPol);
transform.position = new Vector3(nextPoint.x, transform.position.y, nextPoint.z);
interPol += (Time.deltaTime * speed) / Mathf.Abs(Vector3.Distance(moveTo, lastPos));
}
}
public void EventStopFinshed()
{
eventstop = false;
}
}
@@ -14,9 +14,9 @@ public class PlayablePlayer : Player
private float speed = 5;
private float interPol = 0;
private int wurfelZahl = 0;
private bool wait = false;
private float timeSinceWurfeln = 0;
private float timeSinceStop = 0;
@@ -28,7 +28,7 @@ public class PlayablePlayer : Player
public override void Init()
{
GetComponentInChildren<TMP_Text>().text = name;
activated = false;
QualitySettings.vSyncCount = 0;
Application.targetFrameRate = 61;
@@ -37,16 +37,21 @@ public class PlayablePlayer : Player
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
eventstop = false;
}
if (activated && !name.Equals(""))
{
//Generiere Würfelzahl von 1-6 wenn gerade gewürfelt werden darf
if ((Input.GetMouseButtonDown(0)) && wurfelZahl == 0 && !wurfelt)
{
wurfelt = true;
wurfelZahl = Random.Range(1, 7);
wurfelZahl = Random.Range(6, 7);
client.SendWurfeln(wurfelZahl);
//nächstes Feld anvisieren
TargetNextField();
@@ -63,8 +68,9 @@ public class PlayablePlayer : Player
{
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
@@ -83,7 +89,7 @@ public class PlayablePlayer : Player
//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)
{
@@ -109,7 +115,7 @@ public class PlayablePlayer : Player
AddCoins(-3);
break;
}
Invoke("Finish", 2);
activated = false;
}
@@ -132,7 +138,7 @@ public class PlayablePlayer : Player
if (nextField.DirectionalArrow[0].IsClicked())
{
client.SendArrowSelected(0);
foreach (Arrow a in nextField.DirectionalArrow)
{
a.Deactivate();
@@ -177,15 +183,20 @@ public class PlayablePlayer : Player
//Bewegt den Player von einem Punkt(lastPos) zu einem anderen Punkt(moveTo) mit konstanter Geschwindigkeit
private Vector3 nextPoint;
private void InterPolerate()
{
nextPoint = Vector3.Lerp(lastPos, moveTo, interPol);
transform.position = new Vector3(nextPoint.x, transform.position.y, nextPoint.z);
interPol += (Time.deltaTime * speed) / Mathf.Abs(Vector3.Distance(moveTo, lastPos));
if (!eventstop)
{
nextPoint = Vector3.Lerp(lastPos, moveTo, interPol);
transform.position = new Vector3(nextPoint.x, transform.position.y, nextPoint.z);
interPol += (Time.deltaTime * speed) / Mathf.Abs(Vector3.Distance(moveTo, lastPos));
}
}
private void Finish()
{
client.SendFinished();
}
}
@@ -17,6 +17,7 @@ public abstract class Player : MonoBehaviour
public int index;
public int coins = 0;
public TMP_Text textCoinsInfo;
protected bool eventstop = false;
//for coin animation
private AnimationHandler animationHandler;
@@ -61,4 +62,9 @@ public abstract class Player : MonoBehaviour
textCoinsInfo.text = coins + "";
PlayAnimation(AnimationType.Coin);
}
private void OnTriggerEnter(Collider c)
{
eventstop = true;
}
}
+10 -1
View File
@@ -9,7 +9,16 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="6d89163f-4054-4765-8ee3-ac6da16b6997" name="Changes" comment="" />
<list default="true" id="6d89163f-4054-4765-8ee3-ac6da16b6997" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/../FlufflParty/.idea/.idea.FlufflParty/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../FlufflParty/.idea/.idea.FlufflParty/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../FlufflParty/Assets/Prefabs/Player.prefab" beforeDir="false" afterPath="$PROJECT_DIR$/../FlufflParty/Assets/Prefabs/Player.prefab" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../FlufflParty/Assets/Scenes/WesternMap.unity" beforeDir="false" afterPath="$PROJECT_DIR$/../FlufflParty/Assets/Scenes/WesternMap.unity" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../FlufflParty/Assets/Scripts/Players/PlayablePlayer.cs" beforeDir="false" afterPath="$PROJECT_DIR$/../FlufflParty/Assets/Scripts/Players/PlayablePlayer.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../FlufflParty/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json" beforeDir="false" afterPath="$PROJECT_DIR$/../FlufflParty/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../FlufflParty/UserSettings/EditorUserSettings.asset" beforeDir="false" afterPath="$PROJECT_DIR$/../FlufflParty/UserSettings/EditorUserSettings.asset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Room.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Room.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+10
View File
@@ -167,6 +167,16 @@ public class Room
}
}
break;
case 7:
for (int i = 0; i < players.length; i++)
{
if (i != player)
{
players[i].output.write(new byte[]{7, (byte)player, 0, 0, 0, 0, 0, 0, 0, 0});
}
}
break;
case 126:
players[player].lastTimeSendTimeOutCheck = System.currentTimeMillis();
break;