Skip to content

Commit 5352991

Browse files
mat.aulesmat.aules
authored andcommitted
Merge remote-tracking branch 'origin/dev' into TeamSelection
2 parents 00c13e8 + dbb1fbb commit 5352991

File tree

6 files changed

+128
-73
lines changed

6 files changed

+128
-73
lines changed

SlothWars/Assets/Scenes/default_scene.unity

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ RenderSettings:
3838
m_ReflectionIntensity: 1
3939
m_CustomReflection: {fileID: 0}
4040
m_Sun: {fileID: 0}
41-
m_IndirectSpecularColor: {r: 0.44657856, g: 0.49641234, b: 0.57481724, a: 1}
41+
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
4242
--- !u!157 &3
4343
LightmapSettings:
4444
m_ObjectHideFlags: 0
@@ -77,17 +77,15 @@ LightmapSettings:
7777
m_PVRDirectSampleCount: 32
7878
m_PVRSampleCount: 500
7979
m_PVRBounces: 2
80-
m_PVRFilterTypeDirect: 0
81-
m_PVRFilterTypeIndirect: 0
82-
m_PVRFilterTypeAO: 0
80+
m_PVRFiltering: 0
8381
m_PVRFilteringMode: 1
8482
m_PVRCulling: 1
8583
m_PVRFilteringGaussRadiusDirect: 1
8684
m_PVRFilteringGaussRadiusIndirect: 5
8785
m_PVRFilteringGaussRadiusAO: 2
88-
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
89-
m_PVRFilteringAtrousPositionSigmaIndirect: 2
90-
m_PVRFilteringAtrousPositionSigmaAO: 1
86+
m_PVRFilteringAtrousColorSigma: 1
87+
m_PVRFilteringAtrousNormalSigma: 1
88+
m_PVRFilteringAtrousPositionSigma: 1
9189
m_LightingDataAsset: {fileID: 0}
9290
m_UseShadowmask: 1
9391
--- !u!196 &4
@@ -299,7 +297,12 @@ Prefab:
299297
objectReference: {fileID: 0}
300298
- target: {fileID: 1878489649262260, guid: 49710df063248494fbb28fe741dc775b, type: 2}
301299
propertyPath: m_Name
302-
value: gunSlothTeamA
300+
value: GUN
301+
objectReference: {fileID: 0}
302+
- target: {fileID: 114500882488181320, guid: 49710df063248494fbb28fe741dc775b,
303+
type: 2}
304+
propertyPath: m_Enabled
305+
value: 0
303306
objectReference: {fileID: 0}
304307
m_RemovedComponents: []
305308
m_ParentPrefab: {fileID: 100100000, guid: 49710df063248494fbb28fe741dc775b, type: 2}
@@ -804,6 +807,19 @@ MonoBehaviour:
804807
m_Script: {fileID: 11500000, guid: 9217be4c5654d8545809336a807839ac, type: 3}
805808
m_Name:
806809
m_EditorClassIdentifier:
810+
--- !u!114 &479133157
811+
MonoBehaviour:
812+
m_ObjectHideFlags: 0
813+
m_PrefabParentObject: {fileID: 0}
814+
m_PrefabInternal: {fileID: 0}
815+
m_GameObject: {fileID: 479133150}
816+
m_Enabled: 1
817+
m_EditorHideFlags: 0
818+
m_Script: {fileID: 11500000, guid: 43b2eecf02afb5e44a261d2f02b03a2b, type: 3}
819+
m_Name:
820+
m_EditorClassIdentifier:
821+
Projectile: {fileID: 1897508314032064, guid: 37ba6968a8d4194479ad619a3904d2e1, type: 2}
822+
ForceBar: {fileID: 1638866425143238, guid: bac708725c5b2d94ba3edc48c75ec110, type: 2}
807823
--- !u!1 &491567807
808824
GameObject:
809825
m_ObjectHideFlags: 0
@@ -2092,6 +2108,19 @@ Rigidbody:
20922108
m_Interpolate: 0
20932109
m_Constraints: 112
20942110
m_CollisionDetection: 0
2111+
--- !u!114 &1441490849
2112+
MonoBehaviour:
2113+
m_ObjectHideFlags: 0
2114+
m_PrefabParentObject: {fileID: 0}
2115+
m_PrefabInternal: {fileID: 0}
2116+
m_GameObject: {fileID: 1441490842}
2117+
m_Enabled: 1
2118+
m_EditorHideFlags: 0
2119+
m_Script: {fileID: 11500000, guid: 43b2eecf02afb5e44a261d2f02b03a2b, type: 3}
2120+
m_Name:
2121+
m_EditorClassIdentifier:
2122+
Projectile: {fileID: 1897508314032064, guid: 37ba6968a8d4194479ad619a3904d2e1, type: 2}
2123+
ForceBar: {fileID: 1638866425143238, guid: bac708725c5b2d94ba3edc48c75ec110, type: 2}
20952124
--- !u!1 &1442695950
20962125
GameObject:
20972126
m_ObjectHideFlags: 0
@@ -2444,7 +2473,12 @@ Prefab:
24442473
objectReference: {fileID: 0}
24452474
- target: {fileID: 1878489649262260, guid: 49710df063248494fbb28fe741dc775b, type: 2}
24462475
propertyPath: m_Name
2447-
value: gunSlothTeamB
2476+
value: GUN
2477+
objectReference: {fileID: 0}
2478+
- target: {fileID: 114500882488181320, guid: 49710df063248494fbb28fe741dc775b,
2479+
type: 2}
2480+
propertyPath: m_Enabled
2481+
value: 0
24482482
objectReference: {fileID: 0}
24492483
m_RemovedComponents: []
24502484
m_ParentPrefab: {fileID: 100100000, guid: 49710df063248494fbb28fe741dc775b, type: 2}

SlothWars/Assets/Scripts/ChangeTurn.cs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@ private void Start()
2626
slothTurnB = 0;
2727

2828
slothTeamA = new List<GameObject>();
29-
gunSlothTeamA = new List<GameObject>();
29+
//gunSlothTeamA = new List<GameObject>();
3030

3131
slothTeamB = new List<GameObject>();
32-
gunSlothTeamB = new List<GameObject>();
32+
//gunSlothTeamB = new List<GameObject>();
3333

3434
managerTeam = GameObject.Find("managerTeam");
3535
}
3636

3737
private void Update()
3838
{
3939
slothTeamA = managerTeam.GetComponent<CreateSloth>().teamA;
40-
gunSlothTeamA = managerTeam.GetComponent<CreateSloth>().gunsTeamA;
40+
//gunSlothTeamA = managerTeam.GetComponent<CreateSloth>().gunsTeamA;
4141

4242
slothTeamB = managerTeam.GetComponent<CreateSloth>().teamB;
43-
gunSlothTeamB = managerTeam.GetComponent<CreateSloth>().gunsTeamB;
43+
//gunSlothTeamB = managerTeam.GetComponent<CreateSloth>().gunsTeamB;
4444

4545
}
4646

@@ -51,43 +51,44 @@ public void DeactivateAllExceptOne(List<GameObject> slothTeamA, List<GameObject>
5151
{
5252
sloth.GetComponent<Animator>().enabled = false;
5353
sloth.GetComponent<player>().enabled = false;
54-
54+
sloth.GetComponent<ShotScript>().enabled = false;
5555
}
5656

57-
foreach (GameObject gun in gunSlothTeamB)
57+
/*foreach (GameObject gun in gunSlothTeamB)
5858
{
5959
gun.GetComponent<ShotScript>().enabled = false;
60-
}
60+
}*/
6161

6262
for (int i = 1; i<slothTeamA.Count; i++)
6363
{
6464
slothTeamA[i].GetComponent<Animator>().enabled = false;
6565
slothTeamA[i].GetComponent<player>().enabled = false;
66+
slothTeamA[i].GetComponent<ShotScript>().enabled = false;
6667
}
67-
68+
/*
6869
for (int i = 1; i < slothTeamA.Count; i++)
6970
{
7071
gunSlothTeamA[i].GetComponent<ShotScript>().enabled = false;
7172
72-
}
73+
}*/
7374
}
7475

7576
// Functions to activate and deactivate sloth's animations
76-
private void ActivateSloth(GameObject slothTeam, GameObject gunTeamSloth)
77+
private void ActivateSloth(GameObject slothTeam)
7778
{
7879
slothTeam.GetComponent<Animator>().enabled = true;
7980
slothTeam.GetComponent<player>().enabled = true;
80-
gunTeamSloth.GetComponent<ShotScript>().enabled = true;
81+
slothTeam.GetComponent<ShotScript>().enabled = true;
8182

8283

8384
}
8485

85-
private void DeactivateSloth(GameObject slothTeam, GameObject gunTeamSloth)
86+
private void DeactivateSloth(GameObject slothTeam)
8687
{
8788

8889
slothTeam.GetComponent<Animator>().enabled = false;
8990
slothTeam.GetComponent<player>().enabled = false;
90-
gunTeamSloth.GetComponent<ShotScript>().enabled = false;
91+
slothTeam.GetComponent<ShotScript>().enabled = false;
9192

9293

9394
}
@@ -105,8 +106,8 @@ public void FinishTurn()
105106
if (endTurnOfSloth)
106107
{
107108
endTurnOfSloth = false;
108-
DeactivateSloth(slothTeamB[slothTurnB], gunSlothTeamA[slothTurnB]);
109-
ActivateSloth(slothTeamA[slothTurnA], gunSlothTeamA[slothTurnA]);
109+
DeactivateSloth(slothTeamB[slothTurnB]); // DeactivateSloth(slothTeamB[slothTurnB], gunSlothTeamA[slothTurnB])
110+
ActivateSloth(slothTeamA[slothTurnA]);
110111
slothTurnB += 1;
111112
if(slothTurnB == slothTeamB.Count)
112113
{
@@ -120,8 +121,8 @@ it will change the variable to false.*/
120121
else
121122
{
122123
endTurnOfSloth = true;
123-
DeactivateSloth(slothTeamA[slothTurnA], gunSlothTeamA[slothTurnA]);
124-
ActivateSloth(slothTeamB[slothTurnB], gunSlothTeamB[slothTurnB]);
124+
DeactivateSloth(slothTeamA[slothTurnA]);
125+
ActivateSloth(slothTeamB[slothTurnB]);
125126
slothTurnA += 1;
126127
if (slothTurnA == slothTeamA.Count)
127128
{

SlothWars/Assets/Scripts/CreateSloth.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ public class CreateSloth : MonoBehaviour {
1313
void Start(){
1414

1515
teamA = new List<GameObject>();
16-
gunsTeamA = new List<GameObject>();
16+
//gunsTeamA = new List<GameObject>();
1717

1818
teamB = new List<GameObject>();
19-
gunsTeamB = new List<GameObject>();
19+
//gunsTeamB = new List<GameObject>();
2020

2121
slothTeamA = GameObject.Find ("avatarSlothTeamA");
2222
teamA.Add(slothTeamA);
2323

24-
gunSlothTeamA = GameObject.Find("gunSlothTeamA");
25-
gunsTeamA.Add(gunSlothTeamA);
24+
//gunSlothTeamA = GameObject.Find("gunSlothTeamA");
25+
//gunsTeamA.Add(gunSlothTeamA);
2626

2727

2828
slothTeamB = GameObject.Find ("avatarSlothTeamB");
2929
teamB.Add(slothTeamB);
3030

31-
gunSlothTeamB = GameObject.Find("gunSlothTeamB");
32-
gunsTeamB.Add(gunSlothTeamB);
31+
//gunSlothTeamB = GameObject.Find("gunSlothTeamB");
32+
//gunsTeamB.Add(gunSlothTeamB);
3333

3434

3535
CreateTeamA ();
@@ -39,26 +39,26 @@ void Start(){
3939
public void CreateTeamA(){
4040
for (int i = 0; i < 3; i++) {
4141
GameObject newSlothTeamA = Instantiate(slothTeamA);
42-
GameObject newGunTeamA = Instantiate(gunSlothTeamA);
42+
//GameObject newGunTeamA = Instantiate(gunSlothTeamA);
4343

4444
newSlothTeamA.transform.position = new Vector3 (-teamA.Count - 1, 0.5F, 0);
45-
newGunTeamA.transform.position = new Vector3(-gunsTeamA.Count - 1, 0.5F, 0);
45+
//newGunTeamA.transform.position = new Vector3(-gunsTeamA.Count - 1, 0.5F, 0);
4646

4747
teamA.Add (newSlothTeamA);
48-
gunsTeamA.Add(newGunTeamA);
48+
//gunsTeamA.Add(newGunTeamA);
4949
}
5050
}
5151

5252
public void CreateTeamB(){
5353
for (int i = 0; i < 3; i++) {
5454
GameObject newSlothTeamB = Instantiate(slothTeamB);
55-
GameObject newGunTeamB = Instantiate(gunSlothTeamB);
55+
//GameObject newGunTeamB = Instantiate(gunSlothTeamB);
5656

5757
newSlothTeamB.transform.position = new Vector3 (teamB.Count + 1, 0.5F, 0);
58-
newGunTeamB.transform.position = new Vector3(+gunsTeamB.Count + 1, 0.5F, 0);
58+
//newGunTeamB.transform.position = new Vector3(+gunsTeamB.Count + 1, 0.5F, 0);
5959

6060
teamB.Add (newSlothTeamB);
61-
gunsTeamB.Add(newGunTeamB);
61+
//gunsTeamB.Add(newGunTeamB);
6262
}
6363
}
6464

@@ -68,13 +68,13 @@ public void CreateSlothTeamA () {
6868
{
6969

7070
GameObject newSlothTeamA = Instantiate(slothTeamA);
71-
GameObject newGunTeamA = Instantiate(gunSlothTeamA);
71+
//GameObject newGunTeamA = Instantiate(gunSlothTeamA);
7272

7373
newSlothTeamA.transform.position = new Vector3 (-teamA.Count - 1, 0.5F, 0);
74-
newGunTeamA.transform.position = new Vector3(-gunsTeamA.Count - 1, 0.5F, 0);
74+
//newGunTeamA.transform.position = new Vector3(-gunsTeamA.Count - 1, 0.5F, 0);
7575

7676
teamA.Add (newSlothTeamA);
77-
gunsTeamA.Add(newGunTeamA);
77+
//gunsTeamA.Add(newGunTeamA);
7878
}
7979

8080
}
@@ -98,13 +98,13 @@ public void CreateSlothTeamB () {
9898
{
9999

100100
GameObject newSlothTeamB = Instantiate(slothTeamB);
101-
GameObject newGunTeamB = Instantiate(gunSlothTeamB);
101+
//GameObject newGunTeamB = Instantiate(gunSlothTeamB);
102102

103103
newSlothTeamB.transform.position = new Vector3 (+teamB.Count + 1, 0.5F, 0);
104-
newGunTeamB.transform.position = new Vector3(-gunsTeamB.Count - 1, 0.5F, 0);
104+
//newGunTeamB.transform.position = new Vector3(-gunsTeamB.Count - 1, 0.5F, 0);
105105

106106
teamB.Add (newSlothTeamB);
107-
gunsTeamB.Add(newGunTeamB);
107+
//gunsTeamB.Add(newGunTeamB);
108108

109109
}
110110

SlothWars/Assets/Scripts/HealthScript.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ void Start () {
1313
}
1414
// Update is called once per frame
1515
void Update () {
16-
float inputH = Input.GetAxis("Horizontal");
17-
if (inputH > 0)
18-
{
19-
text.transform.eulerAngles = new Vector3(0, 0, 0);
20-
text.transform.localPosition = new Vector3(0, 3, -0.5f);
21-
}
22-
if (inputH < 0)
23-
{
24-
text.transform.eulerAngles = new Vector3(0, 360,0);
25-
text.transform.localPosition = new Vector3(0, 3, 0.5f);
26-
}
16+
2717
}
2818
public void TakeDamage(int d)
2919
{
3020
health -= d;
3121
text.text = "" + health;
3222
}
23+
public void turnRight()
24+
{
25+
text.transform.eulerAngles = new Vector3(0, 0, 0);
26+
text.transform.localPosition = new Vector3(0, 3, -0.5f);
27+
}
28+
public void turnLeft()
29+
{
30+
text.transform.eulerAngles = new Vector3(0, 360, 0);
31+
text.transform.localPosition = new Vector3(0, 3, 0.5f);
32+
}
3333
}

SlothWars/Assets/Scripts/ShotScript.cs

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,37 @@ public class ShotScript : MonoBehaviour {
99
private int rotate = 0;
1010
private float baseForce= 700;
1111
bool shotLoad = false;
12+
bool mov = false;
1213
ForceBarScript st;
1314
//initialization
1415
void Start () {
15-
gun = GetComponent<Transform>();
16+
gun = this.GetComponentInChildren<Transform>().Find("GUN");
1617

1718
}
1819
// creates a force bar with the first Q , shoots with the second Q and aims with the vertical axis
1920
void Update () {
20-
gun.Rotate(0 , 0, Time.deltaTime * Input.GetAxis("Vertical")*100);
21-
float inputH = Input.GetAxis("Horizontal");
22-
if (inputH > 0)
21+
if (!mov)
2322
{
24-
rotate = 0;
25-
}
26-
if (inputH < 0)
27-
{
28-
rotate = 1;
29-
}
30-
if (Input.GetKeyDown(KeyCode.Q))
31-
{
32-
if (!shotLoad)
23+
gun.Rotate(0, 0, Time.deltaTime * Input.GetAxis("Vertical") * 100);
24+
float inputH = Input.GetAxis("Horizontal");
25+
if (inputH > 0)
26+
{
27+
rotate = 0;
28+
}
29+
if (inputH < 0)
3330
{
34-
Bar();
31+
rotate = 1;
3532
}
36-
else
33+
if (Input.GetKeyDown(KeyCode.Q))
3734
{
38-
ShootAfterBar();
35+
if (!shotLoad)
36+
{
37+
Bar();
38+
}
39+
else
40+
{
41+
ShootAfterBar();
42+
}
3943
}
4044
}
4145
}
@@ -56,4 +60,12 @@ private void ShootAfterBar()
5660
st.Destroy();
5761
shotLoad = false;
5862
}
63+
public void IsMoving()
64+
{
65+
mov = true;
66+
}
67+
public void IsNotMoving()
68+
{
69+
mov = false;
70+
}
5971
}

0 commit comments

Comments
 (0)