일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- Big Data
- 김양재
- nodeJS
- 우리들교회
- probability
- WebGL
- 확률
- data science
- c++
- 빅데이타
- Statistics
- 빅 데이타
- 빅데이터
- No SQL
- 주일설교
- 김양재 목사님
- 통계
- Machine Learning
- 인공지능
- 몽고디비
- 김양재 목사
- node.js
- Artificial Intelligence
- Deep learning
- openCV
- 데이터 과학
- 딥러닝
- 빅 데이터
- R
- MongoDB
- Today
- Total
Scientific Computing & Data Science
Sending Commands Using RPC 본문
using UnityEngine;
using System.Collections;
public class TouchObjectNetwork : MonoBehaviour {
public GUITexture guiTexture;
private bool touched;
private Touch touch;
private bool serverSignal;
private bool clientSignal;
// Use this for initialization
void Start () {
serverSignal = false;
clientSignal = false;
}
// Update is called once per frame
void FixedUpdate () {
if(Network.isClient)
{
touch = Input.GetTouch(0);
if(guiTexture.HitTest(touch.position))
{
if(Input.GetTouch(0).phase == TouchPhase.Began)
{
clientSignal = true;
}
}
networkView.RPC("SendAudioSignalInput", RPCMode.Server, clientSignal);
clientSignal = false;
}
if(Network.isServer)
{
if(serverSignal)
{
audio.Play();
clientSignal = false;
networkView.RPC("SendAudioSignalInput", RPCMode.Server, clientSignal);
}
}
}
// Remote Procedure Calls
[RPC]
void SendAudioSignalInput(bool signal)
{
serverSignal = signal;
}
}
'CG & Video Games > Unity 3D' 카테고리의 다른 글
Script for Mobile Touch Scree (0) | 2013.05.26 |
---|---|
Fetching IP Address in C# (0) | 2013.05.26 |
Script for Network Instantiate(JS) (0) | 2013.05.26 |
Script for Touch & Drag an Object (0) | 2013.05.26 |
Dynamic Images (0) | 2013.05.26 |