TurnManager basics
This commit is contained in:
parent
5d478e0a65
commit
c20ea052ea
1 changed files with 23 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
public class TurnManagerScript : MonoBehaviour {
|
public class TurnManagerScript : MonoBehaviour {
|
||||||
|
|
||||||
|
@ -7,21 +8,38 @@ public class TurnManagerScript : MonoBehaviour {
|
||||||
public int playerNum = 2;
|
public int playerNum = 2;
|
||||||
public int iaNum = 0;
|
public int iaNum = 0;
|
||||||
public bool inTurn = true;
|
public bool inTurn = true;
|
||||||
|
public List<List<GameObject> > charList;
|
||||||
|
|
||||||
|
private int actualPlayer;
|
||||||
|
private List<GameObject> actualTeam;
|
||||||
|
private int actualChar;
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start () {
|
void Start () {
|
||||||
|
//Estamos en turno
|
||||||
|
inTurn = true;
|
||||||
|
actualPlayer = 0;
|
||||||
|
actualTeam = charList [actualPlayer];
|
||||||
|
actualChar = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update () {
|
void Update () {
|
||||||
while (inTurn) {
|
|
||||||
|
if (actualTeam [actualChar].hasActioned ()) {
|
||||||
|
actualChar += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (actualChar == actualTeam.Count) {
|
||||||
|
changeTeam ((actualPlayer + 1) % playerNum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Turn (int team) {
|
void changeTeam (int newTeam) {
|
||||||
|
actualPlayer = newTeam;
|
||||||
|
actualTeam = charList [actualPlayer];
|
||||||
|
actualChar = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue