Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using UnityEngine.Networking;
- using System.Collections.Generic;
- using UnityEngine.UI;
- public class NetworkPlayer : NetworkBehaviour {
- [SyncVar]
- public bool isHacked = false;
- [SyncVar]
- public bool isTerminal = false;
- [SyncVar]
- public bool isOpeningTerminal = false;
- public GameObject openingPanel;
- // Use this for initialization
- void Start () {
- openingPanel = GameObject.Find("Canvas/Panel/OpeningTerminalPanel");
- openingPanel.SetActive(false);
- }
- // Update is called once per frame
- void Update () {
- if (!isLocalPlayer)
- {
- return;
- }
- if (Input.GetKeyDown(KeyCode.Space))
- {
- CmdHack();
- }
- if (Input.GetKeyDown(KeyCode.F1))
- {
- CmdActivateTerminal();
- }
- if (Input.GetKeyDown(KeyCode.F2))
- {
- CmdActivateOpeningTerminal();
- openingPanel.SetActive(true);
- //GameManager.Instance.CmdStartGame();
- }
- }
- [Command]
- void CmdHack()
- {
- if (!isServer)
- {
- return;
- }
- if (isHacked)
- {
- isHacked = false;
- }
- else
- {
- isHacked = true;
- }
- }
- [Command]
- void CmdActivateTerminal()
- {
- isTerminal = true;
- }
- [Command]
- void CmdActivateOpeningTerminal()
- {
- isOpeningTerminal = true;
- }
- public bool AmIHacked()
- {
- return isHacked;
- }
- public override void OnStartLocalPlayer()
- {
- //GameManager.Instance.CmdAddPlayer(transform.gameObject);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement