-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStoneController.cs
88 lines (76 loc) · 2.38 KB
/
StoneController.cs
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class StoneController : MonoBehaviour
{
public Node selfNode;
void Start()
{
}
void Update()
{
ChangeImage();
}
public void ChangeImage()
{
var img = GetComponent<Image>();
try
{
if (selfNode.isPlayer)
{
img.sprite = CreateController.cc.sprPlayer;
}
else
{
switch (selfNode.pawnType)
{
case PawnType.Stone:
img.sprite = CreateController.cc.sprNode;
break;
case PawnType.Love:
img.sprite = CreateController.cc.sprLove;
break;
case PawnType.Friendship:
img.sprite = CreateController.cc.sprFriendship;
break;
case PawnType.Business:
img.sprite = CreateController.cc.sprBusiness;
break;
case PawnType.Family:
img.sprite = CreateController.cc.sprFamily;
break;
default:
break;
}
}
}
catch
{
Debug.Log("에러유발" + gameObject.name);
}
}
public void Move(Node n)
{
if (!CreateController.cc.isMyTurn)
return;
n.isPlayer = true;
CreateController.cc.playerNode.isPlayer = false;
CreateController.cc.playerNode = n;
CreateController.cc.selectButtons.SetActive(true);
CreateController.cc.popupObject.SetActive(true);
CreateController.cc.isMyTurn = false;
CreateController.cc.pv.RPC("CommunicateWithOther", PhotonTargets.Others, CreateController.cc.pv.owner.ID);
}
[PunRPC]
public void CommunicateWithOther()
{
CreateController.cc.isMyTurn = true;
}
public void ChangeTile(PawnType pt, Node n)
{
selfNode.pawnType = pt;
CreateController.cc.selectButtons.SetActive(false);
CreateController.cc.popupObject.SetActive(false);
}
}