public static LevelStateMachine Instance; //make singleton

    private void Awake()                      //set singleton and grab the UI Animator
    {
        if (Instance == null)
        {
            Instance = this;
        }
    }
Exemple #2
0
        public void Initialize(LevelInfo levelInfo, int index, SecurityElement xml)
        {
            this.m_xml       = xml;
            this.index       = index;
            this.m_levelInfo = levelInfo;

            playerPoints  = new List <LevelPoint>();
            monsterPoints = new List <LevelPoint>();

            m_heroInAreaState = LevelStateMachine.Exit;

            Transform root = null;

            foreach (SecurityElement xmlChild in m_xml.Children)
            {
                if (xmlChild.Tag == LevelFunctionType.Ground.ToString().ToLower())
                {
                    root   = CreateRoot(transform, LevelFunctionType.Ground.ToString());
                    ground = root.gameObject.AddComponent <LevelGround>();
                    ground.Initialize(this, xmlChild);
                }
                else if (xmlChild.Tag == LevelFunctionType.Decoration.ToString().ToLower())
                {
                }
                else if (xmlChild.Tag == LevelFunctionType.Door.ToString().ToLower())
                {
                    root = CreateRoot(transform, LevelFunctionType.Door.ToString());
                    InitializeDoors(root, xmlChild);
                }
                else if (xmlChild.Tag == LevelFunctionType.Trap.ToString().ToLower())
                {
                }
                else if (xmlChild.Tag == LevelFunctionType.Transfer.ToString().ToLower())
                {
                }
                else if (xmlChild.Tag == LevelFunctionType.Player.ToString().ToLower())
                {
                    playerPoints = GetPoints(xmlChild);
                }
                else if (xmlChild.Tag == LevelFunctionType.Monster.ToString().ToLower())
                {
                    monsterPoints = GetPoints(xmlChild);
                }
            }
        }
Exemple #3
0
 // <summary>
 /// 保持在区域
 /// </summary>
 public void OnStayArea()
 {
     m_heroInAreaState = LevelStateMachine.Stay;
     m_levelInfo.OnStayArea(this);
 }
Exemple #4
0
 // <summary>
 /// 离开区域
 /// </summary>
 public void OnExitArea()
 {
     m_heroInAreaState = LevelStateMachine.Exit;
     m_levelInfo.OnExitArea(this);
 }
Exemple #5
0
 // <summary>
 /// 进入区域
 /// </summary>
 public void OnEnterArea()
 {
     m_heroInAreaState = LevelStateMachine.Enter;
     m_levelInfo.OnEnterArea(this);
 }