Skip to content

Commit 8ccaff1

Browse files
committed
Update 9/6/2025
1 parent b6b0f33 commit 8ccaff1

File tree

7 files changed

+707
-600
lines changed

7 files changed

+707
-600
lines changed

Assets/MyAssets/TempAssets/Script/GAMAConnection/GAMAConnectorVU2ForestProtection.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public override void OnEnable()
1919

2020
if (!isSubscribed)
2121
{
22-
teamID = GetTeamIDAsInt();
22+
//teamID = GetTeamIDAsInt();
2323
VU2ForestProtectionEventManager.Instance.OnTreeChangeState += SendTreeStatusToGAMA;
2424
isSubscribed = true;
2525
}
@@ -49,7 +49,7 @@ private void UpdateGameManager(GAMAMessage_edit2 m)
4949
string jsonHead = m.Head;
5050
string jsonBody = m.Body;
5151
string jsonContent = m.Content;
52-
52+
Debug.Log("++++++++++++++++++++++++++++++ "+m.Head +" - "+m.Body+" - "+m.Content);
5353
switch (jsonHead)
5454
{
5555
/*case "Start":
@@ -63,6 +63,13 @@ private void UpdateGameManager(GAMAMessage_edit2 m)
6363
Debug.Log("Tutorial START");
6464
OnlineModeGameManager.Instance?.StartTutorial();
6565
break;*/
66+
case "Start":
67+
break;
68+
case "Stop":
69+
break;
70+
case "Update":
71+
VU2ForestProtectionEventManager.Instance?.UpdateTreeFromGAMA(m.Body,m.Content);
72+
break;
6673
}
6774

6875
}
@@ -99,12 +106,13 @@ private string GetTeamID()
99106

100107
public void SendTreeStatusToGAMA(string treeName, string status)
101108
{
109+
102110
Dictionary<string, string> args = new Dictionary<string, string>
103111
{
104112
{"tree_Name", treeName },
105113
{"status",status }
106114
};
107-
115+
108116
try
109117
{
110118
ConnectionManager.Instance.SendExecutableAsk("ChangeTreeState", args);

Assets/MyAssets/TempAssets/Script/GAMAConnection/VU2ForestProtectionEventManager.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ void Start()
2626

2727
}
2828

29+
public void UpdateTreeFromGAMA(string treeName, string status)
30+
{
31+
GameObject.Find(treeName)?.GetComponent<Seeding>()?.ChangeGrowState(Int32.Parse(status));
32+
}
33+
2934
public event Action<string, string> OnTreeChangeState;
3035
public void TreeChangeState(string treeName, string state)
3136
{

Assets/Resources/temp/Prefab/VU2.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)