You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

65 lines
1.7 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameMode : MonoBehaviour {
//references to all players
List<GameObject> Players = new List<GameObject>();
public Recipe recipe;
GameObject LocalPlayer;
public CharacterMovement charMove;
private void Start()
{
LocalPlayer = Multiplayer.PlayersManager.Instance.LocalPlayer;
Players.Add(LocalPlayer);
foreach (GameObject curPlayer in Multiplayer.PlayersManager.Instance.RemotePlayers.Values)
{
Players.Add(curPlayer);
}
}
void Update()
{
//CheckValues();
if (charMove.CheckNearby())
{
recipe.CheckVictory();
}
}
/*
//Check the values for player to see if it changes the minimum or maximum values of all players
void CheckValues()
{
float maxDistance = 0;
foreach(GameObject gamePlayer in Players)
{
float distance = (transform.position - gamePlayer.transform.position).magnitude;
Player playerScript = gamePlayer.GetComponent<Player>();
foreach (GameObject dummy in playerScript.dummies)
{
float newDis = (transform.position - gamePlayer.transform.position).magnitude;
if (newDis < distance)
{
distance = newDis;
}
}
if (distance > maxDistance)
{
maxDistance = distance;
}
}
if (maxDistance < DistanceToWin)
{
if (recipe.CheckVictory())
{
//Win Game here
}
}
}
*/
}