новая беда, где то туплю видимо.
выделил увеличение перечисления в отдельный метод, но он перестал из-за этого работать. Не могу понять что за фигня. Цель одним и тем же методом вертеть три перечисления:
using UnityEngine;
using System.Collections;
public class Unit : MonoBehaviour {
}
public class MoveGamer : Unit {
public enum Sector {SectorI, SectorII, SectorIII} // Ориентация секторов для определени углов поворота
public Sector CurrentSectorNS, CurrentSectorWE, CurrentSectorAround; // хранилища пересечений, Сектор текущего поворота по осям Север-Юг, Запад-Восток, Вокруг себя
public int Sec; // отладка
// Use this for initialization
void Start ()
{
CurrentSectorNS = CurrentSectorWE = CurrentSectorAround = Sector.SectorI;
}
// Update is called once per frame
void Update ()
{
UnitWaitMove (); // Юнит ожидает движение
}
public void UnitWaitMove ()
{
if (Input.GetKeyDown(KeyCode.X)) ChangeSector (CurrentSectorNS);
if (Input.GetKeyDown(KeyCode.C)) ChangeSector (CurrentSectorWE);
if (Input.GetKeyDown(KeyCode.V)) ChangeSector (CurrentSectorAround);
}
public Sector ChangeSector(Sector ChangeSector) {
Sec = (int)ChangeSector;
Sec += 1;
ChangeSector = (Sector)Sec;
if (Sec > (int)Sector.SectorIII) {
ChangeSector = Sector.SectorI;
Sec = 0;}
return ChangeSector;
}
}