protected override void MOnDisable() { base.MOnDisable(); M_Event.UnregisterEvent(LogicEvents.NetPlaceHero, OnPlaceHeroNetwork); M_Event.UnregisterEvent(LogicEvents.NetMoveHero, OnMoveHeroNetwork); M_Event.UnregisterEvent(LogicEvents.UIAutoBattle, OnAutoPlay); }
void OnPauseGame() { m_isGamePaused = true; MBehavior.isPaused = true; DOTween.PauseAll(); M_Event.FireLogicEvent(LogicEvents.PauseGame, new LogicArg(this)); }
public void OnAutoBattle(bool ifAuto) { LogicArg arg = new LogicArg(this); arg.AddMessage("ifAuto", ifAuto); M_Event.FireLogicEvent(LogicEvents.UIAutoBattle, arg); }
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); } }
// 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 = ""; }
void OnTriggerExit(Collider col) { if (col.tag == "MainCamera" && isExitSwitchToDefault) { M_Event.FireLogicEvent(LogicEvents.SwitchDefaultBGM, new LogicArg(this)); } }
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); }
/// <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); } }
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)); } }); }
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); }
protected override void MOnDisable() { base.MOnEnable(); M_Event.UnregisterEvent(LogicEvents.ButtonPress, OnButtonPress); M_Event.UnregisterEvent(LogicEvents.CreateFeedback, OnCreateFeedback); M_Event.UnregisterEvent(LogicEvents.FeedFeedBack, OnFeedFeedback); M_Event.UnregisterEvent(LogicEvents.PlayFeedback, OnCreateFeedback); M_Event.UnregisterEvent(LogicEvents.AnimalAction, OnAnimalAction); }
protected override void MOnDisable() { base.MOnDisable(); M_Event.UnregisterEvent(LogicEvents.BustStopTalkPointOne, OnEvent); M_Event.UnregisterEvent(LogicEvents.BustStopTalkPointTwo, OnEvent); M_Event.UnregisterEvent(LogicEvents.EnterStone, OnEvent); M_Event.UnregisterEvent(LogicEvents.ForceGirlLeave, OnEvent); M_Event.UnregisterEvent(LogicEvents.PlayMusic, OnEvent); }
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); } }
void OnUnpauseGame(bool isFire) { m_isGamePaused = false; MBehavior.isPaused = false; DOTween.PlayAll(); if (isFire) { M_Event.FireLogicEvent(LogicEvents.UnpauseGame, new LogicArg(this)); } }
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); } }
public override bool OnUpdate() { if (timeCounter > MGameManager.Instance.NormalTime) { M_Event.FireLogicEvent(LogicEvents.CreateFeedback, new EnergyBurstArg(this, EnergyType.CreateDeer, timeCounter)); return(true); } return(false); }
void OnTriggerEnter(Collider col) { if (col.tag == "Player" && !isSended) { M_Event.FireLogicEvent(enterEvent, new LogicArg(this)); if (isOnce) { isSended = true; } } }
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); } }
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); } }
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()); } }
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); } }
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)); } } }
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)); }
/// <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); } }
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)); } }
// 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); // }); }
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; } } } }
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; } } } }
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); }
protected override void MOnDisable() { base.MOnDisable(); // M_Event.logicEvents [(int)LogicEvents.Death] -= OnDeath; // M_Event.logicEvents [(int)LogicEvents.DeathEnd] -= OnDeathEnd; M_Event.logicEvents [(int)LogicEvents.UnlockCamera] -= OnUnlockCamera; M_Event.logicEvents [(int)LogicEvents.LockCamera] -= OnLockCamera; M_Event.logicEvents [(int)LogicEvents.DisplayThought] -= OnDisplayThought; M_Event.logicEvents [(int)LogicEvents.HideThought] -= OnHideThought; // M_Event.logicEvents [(int)LogicEvents.SwitchThoughtBox] -= OnSwitchThoughtBox; M_Event.UnregisterEvent(LogicEvents.BeginRun, OnBeginRun); M_Event.UnregisterEvent(LogicEvents.EndRun, OnEndRun); M_Event.UnregisterEvent(LogicEvents.GirlSayPlayMusic, OnShowMusicPlayer); M_Event.UnregisterEvent(LogicEvents.PickUpMusicPlayer, OnShowBrokenMusicPlayer); // M_Event.UnregisterEvent (LogicEvents.InvisibleFromPlayer, OnHideMusicPlayer ); M_Event.UnregisterEvent(LogicEvents.WalkInApartment, OnHideMusicPlayer); M_Event.UnregisterEvent(LogicEvents.PauseGame, OnPause); M_Event.UnregisterEvent(LogicEvents.UnpauseGame, OnUnpause); }