remove multiplayer
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
public class BlockManager : NetworkBehaviour
|
||||
public class BlockManager : MonoBehaviour
|
||||
{
|
||||
public enum BlockType {None, Barricade, Door, Wood, Ammo, FireCamp, Pills};
|
||||
public BlockType blockType = BlockType.None;
|
||||
|
@@ -2,9 +2,8 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
public class EnemyManager : NetworkBehaviour
|
||||
public class EnemyManager : MonoBehaviour
|
||||
{
|
||||
public float health = 100;
|
||||
public float damage = 10;
|
||||
@@ -33,10 +32,6 @@ public class EnemyManager : NetworkBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (!isServer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
DropBodyPart();
|
||||
if (actualHealth <= 0)
|
||||
{
|
||||
@@ -64,10 +59,6 @@ public class EnemyManager : NetworkBehaviour
|
||||
|
||||
void FixedUpdate()
|
||||
{
|
||||
if (!isServer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (actualHealth > 0 && barricadeManager == null)
|
||||
{
|
||||
Vector3 _dir = player.transform.position - transform.position;
|
||||
|
@@ -2,9 +2,8 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
public class GuiManager : NetworkBehaviour
|
||||
public class GuiManager : MonoBehaviour
|
||||
{
|
||||
public GameObject InteractIcon;
|
||||
public Text Wood;
|
||||
|
@@ -1,9 +1,8 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
public class MusicManager : NetworkBehaviour
|
||||
public class MusicManager : MonoBehaviour
|
||||
{
|
||||
public AudioSource musicSource;
|
||||
public AudioClip DayMusic;
|
||||
@@ -14,20 +13,12 @@ public class MusicManager : NetworkBehaviour
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
if (!isLocalPlayer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
musicSource.PlayOneShot(DayMusic);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (!isLocalPlayer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
float sunRotationX = Sun.transform.localEulerAngles.x;
|
||||
sunRotationX = (sunRotationX > 180) ? sunRotationX - 360 : sunRotationX;
|
||||
|
||||
|
@@ -1,10 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class PlayerManager : NetworkBehaviour
|
||||
public class PlayerManager : MonoBehaviour
|
||||
{
|
||||
|
||||
public float speed = 8;
|
||||
@@ -21,7 +20,6 @@ public class PlayerManager : NetworkBehaviour
|
||||
public int barricadeMaterials = 50;
|
||||
public int ammo = 50;
|
||||
public List<GameObject> weaponList = new List<GameObject>();
|
||||
public GameObject player;
|
||||
private GameObject createWeapon;
|
||||
public GameObject spikes;
|
||||
public Sprite spikesImage;
|
||||
@@ -44,14 +42,6 @@ public class PlayerManager : NetworkBehaviour
|
||||
buildTime = buildRate;
|
||||
playerCamera = GetComponentInChildren<Camera>();
|
||||
rigidBody = GetComponent<Rigidbody>();
|
||||
if (isLocalPlayer)
|
||||
{
|
||||
player.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetComponentInChildren<Camera>().enabled = false;
|
||||
}
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Cursor.visible = false;
|
||||
}
|
||||
@@ -59,10 +49,6 @@ public class PlayerManager : NetworkBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (!isLocalPlayer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
Application.Quit(0);
|
||||
@@ -73,7 +59,7 @@ public class PlayerManager : NetworkBehaviour
|
||||
RunSwitch();
|
||||
SelectWeapon();
|
||||
Interact();
|
||||
|
||||
|
||||
if (actualHealth <= 0)
|
||||
{
|
||||
if (audio != null && lose != null && (nextMapeTime2 + 1) <= Time.time)
|
||||
@@ -87,8 +73,7 @@ public class PlayerManager : NetworkBehaviour
|
||||
audio.PlayOneShot(lose);
|
||||
nextMapeTime2 = nextMapeTime + Time.time;
|
||||
}
|
||||
if (nextMapeTime2 <= Time.time)
|
||||
{
|
||||
if (nextMapeTime2 <= Time.time) {
|
||||
SceneManager.LoadScene(SceneManager.GetActiveScene().name, LoadSceneMode.Single);
|
||||
}
|
||||
}
|
||||
@@ -99,10 +84,6 @@ public class PlayerManager : NetworkBehaviour
|
||||
|
||||
void FixedUpdate()
|
||||
{
|
||||
if (!isLocalPlayer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Rotate();
|
||||
}
|
||||
|
||||
@@ -172,12 +153,12 @@ public class PlayerManager : NetworkBehaviour
|
||||
WeaponManager weaponManager = weaponList[selectedWeapon].GetComponent<WeaponManager>();
|
||||
if (weaponManager != null) {
|
||||
weaponManager.player = this;
|
||||
Debug.Log(weaponList.Count);
|
||||
if (Input.GetAxis("Mouse ScrollWheel") > 0 && selectTime < Time.time)
|
||||
{
|
||||
if (weaponManager != null && createWeapon != null)
|
||||
{
|
||||
Destroy(this.createWeapon);
|
||||
CmdDestroyWeapon(createWeapon);
|
||||
Destroy(createWeapon);
|
||||
}
|
||||
}
|
||||
else if (Input.GetAxis("Mouse ScrollWheel") < 0 && selectTime < Time.time)
|
||||
@@ -185,17 +166,15 @@ public class PlayerManager : NetworkBehaviour
|
||||
if (weaponManager != null && createWeapon != null)
|
||||
{
|
||||
Destroy(createWeapon);
|
||||
CmdDestroyWeapon(createWeapon);
|
||||
}
|
||||
}
|
||||
weaponManager.player = this;
|
||||
if (weaponManager != null && createWeapon == null)
|
||||
{
|
||||
this.createWeapon = Instantiate(weaponList[selectedWeapon]) as GameObject;
|
||||
this.createWeapon.transform.parent = this.playerCamera.transform;
|
||||
this.createWeapon.transform.localPosition = Vector3.zero;
|
||||
this.createWeapon.transform.localEulerAngles = Vector3.zero;
|
||||
CmdSpawnWeapon(createWeapon);
|
||||
createWeapon = Instantiate(weaponList[selectedWeapon]) as GameObject;
|
||||
createWeapon.transform.parent = playerCamera.transform;
|
||||
createWeapon.transform.localPosition = Vector3.zero;
|
||||
createWeapon.transform.localEulerAngles = Vector3.zero;
|
||||
}
|
||||
}
|
||||
if (Input.GetAxis("Mouse ScrollWheel") > 0 && selectTime < Time.time)
|
||||
@@ -225,18 +204,6 @@ public class PlayerManager : NetworkBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
[Command]
|
||||
void CmdSpawnWeapon(GameObject createWeapon2)
|
||||
{
|
||||
NetworkServer.Spawn(createWeapon2);
|
||||
}
|
||||
|
||||
[Command]
|
||||
void CmdDestroyWeapon(GameObject createWeapon2)
|
||||
{
|
||||
NetworkServer.Destroy(createWeapon2);
|
||||
}
|
||||
|
||||
void Interact()
|
||||
{
|
||||
Ray ray = playerCamera.ScreenPointToRay(Input.mousePosition);
|
||||
|
Reference in New Issue
Block a user