Add panel worker and modification for it.

This commit is contained in:
Marc-Antoine Dumont 2015-08-13 09:36:02 -04:00
parent 47f1d52e44
commit f1d0093b5d
3 changed files with 823 additions and 27 deletions

View File

@ -7,29 +7,53 @@ public class WorkerController : MonoBehaviour{
public Text nbWorker;
public Text zombieAvailable;
public Text nbRessourceExpected;
public Button AddButton;
public Button RemoveButton;
private Stats stats;
public void AddWorker()
{
stats.AmountOfZombiesAvail --;
stats.removeZombieAvail();
stats.NbZombieAssigneWood++;
UpdateView();
}
public void LessWorker()
{
stats.AmountOfZombiesAvail ++;
stats.addZombieAvail();
stats.NbZombieAssigneWood--;
UpdateView();
}
public void UpdateView()
private void UpdateView()
{
zombieAvailable.text = stats.AmountOfZombiesAvail + "/" + stats.AmountOfZombies;
nbRessourceExpected.text = ""+stats.NbOfWoodByZombie * stats.NbZombieAssigneWood;
nbWorker.text = ""+stats.NbZombieAssigneWood;
if (stats.AmountOfZombiesAvail <= 0)
{
AddButton.enabled = false;
}
else
{
AddButton.enabled = true;
}
if (stats.NbZombieAssigneWood <= 0)
{
RemoveButton.enabled = false;
}
else
{
RemoveButton.enabled = true;
}
}
// Use this for initialization
void Start () {
Stats stats = GameObject.Find("Stats").gameObject.GetComponent<Stats>();
stats = GameObject.Find("Stats").gameObject.GetComponent<Stats>();
UpdateView();
}
// Update is called once per frame

View File

@ -1057,6 +1057,72 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 100}
m_SizeDelta: {x: 288, y: 280}
m_Pivot: {x: .5, y: .5}
--- !u!1 &357397558
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 357397559}
- 222: {fileID: 357397561}
- 114: {fileID: 357397560}
m_Layer: 5
m_Name: ZombieAvailable
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &357397559
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 357397558}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1274538320}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 100, y: 60}
m_SizeDelta: {x: 50, y: 30}
m_Pivot: {x: .5, y: .5}
--- !u!114 &357397560
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 357397558}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1}
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 20/20
--- !u!222 &357397561
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 357397558}
--- !u!1 &392002266
GameObject:
m_ObjectHideFlags: 0
@ -1090,6 +1156,72 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -20, y: 0}
m_Pivot: {x: .5, y: .5}
--- !u!1 &407819332
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 407819333}
- 222: {fileID: 407819335}
- 114: {fileID: 407819334}
m_Layer: 5
m_Name: ZombieUses
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &407819333
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 407819332}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1274538320}
m_RootOrder: 3
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 30, y: 30}
m_Pivot: {x: .5, y: .5}
--- !u!114 &407819334
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 407819332}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1}
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 0
--- !u!222 &407819335
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 407819332}
--- !u!1 &416754952
GameObject:
m_ObjectHideFlags: 0
@ -1844,6 +1976,120 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 720008153}
--- !u!1 &734311974
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 734311975}
- 222: {fileID: 734311978}
- 114: {fileID: 734311977}
- 114: {fileID: 734311976}
m_Layer: 5
m_Name: '-'
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &734311975
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 734311974}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1274538320}
m_RootOrder: 2
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: -50, y: 0}
m_SizeDelta: {x: 30, y: 30}
m_Pivot: {x: .5, y: .5}
--- !u!114 &734311976
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 734311974}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1}
m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1}
m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814}
m_ColorMultiplier: 1
m_FadeDuration: .100000001
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 734311977}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1274538321}
m_MethodName: LessWorker
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &734311977
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 734311974}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &734311978
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 734311974}
--- !u!1 &785032310
GameObject:
m_ObjectHideFlags: 0
@ -2146,6 +2392,72 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 834590761}
--- !u!1 &840893117
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 840893118}
- 222: {fileID: 840893120}
- 114: {fileID: 840893119}
m_Layer: 5
m_Name: Ressource Expected
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &840893118
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 840893117}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1806772463}
m_RootOrder: 2
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: -50, y: 0}
m_SizeDelta: {x: 140, y: 25}
m_Pivot: {x: .5, y: .5}
--- !u!114 &840893119
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 840893117}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1}
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 'Ressource Expected :'
--- !u!222 &840893120
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 840893117}
--- !u!1 &850920446
GameObject:
m_ObjectHideFlags: 0
@ -2394,7 +2706,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1086781101
RectTransform:
m_ObjectHideFlags: 0
@ -2823,6 +3135,67 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1147049695}
--- !u!1 &1162262078
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 1162262079}
- 222: {fileID: 1162262081}
- 114: {fileID: 1162262080}
m_Layer: 5
m_Name: Lumber Log
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1162262079
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1162262078}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1806772463}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 100, y: 0}
m_SizeDelta: {x: 25, y: 25}
m_Pivot: {x: .5, y: .5}
--- !u!114 &1162262080
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1162262078}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Sprite: {fileID: 21300000, guid: 7c4cb422c3b74134ebe4065b3f730558, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1162262081
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1162262078}
--- !u!1 &1167956901
GameObject:
m_ObjectHideFlags: 0
@ -2971,6 +3344,89 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1167956901}
--- !u!1 &1274538319
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 1274538320}
- 222: {fileID: 1274538323}
- 114: {fileID: 1274538322}
- 114: {fileID: 1274538321}
m_Layer: 5
m_Name: PanelZombieToWood
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &1274538320
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1274538319}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 357397559}
- {fileID: 1699403752}
- {fileID: 734311975}
- {fileID: 407819333}
- {fileID: 1806772463}
m_Father: {fileID: 1660519659}
m_RootOrder: 5
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -240, y: -100}
m_Pivot: {x: .5, y: .5}
--- !u!114 &1274538321
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1274538319}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c1c614fcc515fb7439821a2c4f19f5e9, type: 3}
m_Name:
m_EditorClassIdentifier:
nbWorker: {fileID: 407819334}
zombieAvailable: {fileID: 357397560}
nbRessourceExpected: {fileID: 1594724226}
AddButton: {fileID: 1699403753}
RemoveButton: {fileID: 734311976}
--- !u!114 &1274538322
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1274538319}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: .39199999}
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1274538323
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1274538319}
--- !u!1 &1288217755
GameObject:
m_ObjectHideFlags: 0
@ -3430,7 +3886,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1402754311
RectTransform:
m_ObjectHideFlags: 0
@ -3449,8 +3905,8 @@ RectTransform:
m_RootOrder: 3
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 112.5}
m_SizeDelta: {x: 0, y: -225}
m_Pivot: {x: .5, y: .5}
--- !u!114 &1402754312
MonoBehaviour:
@ -3683,6 +4139,72 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1510952022}
--- !u!1 &1594724224
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 1594724225}
- 222: {fileID: 1594724227}
- 114: {fileID: 1594724226}
m_Layer: 5
m_Name: Number Of Ressources
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1594724225
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1594724224}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1806772463}
m_RootOrder: 1
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 60, y: 0}
m_SizeDelta: {x: 25, y: 25}
m_Pivot: {x: .5, y: .5}
--- !u!114 &1594724226
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1594724224}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1}
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 0
--- !u!222 &1594724227
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1594724224}
--- !u!1 &1633345904
GameObject:
m_ObjectHideFlags: 0
@ -3803,6 +4325,7 @@ RectTransform:
- {fileID: 1291037626}
- {fileID: 1402754311}
- {fileID: 1086781101}
- {fileID: 1274538320}
m_Father: {fileID: 0}
m_RootOrder: 5
m_AnchorMin: {x: 0, y: 0}
@ -3942,6 +4465,120 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1677356958}
--- !u!1 &1699403751
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 1699403752}
- 222: {fileID: 1699403755}
- 114: {fileID: 1699403754}
- 114: {fileID: 1699403753}
m_Layer: 5
m_Name: +
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1699403752
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1699403751}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1274538320}
m_RootOrder: 1
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 50, y: 0}
m_SizeDelta: {x: 30, y: 30}
m_Pivot: {x: .5, y: .5}
--- !u!114 &1699403753
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1699403751}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1}
m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1}
m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814}
m_ColorMultiplier: 1
m_FadeDuration: .100000001
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1699403754}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1274538321}
m_MethodName: AddWorker
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &1699403754
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1699403751}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Sprite: {fileID: 21300000, guid: e105c9c716b637945b393dd706a12c51, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1699403755
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1699403751}
--- !u!1 &1746096027
GameObject:
m_ObjectHideFlags: 0
@ -4219,6 +4856,70 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1791556016}
--- !u!1 &1806772462
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 1806772463}
- 222: {fileID: 1806772465}
- 114: {fileID: 1806772464}
m_Layer: 5
m_Name: PanelRessourceExpected
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1806772463
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1806772462}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1162262079}
- {fileID: 1594724225}
- {fileID: 840893118}
m_Father: {fileID: 1274538320}
m_RootOrder: 4
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: .843000054, y: .786647677}
m_AnchoredPosition: {x: 20, y: -50}
m_SizeDelta: {x: 0, y: -100}
m_Pivot: {x: .5, y: .5}
--- !u!114 &1806772464
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1806772462}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: .39199999}
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1806772465
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1806772462}
--- !u!1 &1897166384
GameObject:
m_ObjectHideFlags: 0

View File

@ -1,8 +1,9 @@
using UnityEngine;
using System.Collections;
public class Stats : MonoBehaviour {
public class Stats : MonoBehaviour
{
#region attributes
private int amountOfRock;
private int amountOfWood;
private int amountOfCorpse;
@ -12,6 +13,64 @@ public class Stats : MonoBehaviour {
private int amountOfHumans;
private int amountOfZombiesAvail;
private int nbOfWoodByZombie;
private int nbOfRockByZombie;
private int nbOfMeatByZombie;
private int nbOfCorpseByZombie;
private int nbZombieAssigneWood;
private int nbZombieAssigneRock;
private int nbZombieAssigneCorpse;
private int nbZombieAssigneMeat;
public int NbZombieAssigneMeat
{
get { return nbZombieAssigneMeat;}
set { nbZombieAssigneMeat = value;}
}
public int NbZombieAssigneCorpse
{
get { return nbZombieAssigneCorpse;}
set { nbZombieAssigneCorpse = value;}
}
public int NbZombieAssigneRock
{
get { return nbZombieAssigneRock; }
set { nbZombieAssigneRock = value; }
}
public int NbZombieAssigneWood
{
get { return nbZombieAssigneWood; }
set { nbZombieAssigneWood = value; }
}
public int NbOfCorpseByZombie
{
get { return nbOfCorpseByZombie; }
set { nbOfCorpseByZombie = value; }
}
public int NbOfMeatByZombie
{
get { return nbOfMeatByZombie; }
set { nbOfMeatByZombie = value; }
}
public int NbOfRockByZombie
{
get { return nbOfRockByZombie; }
set { nbOfRockByZombie = value; }
}
public int NbOfWoodByZombie
{
get { return nbOfWoodByZombie; }
set { nbOfWoodByZombie = value; }
}
public int AmountOfMeat
{
get { return amountOfMeat; }
@ -41,7 +100,6 @@ public class Stats : MonoBehaviour {
get { return amountOfZombies; }
set { amountOfZombies = value; }
}
public int AmountOfHumans
{
get { return amountOfHumans; }
@ -54,20 +112,6 @@ public class Stats : MonoBehaviour {
set { amountOfZombiesAvail = value; }
}
public Stats(int nbRock, int nbWood, int nbCorpse, int nbMeat, int nbHumans, int nbZombies)
{
resetStats(nbRock, nbWood, nbCorpse, nbMeat, nbHumans, nbZombies);
}
public void resetStats(int nbRock, int nbWood, int nbCorpse, int nbMeat, int nbHumans, int nbZombies)
{
AmountOfCorpse = nbCorpse;
AmountOfMeat = nbMeat;
AmountOfRock = nbRock;
AmountOfWood = nbWood;
AmountOfHumans = nbHumans;
AmountOfZombies = nbZombies;
}
public void addCorpse()
{
@ -138,10 +182,37 @@ public class Stats : MonoBehaviour {
{
amountOfZombiesAvail--;
}
#endregion
public Stats(int nbRock, int nbWood, int nbCorpse, int nbMeat, int nbHumans, int nbZombies)
{
resetStats(nbRock, nbWood, nbCorpse, nbMeat, nbHumans, nbZombies, 5, 5, 5, 5);
}
public void resetStats(int nbRock, int nbWood, int nbCorpse, int nbMeat, int nbHumans, int nbZombies,
int nbOfWoodByZombie, int nbOfRockByZombie, int nbOfMeatByZombie, int nbOfCorpseByZombie)
{
AmountOfCorpse = nbCorpse;
AmountOfMeat = nbMeat;
AmountOfRock = nbRock;
AmountOfWood = nbWood;
AmountOfHumans = nbHumans;
AmountOfZombies = nbZombies;
NbOfCorpseByZombie = nbOfCorpseByZombie;
NbOfMeatByZombie = nbOfMeatByZombie;
NbOfRockByZombie = nbOfRockByZombie;
NbOfWoodByZombie = nbOfWoodByZombie;
NbZombieAssigneWood = 0;
NbZombieAssigneRock = 0;
NbZombieAssigneCorpse = 0;
NbZombieAssigneMeat = 0;
AmountOfZombiesAvail = AmountOfZombies;
}
// Use this for initialization
void Start () {
resetStats(0, 0, 0, 0, 4, 1);
resetStats(0, 0, 0, 0, 4, 1, 5, 5, 5, 5);
}
// Update is called once per frame