//换弹夹 void Reload(LTEvent ent = null) { if (isReloading) { return; } int refillCount = magSize - curMagSize; if (curBulltCount < refillCount) { refillCount = curBulltCount; } curBulltCount -= refillCount; curMagSize += refillCount; if (anim) { isReloading = true; anim.SetTrigger("reload"); } else { UpdateBulletDisplay(); isReloading = false; } //isBulltOk = false; }
/// <summary> /// 重新填充 /// </summary> public void Refill(LTEvent evt) { SoundManager.Instance.PlaySound(SoundManager.SoundType.WeaponEqiuped); //curMagSize = magSize; curBulltCount += BulletCount; UpdateBulletDisplay(); }
public void UpdateBulletDisplay(LTEvent evt) { if (bulletClipText != null && evt.data != null) { bulletClipText.text = evt.data.ToString(); } }
static public int set_id(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif LTEvent self = (LTEvent)checkSelf(l); System.Int32 v; checkType(l, 2, out v); self.id = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
void OnMoneyUsed(LTEvent evt) { if (evt.data != null) { UseMoney(ConvertUtil.ToInt32(evt.data, 0)); } }
public void Call(LTEvent param0) { func.BeginPCall(); func.PushObject(param0); func.PCall(); func.EndPCall(); }
static public int constructor(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif LTEvent o; System.Int32 a1; checkType(l, 2, out a1); System.Object a2; checkType(l, 3, out a2); o = new LTEvent(a1, a2); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
void changeColor(LTEvent e) { Transform tran = (Transform)e.data; float distance = Vector3.Distance(tran.position, transform.position); Vector3 to = new Vector3(Random.Range(0f, 1f), 0f, Random.Range(0f, 1f)); LeanTween.value(gameObject, updateColor, fromColor, to, 0.8f).setRepeat(2).setLoopPingPong().setDelay(distance * 0.05f); }
public void CallWithSelf(LTEvent param0) { func.BeginPCall(); func.Push(self); func.PushObject(param0); func.PCall(); func.EndPCall(); }
//void void OnCameraShake(LTEvent evt) { Vector3 amount = defaultShakeAmount; if(evt.data != null) { amount = (Vector3)evt.data; } iTween.ShakePosition(gameObject, amount, 0.5f); }
static internal void Lua_System_Action_1_LTEvent(LuaFunction ld, LTEvent a1) { IntPtr l = ld.L; int error = pushTry(l); pushValue(l, a1); ld.pcall(1, error); LuaDLL.lua_settop(l, error - 1); }
void OnGameMainMenu(LTEvent evt) { GameGlobalValue.s_CurrentScene = s_MainMenuSceneId; //bool isShowLoading = true; //if(evt.data != null) //{ // bool.TryParse(evt.data.ToString(), out isShowLoading); //} Loading(false); }
void OnGameNext(LTEvent evt) { if (GameGlobalValue.IsLastLevel(GameGlobalValue.s_CurrentLevel)) OnGameMainMenu(evt); else { GameGlobalValue.s_CurrentLevel += 1; Application.LoadLevel(Application.loadedLevel); } }
/// <summary> /// 监听敌人死亡 /// </summary> /// <param name="evt"></param> void OnEnemyDie(LTEvent evt) { bool isHeadShot = ConvertUtil.ToBool(evt.data); if (isHeadShot) { AddEnergy(headshotEnergy); ShowIcon(IconType.HeadShot); } }
void changeColor( LTEvent e ){ Transform tran = (Transform)e.data; float distance = Vector3.Distance( tran.position, transform.position); Color to = new Color(Random.Range(0f,1f),0f,Random.Range(0f,1f)); LeanTween.value( gameObject, fromColor, to, 0.8f ).setRepeat(2).setLoopPingPong().setDelay(distance*0.05f).setOnUpdate( (Color col)=>{ GetComponent<Renderer>().material.color = col; } ); }
void OnWaveCompleted(LTEvent evt) { int wave = ConvertUtil.ToInt32(evt.data); if (wave > 0) { AddEnergy(wave); ShowIcon(IconType.WaveComplete); } }
/// <summary> /// 监听连杀 /// </summary> /// <param name="evt"></param> void OnEnemyCombo(LTEvent evt) { int combo = ConvertUtil.ToInt32(evt.data); if (combo >= killingSpreeCombo) { AddEnergy(killingSpreeEnergy); ShowIcon(IconType.Slaughter); } }
void changeColor( LTEvent e ){ Transform tran = (Transform)e.data; float distance = Vector3.Distance( tran.position, transform.position); Color to = new Color(Random.Range(0f,1f),0f,Random.Range(0f,1f)); LeanTween.value( gameObject, fromColor, to, 0.8f ).setLoopPingPong(1).setDelay(distance*0.05f).setOnUpdate( (Color col)=>{ GetComponent<Renderer>().material.color = col; } ); }
//void void OnCameraShake(LTEvent evt) { Vector3 amount = defaultShakeAmount; if (evt.data != null) { amount = (Vector3)evt.data; } iTween.ShakePosition(gameObject, amount, 0.5f); }
public void OnExitEnergyPower(LTEvent evt) { if (powerWeapon != null) { powerWeapon.WeaponOut(() => { powerWeapon.gameObject.transform.parent.gameObject.SetActive(false); currentWeapon.WeaponIn(); isInEnergyPower = false; }); } }
void OnGameNext(LTEvent evt) { if (GameGlobalValue.IsLastLevel(GameGlobalValue.s_CurrentLevel)) { OnGameMainMenu(evt); } else { GameGlobalValue.s_CurrentLevel += 1; Application.LoadLevel(Application.loadedLevel); } }
static public int get_data(IntPtr l) { try { LTEvent self = (LTEvent)checkSelf(l); pushValue(l, true); pushValue(l, self.data); return(2); } catch (Exception e) { return(error(l, e)); } }
/// <summary> /// 获得医疗包 /// </summary> /// <param name="evt"></param> void OnGetMedKit(LTEvent evt) { if (evt.data != null) { float addedValue = 0.0f; if (float.TryParse(evt.data.ToString(), out addedValue)) { AddLife(addedValue); } //SoundManager.Instance.PlaySound(SoundManager.SoundType.GetLife); } }
static public int set_data(IntPtr l) { try { LTEvent self = (LTEvent)checkSelf(l); System.Object v; checkType(l, 2, out v); self.data = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
void OnVideoClosed(LTEvent evt) { LeanTween.removeListener((int)Events.VIDEOREWARD, OnVideoRewarded); LeanTween.removeListener((int)Events.VIDEOCLOSED, OnVideoClosed); if (videoRewarded) { // GameContinue(); GameReward(); } else { GameFinish(); } }
public void OnEnterEnergyPower(LTEvent evt) { isInEnergyPower = true; currentWeapon.WeaponOut(() => { //currentWeapon.gameObject.transform.parent.gameObject.SetActive(false); if (powerWeapon != null) { //powerWeapon.gameObject.transform.position = new Vector3(powerWeapon.gameObject.transform.position.x, -10, powerWeapon.gameObject.transform.position.z); powerWeapon.gameObject.transform.parent.gameObject.SetActive(true); powerWeapon.WeaponIn(); //LeanTween.moveLocalY(powerWeapon.gameObject, -3.4f, 1f); } }); }
void CreateBlood(LTEvent evt) { if (bloods == null) return; GameObject blood = bloods[Random.Range(0, bloods.Length)]; if (blood != null) { Vector3 createPos = new Vector3(Random.Range(-maxX, maxX), Random.Range(-maxY, maxY), 1); var created = (GameObject)Instantiate(blood, createPos, Quaternion.Euler(0, 0, Random.Range(0, 360))); float scale = Random.Range(5f, 8f); created.transform.localScale = new Vector3(scale, scale, 1); created.transform.SetParent(Camera.main.transform); } }
/// <summary> /// 获得盾牌道具 /// </summary> /// <param name="obj"></param> private void OnGetShield(LTEvent evt) { // throw new NotImplementedException(); if (evt.data != null) { float addedVal = 0.0f; if (float.TryParse(evt.data.ToString(), out addedVal)) { this.haveShield = true; shieldValue += (addedVal / 100) * playerMaxHP; qurShieldValue = shieldValue / 4; curQurShildValue = qurShieldValue; UIManager.Instance.ShowShield(); } } }
private void OnGameFinish(LTEvent obj) { //throw new NotImplementedException(); if (obj.data != null) { var record = obj.data as GameRecords; if (record != null) { UseMoney(-GameValue.moneyPerTimeLeft * record.TimeLeft); if (record.FinishType == GameFinishType.Completed) { SetLevelRecord(record.MapId, record.Level); } } } }
public void MoveScoopHorizontally(LTEvent e) { SwipeInfo.SwipeDirection direction = (SwipeInfo.SwipeDirection)e.data; Vector2Int nextIndex = board.GetNextIndex(new Vector2Int(board.ConeLane(), currentIndex.y), direction); Vector3 nextPosition = board.GetPosition(nextIndex); Vector3 currentPosition = board.GetPosition(currentIndex); float scaleMagnitude = .05f * Mathf.Clamp(currentIndex.y, 0, 10); Vector3 intermediatePosition = new Vector3(currentPosition.x + (nextPosition.x - currentPosition.x) / (1 + scaleMagnitude), currentPosition.y, currentPosition.z); StretchStart(scaleMagnitude, .1f).setEase(LeanTweenType.easeInQuad); LeanTween.move(gameObject, intermediatePosition, .1f).setOnComplete(() => { currentIndex = nextIndex; StretchEnd(scaleMagnitude, .05f).setEase(LeanTweenType.easeOutQuad); LeanTween.move(gameObject, nextPosition, .05f); }); }
static int get_id(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); LTEvent obj = (LTEvent)o; int ret = obj.id; LuaDLL.lua_pushinteger(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index id on a nil value" : e.Message)); } }
static int get_data(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); LTEvent obj = (LTEvent)o; object ret = obj.data; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index data on a nil value" : e.Message)); } }
/// <summary> /// 点击了观看按钮 /// </summary> /// <param name="evt"></param> void OnWatchVideoClicked(LTEvent evt) { alreadyShowVedio = true; //停止倒计时 //StopCoroutine(VideoCountDown(timeWaitVideo)); //StopCoroutine(); if (vedioCountDownCorotuine != null) { StopCoroutine(vedioCountDownCorotuine); } ChartboostUtil.Instance.ShowGameOverVideo(); //移除监听 LeanTween.removeListener((int)Events.WATCHVIDEOCLICKED, OnWatchVideoClicked); LeanTween.addListener((int)Events.VIDEOREWARD, OnVideoRewarded); LeanTween.addListener((int)Events.VIDEOCLOSED, OnVideoClosed); }
static int set_id(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); LTEvent obj = (LTEvent)o; int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.id = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index id on a nil value" : e.Message)); } }
void OnGetMedkit(LTEvent evt) { //if(particle) //{ // if(particle.isPlaying) // { // particle.Pause(); // } // particle.Play(); //} var obj = (GameObject)Instantiate(lifeParticle, gameObject.transform.position, gameObject.transform.rotation); if (obj) { obj.transform.SetParent(gameObject.transform); obj.GetComponent<ParticleSystem>().Play(true); // Destroy(obj, 2f); // Destroy(gameObject); } }
protected virtual void OnEnergyChanged(LTEvent evt) { int currentEnergy = 0; if (evt.data != null) { currentEnergy = ConvertUtil.ToInt32(evt.data); } isActive = currentEnergy >= energyCost; bool statusChange = false; if(useButton.interactable != isActive) { statusChange = true; } if (statusChange && isActive && shakeOnEnable) { iTween.ShakeScale(gameObject, new Vector3(1.2f, 1.2f, 1.2f), 0.5f); SoundManager.Instance.PlaySound(SoundManager.SoundType.EnergyItemEnabled); } useButton.interactable = (currentEnergy >= energyCost); }
void OnDemaged(LTEvent evt) { if (evt.data != null) { Demage d = evt.data as Demage; if (d != null && hudRoot != null) { //hudRoot.HideDistance = 1 if (d.isEnemy) { if (d.isHeadShot) { if (Random.Range(0, 2) == 1) { hudRoot.NewText("- " + d.demageVal.ToString(), d.tran, headshotHUDColor, 12, 10f, -0.5f, 2.2f, bl_Guidance.RightDown); } else { hudRoot.NewText("- " + d.demageVal.ToString(), d.tran, headshotHUDColor, 12, 10f, -0.5f, 2.2f, bl_Guidance.LeftDown); } } else { if (Random.Range(0, 2) == 1) { hudRoot.NewText("- " + d.demageVal.ToString(), d.tran, normalHUDColor, 12, 10f, -0.5f, 2.2f, bl_Guidance.RightDown); } else { hudRoot.NewText("- " + d.demageVal.ToString(), d.tran, normalHUDColor, 12, 10f, -0.5f, 2.2f, bl_Guidance.LeftDown); } } } } } }
static int _CreateLTEvent(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); object arg1 = ToLua.ToVarObject(L, 2); LTEvent obj = new LTEvent(arg0, arg1); ToLua.PushObject(L, obj); return 1; } else { return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: LTEvent.New"); } } catch(Exception e) { return LuaDLL.toluaL_exception(L, e); } }
void eventGeneralCalled( LTEvent e ) { eventGeneralWasCalled = true; }
void changeColor( LTEvent e ){ Transform tran = (Transform)e.data; float distance = Vector3.Distance( tran.position, transform.position); Vector3 to = new Vector3(Random.Range(0f,1f),0f,Random.Range(0f,1f)); LeanTween.value( gameObject, updateColor, fromColor, to, 0.8f ).setRepeat(2).setLoopPingPong().setDelay(distance*0.05f); }
void eventGameObjectCalled( LTEvent e ) { eventGameObjectWasCalled = true; }
void OnEnterEnergyPower(LTEvent evt) { isExitPower = false; StartCoroutine(DecreaseEnergy()); }
void OnNeedBullet(LTEvent evt) { // if (isActive) OnItemUse(); }
/// <summary> /// 敌人死亡 /// </summary> /// <param name="evt"></param> void OnEmenyDie(LTEvent evt) { AddAliveEmeny(-1); }
void OnEnergyItemUsed(LTEvent evt) { int cost = 0 - ConvertUtil.ToInt32(evt.data); AddEnergy(cost); }
/// <summary> /// 获得了奖励 /// </summary> /// <param name="evt"></param> void OnVideoRewarded(LTEvent evt) { Debug.Log("Get Rewards!"); videoRewarded = true; }
void OnExitEnergyPower(LTEvent evt) { isExitPower = true; }
//换弹夹 void Reload(LTEvent ent = null) { if (isReloading) return; int refillCount = magSize - curMagSize; if (curBulltCount < refillCount) { refillCount = curBulltCount; } curBulltCount -= refillCount; curMagSize += refillCount; if (anim) { isReloading = true; anim.SetTrigger("reload"); } else { UpdateBulletDisplay(); isReloading = false; } //isBulltOk = false; }
// ****** Event Listening Methods void jumpUp( LTEvent e ){ GetComponent<Rigidbody>().AddRelativeForce(Vector3.forward * 300f); }