Exemple #1
0
    void OnDisplayDialog(LogicArg arg)
    {
        NarrativePlotScriptableObject tem_Plot = (NarrativePlotScriptableObject)arg.GetMessage(M_Event.EVENT_DISPLAY_DIALOG_PLOT);
        MonoBehaviour     other        = (MonoBehaviour)arg.sender;
        AudioSource       otherSpeaker = AddSpeaker(other.gameObject);
        TalkableCharacter sender       = (TalkableCharacter)arg.sender;

        if (tem_Plot != null)
        {
            if (!tem_Plot.important)
            {
                if (tem_Plot.dialogs != null && tem_Plot.dialogs.Count > 0)
                {
                    DisplayUnimportantDialog(tem_Plot.dialogs [0], new DisplayPlot(tem_Plot, otherSpeaker, sender));
                }
            }
            else
            {
                PlotArray.Add(new DisplayPlot(tem_Plot, otherSpeaker, sender));
                if (!IsDisplaying)
                {
                    NextDialog();
                }
            }
        }
    }
Exemple #2
0
    void OnEvent(LogicArg arg)
    {
        if (arg.type == LogicEvents.BustStopTalkPointOne)
        {
            DisplayDialog(talkPointOne);
        }
        else if (arg.type == LogicEvents.BustStopTalkPointTwo)
        {
            DisplayDialog(talkPointTwo);
        }
        else if (arg.type == LogicEvents.EnterStone)
        {
            DisplayDialog(stonePlot);
        }
        else if (arg.type == LogicEvents.ForceGirlLeave)
        {
//			MechanismManager.health.SetHealthToMin ();
//			Leave ();
        }
        else if (arg.type == LogicEvents.PlayMusic)
        {
//			ReactToMusic (arg);
        }

        m_stateMachine.OnEvent(arg.type);
    }
    void OnDisplay(LogicArg arg)
    {
        TalkableCharacter             character = (TalkableCharacter)arg.sender;
        NarrativePlotScriptableObject plot      = (NarrativePlotScriptableObject)arg.GetMessage(M_Event.EVENT_DISPLAY_DIALOG_PLOT);

        if (plot.important)
        {
            if (character != null && character.NeedMoveCamera())
            {
                character.MoveCamera(m_MainCamera);
                cameraBot.enabled = false;
                Moveable          = false;
                m_isDisplay       = true;
            }
            else
            {
                if (plot != null && plot.lockCamera)
                {
                    Moveable               = false;
                    m_isDisplay            = true;
                    CameraNarrativeSensity = 0.03f;
                }
            }
        }
//		m_UseHeadBob = false;
//		m_Move = false;
//		m_CanJump = false;
    }
Exemple #4
0
    public void OnFoodReady(LogicArg arg)
    {
        if (m_health.IsHungry)
        {
            FoodReadyArg fArg = (FoodReadyArg)arg;

            if (fArg != null)
            {
                if (aviableFoodList.Contains(fArg.food.m_type))
                {
                    Debug.Log(" On Food Ready ");
                    if (targetFood == null)
                    {
                        targetFood           = fArg.food;
                        m_stateMachine.State = State.WalkToFood;
                    }
                    else
                    {
                        if (Global.GetDistance(fArg.food.gameObject, gameObject) < Global.GetDistance(targetFood.gameObject, gameObject))
                        {
                            targetFood = fArg.food;
                        }
                    }
                }
            }
        }
    }
Exemple #5
0
    void OnMoveHeroNetwork(LogicArg arg)
    {
        if (MState == LogicManager.State.WaitStrategy)
        {
            Debug.Log("Get Move MSG");
            MoveHeroMessage msg = (MoveHeroMessage)arg.GetMessage("msg");
            foreach (HeroMoveInfo mInfo in msg.heroMoves)
            {
                foreach (Hero h in heroList)
                {
                    if (h.GetHeroInfo().ID == mInfo.ID)
                    {
                        if (h is NetworkHero)
                        {
                            mInfo.ori         = BattleField.GetReflectBlock(mInfo.ori);
                            mInfo.target      = BattleField.GetReflectBlock(mInfo.target);
                            mInfo.toDirection = BattleField.GetReflectDirection(mInfo.toDirection);
                            ((NetworkHero)h).Move(mInfo);
                        }
                    }
                }
            }

            m_stateMachine.State = State.Battle;
        }
    }
Exemple #6
0
 /// <summary>
 /// A static interface to fire the logic events, without specified type
 /// </summary>
 /// <param name="arg">Argument.</param>
 public static void FireLogicEvent(LogicArg arg)
 {
     if (arg.type != LogicEvents.None)
     {
         FireLogicEvent(arg.type, arg);
     }
 }
Exemple #7
0
 void UnPause(LogicArg arg)
 {
     if (IsAffectedByPause)
     {
         IsPause = false;
     }
 }
Exemple #8
0
    void EnterStreetColorful(LogicArg arg)
    {
        Sequence seq = DOTween.Sequence();

        seq.Append(m_light.DOColor(oriangeColor, colorChangeInterval));
        seq.Append(m_light.DOColor(Color.Lerp(oriangeColor, Color.black, 0.5f), colorChangeInterval).SetLoops(999, LoopType.Yoyo).SetEase(Ease.InOutCirc));
    }
    /// <summary>
    /// Finger down, send select block
    /// </summary>
    /// <param name="block">Block.</param>
    public void OnBlockSelect(Block block)
    {
        for (int i = 0; i < gridWidth; ++i)
        {
            for (int j = 0; j < gridHeight; ++j)
            {
                BlockGrid [i, j].IsSelected = false;
            }
        }

        block.IsSelected = true;

        LogicArg arg = new LogicArg(this);

        arg.AddMessage(M_Event.BLOCK, block);

        if (block.state == Block.BlockState.Empty)
        {
            M_Event.FireLogicEvent(LogicEvents.SelectBlock, arg);
        }
        else if (block.state == Block.BlockState.Hero)
        {
//			M_Event.FireLogicEvent (LogicEvents.SelectHero, arg);
        }
    }
Exemple #10
0
    public void OnPlayMusic(string musicName)
    {
        LogicArg arg = new LogicArg(this);

        arg.AddMessage(M_Event.EVENT_PLAY_MUSIC_NAME, musicName);
        M_Event.FireLogicEvent(LogicEvents.PlayMusic, arg);
    }
Exemple #11
0
    void Disappear()
    {
        if (!isDisappeared)
        {
            isDisappeared = true;
            if (m_text != null)
            {
                m_text.DOKill();
                m_text.DOFade(0, showUpTime);
            }
            if (m_backImage != null)
            {
                m_backImage.DOKill();
                m_backImage.DOFade(0, showUpTime).SetDelay(0.1f);
                m_backImage.transform.DOScale(0, showUpTime).OnComplete(delegate() {
                    Destroy(gameObject);
                });
            }
            if (m_arrow != null)
            {
                m_arrow.DOKill();
                m_arrow.DOFade(0, showUpTime * 0.2f);
            }

            LogicArg arg = new LogicArg(this);
            arg.AddMessage(M_Event.EVENT_END_DISPLAY_SENDER, character);
            arg.AddMessage(M_Event.EVENT_END_DISPLAY_FRAME, false);
            M_Event.FireLogicEvent(LogicEvents.EndDisplayDialog, arg);
        }
    }
Exemple #12
0
    public void OnAutoBattle(bool ifAuto)
    {
        LogicArg arg = new LogicArg(this);

        arg.AddMessage("ifAuto", ifAuto);
        M_Event.FireLogicEvent(LogicEvents.UIAutoBattle, arg);
    }
Exemple #13
0
 void OnInteract(LogicArg arg)
 {
     if (TempInteractable != null)
     {
         TempInteractable.Interact();
     }
 }
Exemple #14
0
    public override void OnEvent(LogicArg arg)
    {
        base.OnEvent(arg);
        M_Event.FireLogicEvent(LogicEvents.FocusCamera, new LogicArg(this));
        Debug.Log("Focus");
        Camera   toCam     = moveCameraTo.gameObject.GetComponent <Camera> ();
        float    camOriFOV = Camera.main.fieldOfView;
        Sequence seq       = DOTween.Sequence();

        seq.AppendInterval(delayTime);
        seq.Append(Camera.main.transform.DOMove(moveCameraTo.position, moveTime)).SetEase(type);
        seq.Join(Camera.main.transform.DORotate(moveCameraTo.eulerAngles, moveTime)).SetEase(type);
        if (toCam != null)
        {
            seq.Join(Camera.main.DOFieldOfView(toCam.fieldOfView, moveTime).SetEase(type));
        }
        seq.AppendInterval(lastTime);
        seq.AppendCallback(delegate() {
            Camera.main.fieldOfView = camOriFOV;
            M_Event.FireLogicEvent(LogicEvents.UnfocusCamera, new LogicArg(this));
            if (endEvent != LogicEvents.None)
            {
                M_Event.FireLogicEvent(endEvent, new LogicArg(this));
            }
        });
    }
Exemple #15
0
 void OnEvent(LogicArg arg)
 {
     m_stateMachine.OnEvent(arg.type);
     if (arg.type == LogicEvents.UnpauseGame)
     {
         OnUnpauseGame(false);
     }
 }
    void OnBeginDamage(LogicArg arg)
    {
        if (waterDropEffect != null)
        {
//			waterDropEffect.enabled = true;
            DOTween.To(() => waterDropEffect.rate, (x) => waterDropEffect.rate = x, 1f, 0.2f);
        }
    }
    public void RecieveMoveHero(NetworkMessage netMsg)
    {
        MoveHeroMessage msg = netMsg.ReadMessage <MoveHeroMessage>();
        LogicArg        arg = new LogicArg(this);

        arg.AddMessage("msg", msg);
        M_Event.FireLogicEvent(LogicEvents.NetMoveHero, arg);
    }
Exemple #18
0
 /// <summary>
 /// a static interface to fire the logic events, with specified type
 /// </summary>
 /// <param name="type">Type.</param>
 /// <param name="arg">Argument.</param>
 public static void FireLogicEvent(LogicEvents type, LogicArg arg)
 {
     if (logicEvents[(int)type] != null)
     {
         arg.type = type;
         logicEvents [(int)type] (arg);
     }
 }
 public void OnActive(LogicArg arg)
 {
     counter++;
     if (counter >= 4)
     {
         fsm.SendEvent("Dash");
     }
 }
 void OnDeathEnd(LogicArg arg)
 {
     if (temDeath != null)
     {
         temDeath.lastTime = Time.time - temDeath.time;
         deathData.Add(temDeath);
     }
 }
 void OnTrafficLightGreen(LogicArg arg)
 {
     if (isWaittingForGreen)
     {
         RecoverMove();
         isWaittingForGreen = false;
         gameObject.tag     = "PasserBy";
     }
 }
 void OnUnfocusCamera(LogicArg arg)
 {
     Debug.Log("On UnLock Camera");
     isCameraLocked = false;
     if (waterDropEffect != null && IsInDamage)
     {
         waterDropEffect.enabled = true;
     }
 }
 void OnEndDamge(LogicArg arg)
 {
     if (waterDropEffect != null)
     {
         DOTween.To(() => waterDropEffect.rate, (x) => waterDropEffect.rate = x, 0f, 0.2f).OnComplete(delegate() {
             waterDropEffect.enabled = false;
         });
     }
 }
 protected override void OnEndDisplayDialog(LogicArg arg)
 {
     if (IsTalking)
     {
         Debug.Log("End DisplayDialog " + IsPlayerIn + m_AISetting.type);
         RecoverMove();
     }
     base.OnEndDisplayDialog(arg);
 }
Exemple #25
0
    void Pause(LogicArg arg)
    {
        if (IsAffectedByPause)
        {
            IsPause = true;
        }

        Debug.Log("Pause");
    }
Exemple #26
0
 void OnTriggerEnter(Collider col)
 {
     if (col.tag == "MainCamera")
     {
         LogicArg arg = new LogicArg(this);
         arg.AddMessage(M_Event.EVENT_SWITCH_BGM_CLIP, switchBGM);
         M_Event.FireLogicEvent(LogicEvents.SwitchBGM, arg);
     }
 }
Exemple #27
0
    public void SendThought(Thought thought)
    {
        if (thought.thought != "" && m_test_showThought)
        {
            LogicArg arg = new LogicArg(this);
            arg.AddMessage(M_Event.EVENT_THOUGHT, thought);
//			Debug.Log ("Send thought " + thought.thought);
            M_Event.FireLogicEvent(LogicEvents.DisplayThought, arg);
        }
    }
Exemple #28
0
    void OnBeginDamage(LogicArg arg)
    {
//		if ((int)LogicManager.Instance.State >= (int)LogicManager.GameState.GoWithGoodMan) {
//			hurtTime++;
//		}
        if (hurtTime >= hurtBeforeShowUp && State == GoodManState.Hide)
        {
            m_stateMachine.State = GoodManState.ShowUp;
        }
    }
 void OnDisplayEnd(LogicArg arg)
 {
     Debug.Log("OnEndDisplay");
     if (lastData != null)
     {
         lastData.lastTime = Time.time - lastData.time;
         dialogData.Add(lastData);
         lastData = null;
     }
 }
Exemple #30
0
    void OnDefaultBGM(LogicArg arg)
    {
        float fadeTime = -1f;

        if (arg.ContainMessage(M_Event.EVENT_BGM_FADE_TIME))
        {
            fadeTime = (float)arg.GetMessage(M_Event.EVENT_BGM_FADE_TIME);
        }
        SwitchBGM(defaultBGM, false, fadeTime);
    }