Ejemplo n.º 1
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);
        }
    }
Ejemplo n.º 2
0
    void EndDisplayPlot(DisplayPlot plot)
    {
        LogicArg arg = new LogicArg(this);

        arg.AddMessage(M_Event.EVENT_END_DISPLAY_SENDER, plot.character);
        arg.AddMessage(M_Event.EVENT_END_DISPLAY_FRAME, true);
        M_Event.FireLogicEvent(LogicEvents.EndDisplayDialog, arg);

        if (plot.plot.endPlotEvent != LogicEvents.None)
        {
            M_Event.FireLogicEvent(plot.plot.endPlotEvent, arg);
        }
    }
Ejemplo n.º 3
0
    /// <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);
        }
    }
Ejemplo n.º 4
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);
    }
Ejemplo n.º 5
0
    public void OnAutoBattle(bool ifAuto)
    {
        LogicArg arg = new LogicArg(this);

        arg.AddMessage("ifAuto", ifAuto);
        M_Event.FireLogicEvent(LogicEvents.UIAutoBattle, arg);
    }
Ejemplo n.º 6
0
    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);
    }
Ejemplo n.º 7
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);
     }
 }
Ejemplo n.º 8
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);
        }
    }
Ejemplo n.º 9
0
    void OnTriggerEnter(Collider col)
    {
        if (col.tag == "Player")
        {
            LogicArg      arg  = new LogicArg(this);
            SavePointData data = new SavePointData();
            data.trans = transform;
            arg.AddMessage(M_Event.EVENT_SAVE_POINT, data);
            M_Event.FireLogicEvent(LogicEvents.EnterSavePoint, arg);
//			gameObject.SetActive (false);
        }
    }
Ejemplo n.º 10
0
    public void RecievePlaceHero(NetworkMessage netMsg)
    {
        PlaceHeroMessage msg = netMsg.ReadMessage <PlaceHeroMessage>();
        LogicArg         arg = new LogicArg(this);

        arg.AddMessage("msg", msg);
        M_Event.FireLogicEvent(LogicEvents.NetPlaceHero, arg);

        for (int i = 0; i < msg.heroInfo.Length; ++i)
        {
            Debug.Log("Recieve " + msg.heroInfo[i].ToString());
        }
    }
Ejemplo n.º 11
0
    /// <summary>
    /// Finger up, send confirmHero
    /// </summary>
    /// <param name="block">Block.</param>
    public void OnBlockConfirm(Block block)
    {
        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.ConfirmHero, arg);
            Debug.Log("Confirm Hero Fire " + block.SimpleBlock);
        }
    }
Ejemplo n.º 12
0
    virtual protected void DisplayDialog(NarrativePlotScriptableObject plot)
    {
        if (plot != null && plot.dialogs != null && plot.dialogs.Count > 0)
        {
            if (plot.dialogs.Count > 1)
            {
                plot.important = true;
            }

            // display dialog
            LogicArg arg = new LogicArg(this);
            arg.AddMessage(M_Event.EVENT_DISPLAY_DIALOG_PLOT, plot);
            M_Event.FireLogicEvent(LogicEvents.DisplayDialog, arg);

            // switch to talking if the plot is important
            if (plot.important)
            {
                IsTalking = true;
            }
        }
    }
Ejemplo n.º 13
0
    void InitStateMachine()
    {
        m_stateMachine = new AStateMachine <GameState, LogicEvents>(GameState.None);

//		m_stateMachine.BlindTimeStateChange (GameState.Enter, GameState.TalkWithManInCafe, 1f);
        m_stateMachine.BlindStateChangeEvent(LogicEvents.EndTalkManInCafe, GameState.Enter, GameState.TalkWithManInCafe);
        m_stateMachine.BlindStateChangeEvent(LogicEvents.BeginDamage, GameState.TalkWithManInCafe, GameState.TryGoInRain);
        m_stateMachine.BlindStateChangeEvent(LogicEvents.SeeGirlStreetTwo, GameState.SeeTakePhoto, GameState.SeeGirlStreetTwo);
        m_stateMachine.BlindStateChangeEvent(LogicEvents.UnfocusCamera, GameState.SeeGirlStreetTwo, GameState.FindGirlStreetTwo);
        m_stateMachine.BlindStateChangeEvent(LogicEvents.BusStopEndTalkGirl, GameState.InBusStop, GameState.WalkWithGirl);
        m_stateMachine.BlindStateChangeEvent(LogicEvents.TrafficRedLight, GameState.WalkOutStreetFour, GameState.WalkIntoPeople);
        m_stateMachine.BlindTimeStateChange(GameState.WalkIntoPeople, GameState.WalkAcrossRoadWithGirl, 35f);
        m_stateMachine.BlindStateChangeEvent(LogicEvents.ForceGirlLeave, GameState.WalkAcrossRoadWithGirl, GameState.DepartFromGirl);
//		m_stateMachine.BlindTimeStateChange (GameState.WalkAcrossRoadWithGirl, GameState.DepartFromGirl, 10f);
        m_stateMachine.BlindStateChangeEvent(LogicEvents.InvisibleFromPlayer, GameState.DepartFromGirl, GameState.BeginShip);
        m_stateMachine.BlindStateChangeEvent(LogicEvents.EnterEnd, GameState.WalkInStreetColorful, GameState.PlayEndAnimation);
        m_stateMachine.BlindStateChangeEvent(LogicEvents.EndTalkWithFakeGirl, GameState.BackToApartment, GameState.TalkWithFakeGirl);
        m_stateMachine.BlindStateChangeEvent(LogicEvents.EndCredit, GameState.ShowCredit, GameState.End);


        m_stateMachine.BlindFromEveryState(LogicEvents.EndTalkWithGirl, GameState.TalkWithGirlInCafe);
        m_stateMachine.BlindFromEveryState(LogicEvents.EnterStreetOne, GameState.WalkInStreetOne);
        m_stateMachine.BlindFromEveryState(LogicEvents.EnterRotateBuilding, GameState.SeeBuilding);
        m_stateMachine.BlindFromEveryState(LogicEvents.EnterBorrowUmbrella, GameState.BorrowUmbrella);
        m_stateMachine.BlindFromEveryState(LogicEvents.EnterStreetTwo, GameState.WalkInStreetTwo);
        m_stateMachine.BlindFromEveryState(LogicEvents.EnterTakePhoto, GameState.SeeTakePhoto);
        m_stateMachine.BlindFromEveryState(LogicEvents.EnterStreetThree, GameState.WalkInStreetThree);
        m_stateMachine.BlindFromEveryState(LogicEvents.EnterBusStop, GameState.InBusStop);
        m_stateMachine.BlindFromEveryState(LogicEvents.EnterStreetThreeEnd, GameState.WalkOutStreetThree);
        m_stateMachine.BlindFromEveryState(LogicEvents.EnterStreetFour, GameState.WalkInStreetFour);
        m_stateMachine.BlindFromEveryState(LogicEvents.GirlSayPlayMusic, GameState.ListenToMusic);
        m_stateMachine.BlindFromEveryState(LogicEvents.EnterStreetFourEnd, GameState.WalkOutStreetFour);
        m_stateMachine.BlindFromEveryState(LogicEvents.PickUpMusicPlayer, GameState.PickUpMusicPlayer);
        m_stateMachine.BlindFromEveryState(LogicEvents.EnterStreetColorful, GameState.WalkInStreetColorful);
        m_stateMachine.BlindFromEveryState(LogicEvents.EnterApartment, GameState.BackToApartment);
        m_stateMachine.BlindFromEveryState(LogicEvents.WalkInApartment, GameState.PlayEndAnimation);
        m_stateMachine.BlindFromEveryState(LogicEvents.EndHitThree, GameState.ShowCredit);

        m_stateMachine.AddEnter(GameState.WalkAcrossRoadWithGirl, delegate() {
            M_Event.FireLogicEvent(LogicEvents.TrafficGreenLight, new LogicArg(this));
        });

        m_stateMachine.AddEnter(GameState.BeginShip, delegate() {
            LogicArg arg = new LogicArg(this);
            arg.AddMessage(M_Event.EVENT_BGM_FADE_TIME, 0);
            M_Event.FireLogicEvent(LogicEvents.SwitchDefaultBGM, arg);
        });

        m_stateMachine.AddEnter(GameState.TalkWithFakeGirl, delegate() {
            LogicArg arg = new LogicArg(this);
            arg.AddMessage(M_Event.EVENT_BGM_FADE_TIME, 5f);
            M_Event.FireLogicEvent(LogicEvents.SwitchDefaultBGM, arg);
        });

        m_stateMachine.AddEnter(GameState.End, delegate() {
            SceneManager.LoadScene("Title");
        });

        m_stateMachine.AddEnter(GameState.PlayEndAnimation, delegate() {
            m_MainCharacter.transform.DOMove(m_MainCharacter.transform.forward * m_MainCharacter.MoveSpeed * 2f, 2f).SetRelative(true);
        });


        m_stateMachine.State = startState;
    }
Ejemplo n.º 14
0
    void DisplayDialog(NarrativeDialog dialog, DisplayPlot plot)
    {
        if (m_text != null)
        {
            m_text.DOKill();
            m_text.text = dialog.word;
//			m_text.DOText( dialog.word , dialog.word.Length * 0.06f + 0.3f );
            m_text.DOFade(1f, showUpTime);
        }
        if (m_backImage != null)
        {
            m_backImage.DOKill();
            m_backImage.color = GetDialogColorFromType(dialog.type);
            m_backImage.transform.localScale = Vector3.one * 0.01f;
            m_backImage.transform.DOScale(1f, showUpTime);
            m_backImage.DOFade(backImageOriginalAlpha, showUpTime);
        }
        if (m_arrow != null)
        {
            m_arrow.DOKill();
            m_arrow.DOFade(backImageOriginalAlpha, showUpTime);
        }

        if (temSpeaker != null)
        {
            temSpeaker.Stop();
        }

        switch (dialog.type)
        {
        case NarrativeDialog.SpeakerType.ThisCharacter:
        case NarrativeDialog.SpeakerType.Girl:
            temSpeaker = plot.otherSpeaker;
            break;

        case NarrativeDialog.SpeakerType.MainCharacter:
            temSpeaker = mainCharacterSpeaker;
            break;

        default:
            break;
        }
        ;

        if (dialog.clip != null)
        {
            temSpeaker.clip = dialog.clip;
            temSpeaker.Play();
        }

        temDialog = dialog;

        UpdateDialogFramePosition();

        LogicArg arg = new LogicArg(this);

        arg.AddMessage("word", dialog.word);
        arg.AddMessage("character", dialog.type.ToString());
        arg.AddMessage("important", plot.plot.important);
        M_Event.FireLogicEvent(LogicEvents.DisplayNextDialog, arg);

        dialogTimer = 0;
    }