|
|
@@ -1,9 +1,11 @@
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using UnityEngine;
|
|
|
+using UnityEngine.UI;
|
|
|
|
|
|
public class SpiritSystem : MonoBehaviour
|
|
|
{
|
|
|
+ [Header("鯤소UI貫零")]
|
|
|
public Transform p1;
|
|
|
public Transform p2;
|
|
|
public Transform p1Orig;
|
|
|
@@ -12,9 +14,33 @@ public class SpiritSystem : MonoBehaviour
|
|
|
public Transform p2To;
|
|
|
public float uiSpeed;
|
|
|
|
|
|
+ [Header("鯤소1暠깃")]
|
|
|
+ static public GameObject player1;
|
|
|
+ static public Spirits p1Spirits;
|
|
|
+ public Image[] player1cards;
|
|
|
+ public GameObject choose1;
|
|
|
+ private int curCard1;
|
|
|
+ static public bool isP1CardChange;
|
|
|
+
|
|
|
+ [Header("鯤소2暠깃")]
|
|
|
+ static public GameObject player2;
|
|
|
+ static public Spirits p2Spirits;
|
|
|
+ public Image[] player2cards;
|
|
|
+ public GameObject choose2;
|
|
|
+ private int curCard2;
|
|
|
+ static public bool isP2CardChange;
|
|
|
+
|
|
|
+ [Header("亶쥣暠깃")]
|
|
|
+ public Sprite floatHead;
|
|
|
+ public Sprite CookHead;
|
|
|
+ public Sprite AssassinHead;
|
|
|
+ public Sprite InvisibleHead;
|
|
|
+
|
|
|
+ //ref醵똑
|
|
|
private Vector3 re1 = Vector3.right;
|
|
|
private Vector3 re2 = Vector3.left;
|
|
|
|
|
|
+ //ui角뤠쏵흙잼역bool
|
|
|
static public bool isP1Out = false;
|
|
|
static public bool isP2Out = false;
|
|
|
static public bool isP1In = false;
|
|
|
@@ -26,6 +52,41 @@ public class SpiritSystem : MonoBehaviour
|
|
|
p2.position = p2Orig.position;
|
|
|
}
|
|
|
|
|
|
+ private void ChangeSpirit(int id)
|
|
|
+ {
|
|
|
+ switch (id)
|
|
|
+ {
|
|
|
+ case 0:
|
|
|
+ int man = p1Spirits.hasSpirits;
|
|
|
+ if (man != 0)
|
|
|
+ {
|
|
|
+ curCard1 += 1;
|
|
|
+ if (curCard1 == man)
|
|
|
+ {
|
|
|
+ curCard1 = 0;
|
|
|
+ }
|
|
|
+ choose1.transform.position = player1cards[curCard1].transform.position;
|
|
|
+ p1Spirits.currentSpirit = p1Spirits.ownSpirits[curCard1];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ int mann = p2Spirits.hasSpirits;
|
|
|
+ if (mann != 0)
|
|
|
+ {
|
|
|
+ curCard2 += 1;
|
|
|
+ if (curCard2 == mann)
|
|
|
+ {
|
|
|
+ curCard2 = 0;
|
|
|
+ }
|
|
|
+ choose2.transform.position = player2cards[curCard2].transform.position;
|
|
|
+ p2Spirits.currentSpirit = p2Spirits.ownSpirits[curCard2];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void playerUIout(int id)
|
|
|
{
|
|
|
switch (id)
|
|
|
@@ -95,5 +156,16 @@ public class SpiritSystem : MonoBehaviour
|
|
|
{
|
|
|
playerUIin(1);
|
|
|
}
|
|
|
+
|
|
|
+ if (isP1CardChange)
|
|
|
+ {
|
|
|
+ isP1CardChange = false;
|
|
|
+ ChangeSpirit(0);
|
|
|
+ }
|
|
|
+ if (isP2CardChange)
|
|
|
+ {
|
|
|
+ isP2CardChange = false;
|
|
|
+ ChangeSpirit(1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|