반응형
반응형
코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraController : MonoBehaviour { public float offsetX = 10; public float offsetY = 10; public float offsetZ = 10; void LateUpdate() { transform.position = new Vector3( Mathf.Clamp(Camera.main.transform.position.x, -offsetX, offsetX), Mathf.Clamp(Camera.main.transform.position.y, -offsetY, offsetY)..
코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; public class FollowCamera : MonoBehaviour { public GameObject target; public float offsetX = 0.0f; public float offsetY = 0.0f; public float offsetZ = 0.0f; Vector3 targetPos; void FixedUpdate() { targetPos = new Vector3(target.transform.position.x + offsetX,target.transform.position.y + offsetY,target.transform..
코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; public class MoveCamera : MonoBehaviour { public Transform targetPosition; public float smoothTime = 0.3f; private Vector3 velocity = Vector3.zero; public bool isActive = false; private void Start() { isActive = true; } private void Update() { if (isActive) { Camera.main.transform.position = Vector3.SmoothDamp(C..
코드 작성using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class Example : MonoBehaviour{ public Text nickNameText; void Start() { nickNameText.text = "" + "닉네임" + ""; //파란색으로 변경 nickNameText.text = "" + "닉네임" + ""; //초록색으로 변경 }}
플러터 Flutter 설치 https://docs.flutter.dev/get-started/install Install Install Flutter and get started. Downloads available for Windows, macOS, Linux, and Chrome OS operating systems. docs.flutter.dev Visual Stuido Code 설치 https://code.visualstudio.com/ Visual Studio Code - Code Editing. Redefined Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and ..
코드 작성 using System; using System.Collections; using UnityEngine; using Photon.Pun; using Photon.Realtime; using UnityEngine.UI; public class NetworkManager : MonoBehaviourPunCallbacks { int hp = 100; public Text hpText; public PhotonView PV; private void Start() { StartTimer(); } void StartTimer() { if(PhotonNetwork.IsMasterClient) { hp = 100; StartCoroutine(TimerCoroution()); } } IEnumerator Ti..
코드 작성 using System; using System.Collections; using UnityEngine; using Photon.Pun; using Photon.Realtime; public class NetworkManager : MonoBehaviourPunCallbacks { private void LoadScene() { PhotonNetwork.LoadLevel("Scene Name"); } }
코드 작성 using System; using System.Collections; using UnityEngine; using Photon.Pun; using Photon.Realtime; using UnityEngine.UI; public class NetworkManager : MonoBehaviourPunCallbacks { int time = 0; public Text timerText; public PhotonView PV; private void Start() { StartTimer(); } void StartTimer() { if(PhotonNetwork.IsMasterClient) { time = 60; StartCoroutine(TimerCoroution()); } } IEnumerato..
코드 작성 전 주의사항 스크립트가 달린 오브젝트의 PhotonView에서 OwnershipSphere 옵션이 TakeOver로 설정되어 있어야합니다. "Fixed" 는 게임오브젝트를 생성한 것이 지속적으로 소유자로 유지 되는 것입니다. "Takeover" 다른 클라이언트가 현재 오너로 부터 소유권을 가져갈 수 있도록 합니다. "Request" 현재 오너에게 소유권을 요청 할 수 있으나 거절 될 수 있는 것 입니다. 코드 작성 using System; using System.Collections; using UnityEngine; using Photon.Pun; using Photon.Realtime; public class Player : MonoBehaviourPunCallbacks { public P..
코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; using Photon.Pun; using Photon.Realtime; using UnityEngine.UI; using Hashtable = ExitGames.Client.Photon.Hashtable; public class NetworkManager : MonoBehaviourPunCallbacks { public override void OnJoinedRoom() { statusText.text = "방에 참가하였습니다."; if (PhotonNetwork.IsMasterClient) { PhotonNetwork.CurrentRoom.SetCus..
코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; using Photon.Pun; using Photon.Realtime; using UnityEngine.UI; public class NetworkManager : MonoBehaviourPunCallbacks { int towerHp = 100; bool isRaining = false; public PhotonView PV; void AttackTower() { PV.RPC("HitTower", RpcTarget.All); //방 전체 사람들에게 타워 체력 -10 PV.RPC("HitTower", RpcTarget.All, 10); PV.RPC("H..
코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; using Photon.Pun; using Photon.Realtime; using UnityEngine.UI; public class NetworkManager : MonoBehaviourPunCallbacks { public Text notionText; public PhotonView PV; private void Awake() { PV = GetComponent(); } public override void OnPlayerEnteredRoom(Player newPlayer) { PV.RPC("NotionRPC", RpcTarget.All, newP..