Browse Source

Merge branch 'master' of https://bitbucket.org/JoshuaReason/ggj-2019

# Conflicts:
#	Assets/Scenes/ClientScene.unity
master
JoshuaReason 5 years ago
parent
commit
e98b7ec129
4 changed files with 207 additions and 8 deletions
  1. +129
    -2
      Assets/Scenes/MainScene.unity
  2. +61
    -0
      Assets/Scipts/CharacterMovement.cs
  3. +8
    -4
      Assets/Scipts/GameMode.cs
  4. +9
    -2
      Assets/Scipts/Map.cs

+ 129
- 2
Assets/Scenes/MainScene.unity View File

@ -1303,7 +1303,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
recipe: {fileID: 340012152} recipe: {fileID: 340012152}
DistanceToWin: 0
charMove: {fileID: 340012155}
--- !u!114 &340012154 --- !u!114 &340012154
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1334,6 +1334,10 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Speed: 5 Speed: 5
Players: []
Nearby:
DistanceToWin: 0
cam: {fileID: 0}
--- !u!1 &426060142 --- !u!1 &426060142
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2668,7 +2672,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1057999594 --- !u!224 &1057999594
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2986,6 +2990,128 @@ CanvasRenderer:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1154906379} m_GameObject: {fileID: 1154906379}
m_CullTransparentMesh: 0 m_CullTransparentMesh: 0
--- !u!1 &1190802516
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1190802517}
- component: {fileID: 1190802520}
- component: {fileID: 1190802519}
- component: {fileID: 1190802518}
m_Layer: 5
m_Name: Button
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1190802517
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1190802516}
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: 1266934409}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 800, y: 480}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1190802518
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1190802516}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, 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: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
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: 1190802519}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 340012155}
m_MethodName: mouseClick
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 &1190802519
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1190802516}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10911, 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 &1190802520
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1190802516}
m_CullTransparentMesh: 0
--- !u!1 &1195683498 --- !u!1 &1195683498
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3157,6 +3283,7 @@ RectTransform:
- {fileID: 264010775} - {fileID: 264010775}
- {fileID: 1039419384} - {fileID: 1039419384}
- {fileID: 35195569} - {fileID: 35195569}
- {fileID: 1190802517}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

+ 61
- 0
Assets/Scipts/CharacterMovement.cs View File

@ -6,10 +6,21 @@ public class CharacterMovement : MonoBehaviour {
public float Speed; public float Speed;
GameObject localPlayer; GameObject localPlayer;
public List<GameObject> Players = new List<GameObject>();
public List<bool> Nearby = new List<bool>();
public float DistanceToWin;
Camera cam;
private void Start() private void Start()
{ {
localPlayer = Multiplayer.PlayersManager.Instance.LocalPlayer; localPlayer = Multiplayer.PlayersManager.Instance.LocalPlayer;
Players.Add(localPlayer);
foreach (GameObject curPlayer in Multiplayer.PlayersManager.Instance.RemotePlayers.Values)
{
Players.Add(curPlayer);
}
cam = localPlayer.GetComponentInChildren<Camera>();
} }
@ -33,4 +44,54 @@ public class CharacterMovement : MonoBehaviour {
{ {
localPlayer.GetComponent<Rigidbody>().AddForce(new Vector3(0.0f, 0.0f, -Speed)); localPlayer.GetComponent<Rigidbody>().AddForce(new Vector3(0.0f, 0.0f, -Speed));
} }
public void mouseClick()
{
Vector3 screenMouse = Input.mousePosition;
Vector3 mousePos = cam.ScreenToWorldPoint(screenMouse);
Vector3 moveVec = new Vector3(mousePos.x, 0.0f, mousePos.z) * Speed;
localPlayer.GetComponent<Rigidbody>().AddForce(moveVec);
}
public bool CheckNearby()
{
for (int i = 0; i < Players.Count; i++)
{
if ((localPlayer.transform.position - Players[i].transform.position).magnitude < DistanceToWin)
{
Greet();
}
else
{
Player playerScript = Players[i].GetComponent<Player>();
foreach (GameObject dummy in playerScript.dummies)
{
if ((localPlayer.transform.position - dummy.transform.position).magnitude < DistanceToWin)
{
Greet();
}
}
}
}
return CheckWin();
}
bool CheckWin()
{
for (int i = 0; i < Nearby.Count; i++)
{
if (Nearby[i] == false)
{
return false;
}
}
return true;
}
public void Greet()
{
//Play audio
//Trigger animation
}
} }

+ 8
- 4
Assets/Scipts/GameMode.cs View File

@ -8,8 +8,7 @@ public class GameMode : MonoBehaviour {
List<GameObject> Players = new List<GameObject>(); List<GameObject> Players = new List<GameObject>();
public Recipe recipe; public Recipe recipe;
GameObject LocalPlayer; GameObject LocalPlayer;
public float DistanceToWin;
public CharacterMovement charMove;
private void Start() private void Start()
@ -25,10 +24,14 @@ public class GameMode : MonoBehaviour {
void Update() void Update()
{ {
CheckValues();
//CheckValues();
if (charMove.CheckNearby())
{
recipe.CheckVictory();
}
} }
/*
//Check the values for player to see if it changes the minimum or maximum values of all players //Check the values for player to see if it changes the minimum or maximum values of all players
void CheckValues() void CheckValues()
{ {
@ -58,4 +61,5 @@ public class GameMode : MonoBehaviour {
} }
} }
} }
*/
} }

+ 9
- 2
Assets/Scipts/Map.cs View File

@ -5,6 +5,8 @@ using UnityEngine;
public class Map : MonoBehaviour { public class Map : MonoBehaviour {
GameObject LocalPlayer; GameObject LocalPlayer;
List<GameObject> Players = new List<GameObject>();
public GameObject[] Tiles; public GameObject[] Tiles;
public List<GameObject> Landmarks; public List<GameObject> Landmarks;
@ -29,16 +31,21 @@ public class Map : MonoBehaviour {
#region StartupFunctions #region StartupFunctions
private void Start() private void Start()
{ {
LocalPlayer = Multiplayer.PlayersManager.Instance.LocalPlayer;
Players.Add(LocalPlayer);
foreach (GameObject curPlayer in Multiplayer.PlayersManager.Instance.RemotePlayers.Values)
{
Players.Add(curPlayer);
}
//GenerateMap(); //GenerateMap();
CreateDummys(); CreateDummys();
LocalPlayer = Multiplayer.PlayersManager.Instance.LocalPlayer;
} }
//Create dummy players for the world wrapping //Create dummy players for the world wrapping
void CreateDummys() void CreateDummys()
{ {
List<GameObject> Players = new List<GameObject>();
foreach (GameObject Player in Players) foreach (GameObject Player in Players)
{ {
Player PS = Player.GetComponent<Player>(); Player PS = Player.GetComponent<Player>();

Loading…
Cancel
Save