initial upload
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GameMenu : MonoBehaviour
|
||||
{
|
||||
public GameObject PlayerPrefab;
|
||||
|
||||
public GameObject TinkyPrefab;
|
||||
|
||||
public Transform Tinkyspawn;
|
||||
|
||||
private string ip = "127.0.0.1";
|
||||
|
||||
private bool connected;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
Application.runInBackground = true;
|
||||
}
|
||||
|
||||
public void CreatePlayer()
|
||||
{
|
||||
connected = true;
|
||||
GameObject gameObject = (GameObject)Network.Instantiate(PlayerPrefab, base.transform.position, base.transform.rotation, 1);
|
||||
Network.Instantiate(TinkyPrefab, Tinkyspawn.position, Tinkyspawn.rotation, 1);
|
||||
gameObject.transform.Find("Camera").GetComponent<Camera>().enabled = true;
|
||||
base.GetComponent<Camera>().enabled = false;
|
||||
}
|
||||
|
||||
private void OnDisconnectedFromServer()
|
||||
{
|
||||
connected = false;
|
||||
}
|
||||
|
||||
private void OnPlayerDisconnected(NetworkPlayer pl)
|
||||
{
|
||||
Network.DestroyPlayerObjects(pl);
|
||||
}
|
||||
|
||||
private void OnConnectedToServer()
|
||||
{
|
||||
CreatePlayer();
|
||||
}
|
||||
|
||||
private void OnServerInitialized()
|
||||
{
|
||||
CreatePlayer();
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (!connected)
|
||||
{
|
||||
ip = GUILayout.TextField(ip);
|
||||
if (GUILayout.Button("Connect as Victim"))
|
||||
{
|
||||
Network.Connect(ip, 250000);
|
||||
}
|
||||
if (GUILayout.Button("Host as Victim"))
|
||||
{
|
||||
Network.InitializeServer(10, 250000, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba456694c5b10dd6fb6f22f223a3d231
|
||||
timeCreated: 1757099056
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
name:
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,77 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GameMenuVerses : MonoBehaviour
|
||||
{
|
||||
public GameObject PlayerPrefab;
|
||||
|
||||
public GameObject TinkyPrefab;
|
||||
|
||||
public GameObject NoFog;
|
||||
|
||||
public GameObject TinkySpawn;
|
||||
|
||||
private string ip = "127.0.0.1";
|
||||
|
||||
private bool connected;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
Application.runInBackground = true;
|
||||
}
|
||||
|
||||
public void CreatePlayer()
|
||||
{
|
||||
connected = true;
|
||||
GameObject gameObject = (GameObject)Network.Instantiate(PlayerPrefab, base.transform.position, base.transform.rotation, 1);
|
||||
gameObject.GetComponent<NetworkView>().stateSynchronization = NetworkStateSynchronization.Unreliable;
|
||||
gameObject.transform.Find("Camera").GetComponent<Camera>().enabled = true;
|
||||
base.GetComponent<Camera>().enabled = false;
|
||||
}
|
||||
|
||||
public void CreateTinkyPlayer()
|
||||
{
|
||||
connected = true;
|
||||
GameObject gameObject = (GameObject)Network.Instantiate(TinkyPrefab, TinkySpawn.transform.position, TinkySpawn.transform.rotation, 1);
|
||||
gameObject.GetComponent<NetworkView>().stateSynchronization = NetworkStateSynchronization.Unreliable;
|
||||
Object.Instantiate(NoFog, base.transform.position, base.transform.rotation);
|
||||
gameObject.transform.Find("Camera").GetComponent<Camera>().enabled = true;
|
||||
gameObject.transform.Find("Camera").GetComponent<Light>().enabled = true;
|
||||
base.GetComponent<Camera>().enabled = false;
|
||||
}
|
||||
|
||||
private void OnDisconnectedFromServer()
|
||||
{
|
||||
connected = false;
|
||||
}
|
||||
|
||||
private void OnPlayerDisconnected(NetworkPlayer pl)
|
||||
{
|
||||
Network.DestroyPlayerObjects(pl);
|
||||
}
|
||||
|
||||
private void OnConnectedToServer()
|
||||
{
|
||||
CreatePlayer();
|
||||
}
|
||||
|
||||
private void OnServerInitialized()
|
||||
{
|
||||
CreateTinkyPlayer();
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (!connected)
|
||||
{
|
||||
ip = GUILayout.TextField(ip);
|
||||
if (GUILayout.Button("Connect as Victim"))
|
||||
{
|
||||
Network.Connect(ip, 5300);
|
||||
}
|
||||
if (GUILayout.Button("Host as Slendytubby"))
|
||||
{
|
||||
Network.InitializeServer(10, 5300, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 539345d8838853516df593e0dce085bb
|
||||
timeCreated: 1757099056
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
name:
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,67 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GameMenusingleplayer : MonoBehaviour
|
||||
{
|
||||
public GameObject PlayerPrefab;
|
||||
|
||||
public GameObject TinkyPrefab;
|
||||
|
||||
private string ip = "127.0.0.1";
|
||||
|
||||
private bool connected;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
Application.runInBackground = true;
|
||||
}
|
||||
|
||||
public void CreatePlayer()
|
||||
{
|
||||
connected = true;
|
||||
GameObject gameObject = (GameObject)Network.Instantiate(PlayerPrefab, base.transform.position, base.transform.rotation, 1);
|
||||
gameObject.GetComponent<NetworkView>().stateSynchronization = NetworkStateSynchronization.Unreliable;
|
||||
gameObject.transform.Find("Camera").GetComponent<Camera>().enabled = true;
|
||||
base.GetComponent<Camera>().enabled = false;
|
||||
}
|
||||
|
||||
private void OnDisconnectedFromServer()
|
||||
{
|
||||
connected = false;
|
||||
}
|
||||
|
||||
private void OnPlayerDisconnected(NetworkPlayer pl)
|
||||
{
|
||||
Network.DestroyPlayerObjects(pl);
|
||||
}
|
||||
|
||||
private void OnServerInitialized()
|
||||
{
|
||||
CreatePlayer();
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (!connected && GUILayout.Button("Start"))
|
||||
{
|
||||
Network.InitializeServer(10, 5300, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Network.InitializeServer(10, 5300, false);
|
||||
DisableAllBeginGameObjects();
|
||||
}
|
||||
|
||||
private void DisableAllBeginGameObjects()
|
||||
{
|
||||
GameObject[] allObjects = FindObjectsOfType(typeof(GameObject)) as GameObject[];
|
||||
foreach (GameObject obj in allObjects)
|
||||
{
|
||||
if (obj.name == "Begin game")
|
||||
{
|
||||
obj.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e50aac13660bde42f4643c9e85476c4a
|
||||
timeCreated: 1757099056
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
name:
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,15 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Player : MonoBehaviour
|
||||
{
|
||||
private void Start()
|
||||
{
|
||||
if (!base.GetComponent<NetworkView>().isMine)
|
||||
{
|
||||
Object.Destroy(GetComponent<FPSInputController>());
|
||||
Object.Destroy(GetComponent<CharacterMotor>());
|
||||
Object.Destroy(GetComponent<CharacterController>());
|
||||
Object.Destroy(GetComponent<MouseLook>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35f8c4d42304d9a7cd31d22caa78f503
|
||||
timeCreated: 1757099056
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
name:
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 906ea3f19035c3a42b227727cc2c5144
|
||||
folderAsset: yes
|
||||
timeCreated: 1757091907
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,109 @@
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEngine;
|
||||
|
||||
public class optionsMenu : MonoBehaviour
|
||||
{
|
||||
public static bool showMenu;
|
||||
|
||||
private string settings;
|
||||
|
||||
public static float ambianceLevel;
|
||||
|
||||
public static bool fullscreen;
|
||||
|
||||
public static string screenres = "1";
|
||||
|
||||
private string curRes = "1";
|
||||
|
||||
private void Start()
|
||||
{
|
||||
string[] array = Regex.Split(settings, "\r\n");
|
||||
string[] array2 = array;
|
||||
foreach (string input in array2)
|
||||
{
|
||||
string[] array3 = Regex.Split(input, "=");
|
||||
if (array3[0] == "ambiance")
|
||||
{
|
||||
ambianceLevel = float.Parse(array3[1]);
|
||||
}
|
||||
else if (array3[0] == "fullscreen")
|
||||
{
|
||||
if (array3[1] == "True" || array3[1] == "true")
|
||||
{
|
||||
Screen.fullScreen = true;
|
||||
fullscreen = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Screen.fullScreen = false;
|
||||
}
|
||||
}
|
||||
else if (array3[0] == "screenresolution")
|
||||
{
|
||||
switch (array3[1])
|
||||
{
|
||||
case "1":
|
||||
Screen.SetResolution(1366, 768, fullscreen);
|
||||
break;
|
||||
case "2":
|
||||
Screen.SetResolution(1600, 900, fullscreen);
|
||||
break;
|
||||
}
|
||||
screenres = array3[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (curRes != screenres)
|
||||
{
|
||||
switch (screenres)
|
||||
{
|
||||
case "1":
|
||||
Screen.SetResolution(1366, 768, fullscreen);
|
||||
break;
|
||||
case "2":
|
||||
Screen.SetResolution(1600, 900, fullscreen);
|
||||
break;
|
||||
}
|
||||
curRes = screenres;
|
||||
}
|
||||
if (Screen.fullScreen != fullscreen)
|
||||
{
|
||||
Screen.fullScreen = fullscreen;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
GUI.depth = 1000;
|
||||
if (showMenu)
|
||||
{
|
||||
GUI.Box(new Rect(Screen.width / 2 - 150, Screen.height / 2 - 150, 300f, 300f), string.Empty);
|
||||
GUI.Label(new Rect(Screen.width / 2 - 150, Screen.height / 2 - 150, 300f, 300f), "Sound");
|
||||
GUI.Label(new Rect(Screen.width / 2 - 145, Screen.height / 2 - 130, 300f, 300f), "Ambience");
|
||||
GUI.Label(new Rect(Screen.width / 2 + 115, Screen.height / 2 - 130, 300f, 300f), (int)(ambianceLevel * 100f) + "%");
|
||||
ambianceLevel = GUI.HorizontalSlider(new Rect(Screen.width / 2 - 80, Screen.height / 2 - 125, 190f, 50f), ambianceLevel, 0f, 1f);
|
||||
GUI.Label(new Rect(Screen.width / 2 - 150, Screen.height / 2 - 100, 300f, 300f), "Graphics");
|
||||
fullscreen = GUI.Toggle(new Rect(Screen.width / 2 - 150, Screen.height / 2 - 80, 200f, 30f), fullscreen, "Fullscreen");
|
||||
if (GUI.Button(new Rect(Screen.width / 2 - 60, Screen.height / 2 + 110, 120f, 30f), "Close"))
|
||||
{
|
||||
showMenu = false;
|
||||
saveSettings();
|
||||
}
|
||||
}
|
||||
GUI.depth = 0;
|
||||
}
|
||||
|
||||
public static void saveSettings()
|
||||
{
|
||||
string text = "ambiance=" + (int)(ambianceLevel * 100f);
|
||||
text = text + "\r\nfullscreen=" + fullscreen;
|
||||
text = text + "\r\nscreenresolution=" + screenres;
|
||||
StreamWriter streamWriter = new StreamWriter("settings.ini");
|
||||
streamWriter.Write(text);
|
||||
streamWriter.Close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 448d4391370feda4daa3fa8220682036
|
||||
timeCreated: 1757091919
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class test : MonoBehaviour
|
||||
{
|
||||
private void Start()
|
||||
{
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4f67e644e51ba93eb45af1eff6b0e88
|
||||
timeCreated: 1757099056
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
name:
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 0}
|
||||
userData:
|
||||
Reference in New Issue
Block a user