Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Assets/CWAssets/Scripts/Battle/Trees/Trees.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ public void init(BattlePlayer player){
//use this version of init to initialize player 2, so that we dont add redundant listeners on certain buttons(ie. surrender) -Jeremy
public void init2(BattlePlayer player)
{
tree1Texture = (Texture2D)Resources.Load("Images/Battle/tree1", typeof(Texture2D));
tree2Texture = (Texture2D)Resources.Load("Images/Battle/tree2", typeof(Texture2D));
tree3Texture = (Texture2D)Resources.Load("Images/Battle/tree3", typeof(Texture2D));
this.player = player;
maxHP = hp = 30;

Expand Down
26 changes: 24 additions & 2 deletions Assets/Scripts/DontEatMe/DemTile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,17 @@ public void RemoveAnimal(){
//add statistic to tree destroy, and prey eaten
if (this.resident.GetComponent<BuildInfo> ().isPlant ()) {
buildMenu.statistic.setTreeDestroy (1);
} else if (this.resident.GetComponent<BuildInfo> ().isPrey ()) {
//player gains 1 credits for each plant eaten
Game.networkManager.Send(UpdateCreditsProtocol.Prepare((short)0, 1), ProcessUpdateCredits);
Debug.Log("old credits: " + GameState.player.credits);
Debug.Log("player awarded 1 credits.");
} else if (this.resident.GetComponent<BuildInfo> ().isPrey ()) {
buildMenu.statistic.setPreyEaten (1);
}
//player gains 15 credits for each prey eaten
Game.networkManager.Send(UpdateCreditsProtocol.Prepare((short)0, 15), ProcessUpdateCredits);
Debug.Log("old credits: " + GameState.player.credits);
Debug.Log("player awarded 15 credits.");
}

Destroy (resident);
this.resident = null;
Expand All @@ -504,4 +512,18 @@ public Vector3 GetCenter(){
return center;
}

public void ProcessUpdateCredits(NetworkResponse response)
{
ResponseUpdateCredits args = response as ResponseUpdateCredits;
Debug.Log("ResponseUpdateCredits: action= " + args.action);

if (args.status == 0)
{
GameState.player.credits = args.newCredits;
Debug.Log("new credits: " + args.newCredits);
}
else
Debug.Log("failed to update credits");
}

}
20 changes: 20 additions & 0 deletions Assets/Scripts/DontEatMe/DemTurnSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,28 @@ public int GetLives(){
public void GameOver(){
//turnLock = true;
Debug.Log ("game Over");

//let's award players 30 credits for playing - Jeremy
Game.networkManager.Send(UpdateCreditsProtocol.Prepare((short)0, 30), ProcessUpdateCredits);
Debug.Log("old credits: " + GameState.player.credits);
Debug.Log("player awarded 30 credits.");

buildMenu.EndGame ();
}

public void ProcessUpdateCredits(NetworkResponse response)
{
ResponseUpdateCredits args = response as ResponseUpdateCredits;
Debug.Log("ResponseUpdateCredits: action= " + args.action);

if (args.status == 0)
{
GameState.player.credits = args.newCredits;
Debug.Log("new credits: " + args.newCredits);
}
else
Debug.Log("failed to update credits");
}


}
10 changes: 0 additions & 10 deletions Assets/Tree_Textures.meta

This file was deleted.