Ejemplo n.º 1
0
 public override void Start()
 {
     // 注册监听函数
     GameEventMachine.Register(GameEventID.Event_UI_Menu_Play, OnGameStart);
     // 创建一个UI
     GameEventMachine.SendEvent(GameEventID.Event_UI_Create, UIType.UIMenu);
 }
Ejemplo n.º 2
0
        protected override void Touch()
        {
            int cash = Attributes.FindChild("money").GetValue <int>();

            GameEventMachine.SendEvent(GameEventID.Event_ChangeMoney, cash);
            Destroy(gameObject);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 制作鸡尾酒
        /// </summary>
        public virtual void CreateCocktail(int index, Vector3 pos, Quaternion quat, uint drinkerID)
        {
            L_Item_Cocktail cocktail = GameObject.Instantiate(m_CocktailPrefabs[0], pos, quat) as L_Item_Cocktail;

            cocktail.GetAttribute("level").Value = 1;             // 临时(材料等级、调酒师等级、熟练度)
            GameEventMachine.SendEvent(GameEventID.Event_Barman_CreateCocktail, drinkerID, cocktail.ID);
        }
Ejemplo n.º 4
0
 public override void End()
 {
     // 移除一个UI
     GameEventMachine.SendEvent(GameEventID.Event_UI_Delete, UIType.UIMenu);
     // 注销监听函数
     GameEventMachine.Unregister(GameEventID.Event_UI_Menu_Play, OnGameStart);
 }
Ejemplo n.º 5
0
        void ChangeMoney(params object[] args)
        {
            L_Attribute att = m_AttributeRoot.FindChild("money");

            att.Value = (int)att.Value + (int)args[0];
            GameEventMachine.SendEvent(GameEventID.Event_2UI_ChangeMoney, att.Value, (int)args[0]);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 点酒
        /// </summary>
        public virtual void PointMenu()
        {
            string    name     = Attributes.FindChild("name").GetValue <string>();
            DrinkType winetype = Attributes.FindChild("winetype").GetValue <DrinkType>();

            GameEventMachine.SendEvent(GameEventID.Event_Drinker_PointMenu, name, winetype);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 付钱
        /// </summary>
        public virtual void Pay(int cash)
        {
            L_Actor_Seat seat = L_ActorManager.It.Find <L_Actor_Seat> (m_SeatID);
            L_Item       item = L_ItemData.CreateItem("Cash", seat.WinePos.position, seat.WinePos.rotation);

            item.GetAttribute("money").Value = cash;

            GameEventMachine.SendEvent(GameEventID.Event_Drinker_Pay, gameObject, cash);
        }
Ejemplo n.º 8
0
 public override TaskStatus OnUpdate()
 {
     if (!charachter.IsArrive)
     {
         return(TaskStatus.Running);
     }
     GameEventMachine.SendEvent(GameEventID.Event_Barman_Tend, m_CurrDrinker.Value.gameObject);
     return(TaskStatus.Success);
 }
Ejemplo n.º 9
0
        //
        public override void OnStart()
        {
            drinker = gameObject.GetComponent <L_Character_Drinker> ();
            seat    = L_ActorManager.It.Find <L_Actor_Seat> (drinker.SeatID);
            GameEventMachine.SendEvent(GameEventID.Event_Drinker_LeaveSeat, drinker.SeatID, drinker.ID);

            L_Actor_Door door = L_ActorManager.It.ActorRoot.GetComponentInChildren <L_Actor_Door>();

            drinker.MoveTarget = door.ExitTran;
        }
Ejemplo n.º 10
0
        //
        public override void OnStart()
        {
            IsReceive = false;
            uint seatid = GetComponent <L_Character_Drinker> ().SeatID;

            seat = L_ActorManager.It.Find(seatid);
            GameEventMachine.SendEvent(GameEventID.Event_Drinker_CallBarman, gameObject, seat.gameObject);

            GameEventMachine.Register(GameEventID.Event_Barman_Tend, OnBarmanTend);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 每一秒固定增长的钱的数量
        /// </summary>
        void PreAddMoney()
        {
            // 增加的进步数量(计算公式?)
            int increment = 1;
            //
            L_Attribute att = m_AttributeRoot.FindChild("money");

            att.Value = (int)att.Value + increment;

            // 通知UI钱的数量发生了改变
            GameEventMachine.SendEvent(GameEventID.Event_2UI_ChangeMoney, att.Value, increment);
            // 平均每秒调用一次
            ClockMachine.It.CreateClock(1, PreAddMoney);
        }
Ejemplo n.º 12
0
        //
        public override void OnStart()
        {
            L_Actor_Seat[] seats = L_Actor_Seat.GetAllAeats();

            for (int i = 0; i < seats.Length; i++)
            {
                L_Actor_Seat seat = seats[i];
                if (seat.IsEmpty)
                {
                    L_Character_Drinker drinker = GetComponent <L_Character_Drinker> ();
                    drinker.SeatID = seat.ID;
                    GameEventMachine.SendEvent(GameEventID.Event_Drinker_FindSeat, seat.ID, drinker.ID);
                    return;
                }
            }
        }
Ejemplo n.º 13
0
        public override void Start()
        {
            // 实例化一个玩家
            L_PlayerManager.It.CreatePlayer <L_Player_User>();

            // 创建一个UI
            GameEventMachine.SendEvent(GameEventID.Event_UI_Create, UIType.UIPlay);

            // 注册事件
            // ...

            // 注册所有状态
            m_stateMachine = new StateMachine <L_System_Play>(this);
            m_stateMachine.Add(PlayState.PS_Initialize, new PlayState_Initilize());
            m_stateMachine.Add(PlayState.PS_Business, new PlayState_Business());
            // ...
            m_stateMachine.SetCurrentState(PlayState.PS_Initialize);             // 设置默认状态
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 游戏初始化
        /// </summary>
        void Awake()
        {
            // 防止重复创建
            if (!IsSingle)
            {
                Destroy(gameObject); return;
            }
            // 主逻辑所挂接的gameObject不能在切换场景的时候删除。
            DontDestroyOnLoad(gameObject);

            // 初始化系统管理器
            m_sysMgr = gameObject.AddComponent <L_SystemManager>();
            // 初始化缓存池
            m_DataPool = gameObject.AddComponent <L_DataPool>();
            // 初始化状态机
            m_stateMachine = new StateMachine <L_GameRoot>(this);
            m_stateMachine.Add(GameState.GS_Initialize, new L_GameStateInitialize());   // 初始化状态
            m_stateMachine.Add(GameState.GS_Menu, new L_GameStateMenu());               // Logo状态
            m_stateMachine.Add(GameState.GS_Play, new L_GameStatePlay());               // 版本更新状态

            GameEventMachine.SendEvent(GameEventID.Event_GameLogicStart);               // 游戏逻辑初始化完成,游戏启动

            m_stateMachine.SetCurrentState(GameState.GS_Initialize);
        }
Ejemplo n.º 15
0
 public void OnGamePlay()
 {
     GameEventMachine.SendEvent(GameEventID.Event_UI_Menu_Play);
 }