This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using SWNetwork; | |
using UnityEngine; | |
public class Health : MonoBehaviour | |
{ | |
public int MaxHp = 100; | |
const string HP = "HP"; | |
public NetworkID networkID; | |
public SyncPropertyAgent syncPropertyAgent; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Update() | |
{ | |
if (player.Dead || !networkID.IsMine) | |
{ | |
return; | |
} | |
if (Input.GetKeyUp(KeyCode.Alpha1)) | |
{ | |
syncPropertyAgent.Modify(CURRENT_WEAPON, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Update() | |
{ | |
timer += Time.deltaTime; | |
if (timer >= effectDisplayTime) | |
{ | |
gunEffect.StopEffects(); | |
} | |
if (networkID.IsMine) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using SWNetwork; | |
using UnityEngine; | |
public class Gun : MonoBehaviour | |
{ | |
public float TimeBetweenBullets = 0.2f; | |
public float Range = 100f; | |
public LayerMask ShootableMask; | |
public int Damage; | |
public int Ammo; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using SWNetwork; | |
using UnityEngine; | |
public class PlayerWeapon : MonoBehaviour | |
{ | |
public int CurrentWeapon = 0; | |
public List<Gun> Guns; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void OnSpawnerReady(bool alreadySetup) | |
{ | |
Debug.Log("OnSpawnerReady " + alreadySetup); | |
if (!alreadySetup) | |
{ | |
int spawnPointIndex = Random.Range(0, 3); | |
NetworkClient.Instance.LastSpawner.SpawnForPlayer(0, spawnPointIndex); | |
NetworkClient.Instance.LastSpawner.PlayerFinishedSceneSetup(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Update() | |
{ | |
if (player.Dead || !networkID.IsMine) | |
{ | |
return; | |
} | |
. | |
. | |
. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NetworkID networkID; | |
void Start() | |
{ | |
characterController = GetComponent<CharacterController>(); | |
animator = GetComponentInChildren<Animator>(); | |
player = GetComponent<Player>(); | |
networkID = GetComponent<NetworkID>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void OnTriggerEnter(Collider other) | |
{ | |
GameObject go = other.gameObject; | |
NetworkID networkID = go.GetComponent<NetworkID>(); | |
// check if the player is the local player | |
if (networkID.IsMine) | |
{ | |
lap_ = lap_ + 1; | |
guiManager.SetLapRecord(lap_, lapsToWin); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RemotePropertyAgent remotePropertyAgent; | |
const string PLAYER_PRESSED_ENTER = "PlayersPressedEnter"; | |
private void Start() | |
{ | |
guiManager.SetLapRecord(lap_, lapsToWin); | |
// get a reference of the gameDataManager component | |
remotePropertyAgent = GetComponent<RemotePropertyAgent>(); | |
} |
NewerOlder