示例#1
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);
        }
    }
示例#2
0
    public void OnAutoBattle(bool ifAuto)
    {
        LogicArg arg = new LogicArg(this);

        arg.AddMessage("ifAuto", ifAuto);
        M_Event.FireLogicEvent(LogicEvents.UIAutoBattle, arg);
    }
示例#3
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);
    }
示例#4
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);
        }
    }
示例#5
0
 void OnPauseGame()
 {
     m_isGamePaused     = true;
     MBehavior.isPaused = true;
     DOTween.PauseAll();
     M_Event.FireLogicEvent(LogicEvents.PauseGame, new LogicArg(this));
 }
示例#6
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));
            }
        });
    }
示例#7
0
//	public void OnSwitchThought()
//	{
//		if (isThoughtOn) {
//			thoughtBackground.transform.DOKill ();
//			thoughtBackground.transform.DOScale (0, 0.3f).OnComplete (delegate() {
//				isThoughtOn = false;
//			});
//		} else {
//			thoughtBackground.transform.DOKill ();
//			thoughtBackground.transform.DOScale (1f, 0.3f).OnComplete (delegate() {
//				isThoughtOn = true;
//			});
//
//		}
//	}

    void OnStateChange(LogicManager.GameState fromState, LogicManager.GameState toState)
    {
        if (toState == LogicManager.GameState.ShowCredit)
        {
//			ending.DOScale (0.01f, 1f).From ();
            endingBack.DOFade(0.45f, 2f);
            endingBack.DOFade(1f, 5f).SetDelay(25f);
            endingCredit.transform.DOMoveY(1600f, 30f).OnComplete(delegate() {
                M_Event.FireLogicEvent(LogicEvents.EndCredit, new LogicArg(this));
            });
            ending.gameObject.SetActive(true);
        }
        else if (toState == LogicManager.GameState.BeginShip)
        {
            HideMusicPlayer(0.3f);
        }
//		Debug.Log ("On Change" + toState);
//		foreach (StateTargetPair pair in targetList) {
//			if (toState == pair.state) {
//				targetText.DOKill ();
//				targetText.text = "";
//				targetText.DOText (pair.target, 2f );
//
//				return;
//			}
//		}
//		targetText.text = "";
    }
示例#8
0
 void OnTriggerExit(Collider col)
 {
     if (col.tag == "MainCamera" && isExitSwitchToDefault)
     {
         M_Event.FireLogicEvent(LogicEvents.SwitchDefaultBGM, new LogicArg(this));
     }
 }
示例#9
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);
    }
示例#10
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);
     }
 }
示例#11
0
 void OnUnpauseGame(bool isFire)
 {
     m_isGamePaused     = false;
     MBehavior.isPaused = false;
     DOTween.PlayAll();
     if (isFire)
     {
         M_Event.FireLogicEvent(LogicEvents.UnpauseGame, new LogicArg(this));
     }
 }
示例#12
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);
        }
    }
示例#13
0
    public override bool OnUpdate()
    {
        if (timeCounter > MGameManager.Instance.NormalTime)
        {
            M_Event.FireLogicEvent(LogicEvents.CreateFeedback, new EnergyBurstArg(this, EnergyType.CreateDeer, timeCounter));

            return(true);
        }
        return(false);
    }
示例#14
0
 void OnTriggerEnter(Collider col)
 {
     if (col.tag == "Player" && !isSended)
     {
         M_Event.FireLogicEvent(enterEvent, new LogicArg(this));
         if (isOnce)
         {
             isSended = true;
         }
     }
 }
示例#15
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);
        }
    }
示例#16
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);
        }
    }
示例#17
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());
        }
    }
示例#18
0
        public void OnUpdateSneeze()
        {
            if (!NarrativeManager.Instance.IsDisplaying && !MainCharacter.Instance.IsFocus)
            {
                inRainTimer += Time.deltaTime;
            }

            if (inRainTimer > (sneezeNum + 1) * sneezeDuration)
            {
                sneezeNum++;
                M_Event.FireLogicEvent(LogicEvents.Sneeze, new LogicArg(this));
                Debug.Log("Sneeze" + sneezeNum);
            }
        }
示例#19
0
 public void OnSpeedUp(float energyLostRate)
 {
     if (energy > 0)
     {
         energy   -= energyLostRate * Time.deltaTime;
         isSpeedUp = true;
         if (energy < 0)
         {
             isSpeedUp = false;
             energy    = 0;
             M_Event.FireLogicEvent(LogicEvents.Breath, new LogicArg(this));
         }
     }
 }
示例#20
0
    void OnDeathEnd()
    {
        m_isOnDeath = false;
        Moveable    = true;
        transform.DOKill();
        transform.position = lastSavePoint.trans.position;
        transform.forward  = lastSavePoint.trans.forward;

        Debug.Log("Came enable death");
        cameraBot.enabled      = true;
        CameraMechanismSensity = 1f;
        m_CamTransform.DOKill();

        M_Event.FireLogicEvent(LogicEvents.DeathEnd, new LogicArg(this));
    }
示例#21
0
 void UpdateHealth()
 {
     if (DamageState == DamageStateType.UnderDamage)
     {
         m_health.OnDamage(Health.FullHealth / damageSetting.lastTime);
     }
     else if (DamageState == DamageStateType.UnderProtect)
     {
         m_health.OnRecover(damageSetting.recover);
     }
     if (m_health.HealthValue < 0 && DamageState == DamageStateType.UnderDamage)
     {
         DamageState = DamageStateType.Dead;
         M_Event.FireLogicEvent(LogicEvents.Death, new LogicArg(this));
     }
 }
示例#22
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);
        }
    }
示例#23
0
//	void ReactToMusic( LogicArg arg )
//	{
//		string musicName = (string)arg.GetMessage (M_Event.EVENT_PLAY_MUSIC_NAME);
//		StartCoroutine( ReactToMusicDelay(Random.Range( 21f , 32f ) , musicName) );
//	}
//
//
//	void ReactToMusic( string musicName)
//	{
//		if (LogicManager.Instance.State == LogicManager.GameState.ListenToMusic) {
//
//			if (musicName == "LadyAndBird") {
//				DisplayDialog (playMusic [0]);
//			} else if (musicName == "Parade") {
//				DisplayDialog (playMusic [1]);
//			} else if (musicName == "AnHeQiao") {
//				DisplayDialog (playMusic [2]);
//			}
//
//		}
//	}
//
//	IEnumerator ReactToMusicDelay( float time , string musicName)
//	{
//		yield return new WaitForSeconds (time);
//
//		if ( AudioManager.Instance.switchBGMName == musicName )
//			ReactToMusic (musicName);
//	}
//
//	protected override void MUpdate ()
//	{
//		base.MUpdate ();
//		if (LogicManager.Instance.State == LogicManager.GameState.DepartFromGirl) {
////			if (MechanismManager.Instance.DamageState == MechanismManager.DamageStateType.UnderDamage) {
//				Vector3 girlToCamera = Camera.main.transform.position - transform.position;
//				girlToCamera.y = 0;
//				Vector3 forward = Camera.main.transform.forward;
//				forward.y = 0;
//
//				if (Vector3.Dot (girlToCamera.normalized, forward.normalized) > 0.1f ) {
//					Leave ( );
//				}
////			}
//		}
//
//		if (LogicManager.Instance.State < LogicManager.GameState.WalkOutStreetFour) {
//			if ((!IsPlayerIn && isInRain) || IsTalking) {
//				LockMove ();
//			} else {
//				RecoverMove ();
//			}
//		} else if (LogicManager.Instance.State < LogicManager.GameState.DepartFromGirl) {
//
//			if (IsTalking) {
//				LockMove ();
//			} else {
//				RecoverMove ();
//			}
//		} else{
//			Vector3 forward = Camera.main.transform.forward;
//			forward.y = 0;
//
//			m_agent.speed = 12f;
//			m_agent.SetDestination (transform.position + forward * -5f);
//		}
//
//		if (!IsMainEnded && m_agent.speed > 0 )
//			LockMove ();
//	}
//
//
    void Leave( )
    {
        Sequence seq = DOTween.Sequence();

        seq.AppendInterval(2f);
        seq.AppendCallback(delegate() {
            Debug.Log("Leave Player");
            m_stateMachine.State = GirlState.WalkAway;
            M_Event.FireLogicEvent(LogicEvents.InvisibleFromPlayer, new LogicArg(this));
            M_Event.FireLogicEvent(LogicEvents.SwitchDefaultBGM, new LogicArg(this));
        });
//		Vector3 forward = Camera.main.transform.forward;
//		forward.y = 0;
//		transform.DOMove ( - forward.normalized * 4f, 0.2f).SetRelative(true).OnComplete (delegate() {
//			gameObject.SetActive (false);
//		});
    }
示例#24
0
    public override bool OnUpdate()
    {
        if (bright + dark >= MGameManager.Instance.NormalTime * 2f)
        {
            if (bright > dark)
            {
                M_Event.FireLogicEvent(LogicEvents.FeedFeedBack, new FeedFeedbackArg(this, EnergyType.Brightness, FoodType.Meat, bright));
            }
            else
            {
                M_Event.FireLogicEvent(LogicEvents.FeedFeedBack, new FeedFeedbackArg(this, EnergyType.Darkness, FoodType.Meat, dark));
            }

            return(true);
        }

        return(false);
    }
示例#25
0
    public void OnCreateFeedback(LogicArg arg)
    {
        CreateFeedbackArg eArg = (CreateFeedbackArg)arg;

        if (arg.eventType == LogicEvents.CreateFeedback)
        {
            foreach (var info in createInfoList)
            {
                if (info.EnergyType == eArg.energyType)
                {
                    var obj = Create(info, createEffect);
                    scoreController.AddScore(info.score);
                    M_Event.FireLogicEvent(LogicEvents.CreateAnimal, new CreateArg(this, obj));
                    break;
                }
            }
        }
    }
示例#26
0
    public void OnFeedFeedback(LogicArg arg)
    {
        FeedFeedbackArg fArg = (FeedFeedbackArg)arg;

        if (arg.eventType == LogicEvents.FeedFeedBack)
        {
            foreach (var info in feedInfoList)
            {
                if (info.FoodType == fArg.foodType && info.EnergyType == fArg.energyType)
                {
                    var obj = Create(info, feedEffect);
                    scoreController.AddScore(info.score);
                    M_Event.FireLogicEvent(LogicEvents.CreateFood, new CreateArg(this, obj));
                    break;
                }
            }
        }
    }
示例#27
0
    void UpdateEnergy()
    {
        if (CrossPlatformInputManager.GetButton("SpeedUp") && MainCharacter.Instance.m_IsMoving)
        {
            m_health.OnSpeedUp(damageSetting.energyCost);
        }
        else
        {
            m_health.RecoverEnergy(damageSetting.energyRecover);
        }

        if (CrossPlatformInputManager.GetButtonDown("SpeedUp"))
        {
            M_Event.FireLogicEvent(LogicEvents.BeginRun, new LogicArg(this));
        }

        if (CrossPlatformInputManager.GetButtonUp("SpeedUp"))
        {
            M_Event.FireLogicEvent(LogicEvents.EndRun, new LogicArg(this));
        }
    }
示例#28
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;
            }
        }
    }
示例#29
0
    protected override void MUpdate()
    {
        base.MUpdate();

        tiredTimer += Time.deltaTime;

        if (CrossPlatformInputManager.GetButtonDown("SkipThought"))
        {
            M_Event.FireLogicEvent(LogicEvents.HideThought, new LogicArg(this));
        }

        if (tiredTimer > tiredTime || (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.T)))
        {
            SendThought(GetTempThought());
            ResetTiredTime();
        }

        if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.L))
        {
            m_test_showThought = !m_test_showThought;
        }
    }
示例#30
0
    virtual protected void OnEndDisplayDialog(LogicArg arg)
    {
        TalkableCharacter character = (TalkableCharacter)arg.GetMessage(M_Event.EVENT_END_DISPLAY_SENDER);

        if (character == this)
        {
            if (isMainTalking)
            {
                if (MainTalkEndEvent != LogicEvents.None)
                {
                    M_Event.FireLogicEvent(MainTalkEndEvent, new LogicArg(this));
                }
                isMainTalking = false;
                IsMainEnded   = true;
            }

            if (IsTalking && gameObject.activeSelf)
            {
                StartCoroutine(DelayBecomeTalkable(becomeTalkableDelay));
            }
        }
    }