Пример #1
0
        public override void tick()
        {
            if (toLaunch != null)
            {
                // If we're not waiting to receive event finished from Mover.
                if (movement == null)
                {
                    // That means that, we're in the right position so...
                    Game.main.enqueueEvent(toLaunch);
                    toLaunch = null;

                    // Look to the action
                    if (actionCell || actionEntity)
                    {
                        Mover.Direction toLook = Mover.getDirectionFromTo(Entity.transform, actionEntity ? actionEntity.transform : actionCell.transform);
                        GameEvent       ge     = new GameEvent("turn");
                        ge.setParameter("mover", Entity.mover);
                        ge.setParameter("direction", toLook);
                        Game.main.enqueueEvent(ge);
                    }

                    actionCell   = null;
                    actionEntity = null;
                }
            }

            if (!registered)
            {
                ControllerManager.onControllerEvent += this.onControllerEvent;
                registered = true;
            }
        }
Пример #2
0
        public IEnumerator Talk(Entity executer = null)
        {
            Entity.mover.PushDestination();

            if (executer)
            {
                GameEvent turn = new GameEvent("turn");
                turn.setParameter("mover", Entity.mover);
                turn.setParameter("direction", Mover.getDirectionFromTo(transform, executer.transform));
                Game.main.enqueueEvent(turn);
            }

            GameEvent ge = new GameEvent();

            ge.Name = "start sequence";
            ge.setParameter("sequence", sequence);
            ge.setParameter("synchronous", true);
            Game.main.enqueueEvent(ge);

            yield return(new WaitForEventFinished(ge));

            Entity.mover.PopDestination();
        }