public void Init(string abName, Action <string, AssetBundle> abCacheHandler) { assetBundleName = abName; assetBundleCacheHandler = abCacheHandler; assetBundleCreateRequest = AssetBundle.LoadFromFileAsync(GameConst.DataPath + abName); timerInfo = TimerManager.AddHandler(OnUpdateHandler); }
public void Play() { if (effect == null) { return; } effect.SetActive(true); if (!string.IsNullOrEmpty(soundName) && soundName != BindTypes.NONE) { AudioClip audioClip = ResourceManager.GetAudioClip(GameConst.SoundABDirectory + soundName, soundName); audioSource = effect.GetComponent <AudioSource>(); if (audioSource == null) { audioSource = effect.AddComponent <AudioSource>(); } audioSource.clip = audioClip; audioSource.loop = isLoop; audioSource.PlayDelayed(soundDelayTime); } if (!isLoop) { totalTime = 0f; duration = SEffectManager.GetEffectDuration(effect, abName, prefabName); timerInfo = TimerManager.AddHandler(OnDelayHandler); } }
public void ReStart() { TimerManager.RemoveHandler(timerInfo); timerInfo = null; creature.FaceTo(Position); creature.PlayAnimation(AnimationType.Hit, true, null, OnEndHandler); speed = MoveDistance / MoveTime; curTime = 0f; timerInfo = TimerManager.AddHandler(OnTimeHandler); }
public override void OnEnter(FSMTranslation translatioin) { TimerManager.RemoveHandler(timerInfo); timerInfo = null; characterController = creature.CharacterController; index = 0; creature.FaceTo(position); creature.PlayAnimation(actions[index]); speed = FlyDistance / FlyTime; curTime = 0f; timerInfo = TimerManager.AddHandler(OnTimeHandler); }
public void DoWalk() { if (path == null || player == null) { return; } if (characterController == null) { characterController = player.GetComponent <CharacterController>(); } if (characterController == null) { return; } pathFinderNode = path[index]; targetPos = sceneInfo.GridToPixel(pathFinderNode.X, pathFinderNode.Y); player.transform.LookAt(targetPos); timerInfo = TimerManager.AddHandler(OnUpdateHandler); }