private void Update_Runnings() { if (CameraFollow) { base.transform.position = GameLogic.Self.position; } else { float num = MathDxx.Abs((float)(base.transform.position.z - GameLogic.Self.position.z)); if (num < 0.2f) { base.transform.position = GameLogic.Self.position; } else { float t = (this.speed * Updater.delta) / num; if (t > 1f) { t = 1f; } float z = ((GameLogic.Self.position.z - base.transform.position.z) * t) + base.transform.position.z; base.transform.position = new Vector3(0f, 0f, z); base.transform.position = Vector3.Lerp(base.transform.position, GameLogic.Self.position, t); } this.SetCameraRound(); } }
private void UpdateDirection() { float x = this.target.position.x - base.m_Entity.position.x; float y = this.target.position.z - base.m_Entity.position.z; float num3 = Utils.getAngle(x, y); if (this.state == 0) { this.offsetangle += this.peradd; if (MathDxx.Abs(this.offsetangle) >= this.maxadd) { this.state = 1; } } else { this.offsetangle -= this.peradd; if (MathDxx.Abs(this.offsetangle) >= this.maxadd) { this.state = 0; } } this.m_MoveData.angle = num3 + this.offsetangle; this.m_MoveData.direction = new Vector3(MathDxx.Sin(this.m_MoveData.angle), 0f, MathDxx.Cos(this.m_MoveData.angle)); base.m_Entity.m_AttackCtrl.RotateHero(this.m_MoveData.angle); }
private void InitUI() { GameLogic.Hold.Sound.PlayUI(0xf4244); this.buttonok.onClick = new Action(this.OnClickOK); this.buttoncancel.onClick = new Action(this.OnClickCanccel); GameLogic.SetPause(true); bool flag = GameLogic.Random(0, 100) < 40; Room_eventdemontext2lose _eventdemontextlose = null; int randomID = GameLogic.Release.Form.GetRandomID("DemonSkill"); this.mFormid = randomID; Room_eventdemontext2skill beanById = LocalModelManager.Instance.Room_eventdemontext2skill.GetBeanById(randomID); int index = GameLogic.Random(0, beanById.Loses.Length); int num4 = beanById.Loses[index]; _eventdemontextlose = LocalModelManager.Instance.Room_eventdemontext2lose.GetBeanById(beanById.Loses[index]); this.mGetid = beanById.GetID; object[] args = new object[] { GameLogic.Hold.Language.GetLanguageByTID("获得技能", Array.Empty <object>()), GameLogic.Hold.Language.GetSkillName(this.mGetid) }; this.text_content2.text = Utils.FormatString("{0} : {1}", args); int skillIcon = LocalModelManager.Instance.Skill_skill.GetBeanById(this.mGetid).SkillIcon; this.image_2.set_sprite(SpriteManager.GetSkillIcon(skillIcon)); this.image_2.GetComponent <RectTransform>().sizeDelta = new Vector2(120f, 120f); this.mLoseid = _eventdemontextlose.LoseID; Goods_goods.GoodData goodData = Goods_goods.GetGoodData(LocalModelManager.Instance.Goods_food.GetBeanById(this.mLoseid).Values[0]); string str = MathDxx.Abs((long)(((float)(GameLogic.Self.m_EntityData.attribute.HPValue.ValueLong * goodData.value)) / 10000f)).ToString(); object[] objArray2 = new object[] { GameLogic.Hold.Language.GetLanguageByTID("失去", Array.Empty <object>()), str, GameLogic.Hold.Language.GetLanguageByTID(_eventdemontextlose.Content1, Array.Empty <object>()) }; this.text_content1.text = Utils.FormatString("{0} {1} {2}", objArray2); }
private void RandomCloudY(ref float clouda, float cloudb) { clouda = GameLogic.Random(-this.randomheight, this.randomheight); while (MathDxx.Abs((float)(clouda - cloudb)) < 4f) { clouda = GameLogic.Random(-this.randomheight, this.randomheight); } }
public int nextInt(int min, int max) { if (min >= max) { return(min); } return((MathDxx.Abs(this.nextInt()) % (max - min)) + min); }
private float GetHeroRotate(float currenty, float endx, float endy, float framepery) { float x = endx; float y = endy; float num3 = (Utils.getAngle(x, y) + 360f) % 360f; if (((MathDxx.Abs((float)(currenty - num3)) < 0.1f) || (MathDxx.Abs((float)((currenty - num3) + 360f)) < 0.1f)) || (MathDxx.Abs((float)((currenty - num3) - 360f)) < 0.1f)) { return(num3); } if (num3 < currenty) { if ((currenty - num3) < 180f) { currenty -= framepery; if (currenty < num3) { currenty = num3; } } else { currenty += framepery; if (currenty >= 360f) { currenty -= 360f; if (currenty > num3) { currenty = num3; } } } } else if ((num3 - currenty) >= 180f) { currenty -= framepery; if (currenty < 0f) { currenty += 360f; if (currenty < num3) { currenty = num3; } } } else { currenty += framepery; if (currenty > num3) { currenty = num3; } } return(Utils.GetFloat2(currenty)); }
protected override void OnUpdate() { float frameDistance = 0f; if ((Updater.AliveTime - this.currenttime) < this.move1time) { frameDistance = base.FrameDistance; } else if ((Updater.AliveTime - this.currenttime) >= this.waittime) { frameDistance = base.FrameDistance; if (!this.bFind) { this.mTarget = GameLogic.Release.Entity.GetNearEntity(this, false); this.bFind = true; } if ((this.mTarget != null) && !this.mTarget.GetIsDead()) { float x = this.mTarget.position.x - base.mTransform.position.x; float y = this.mTarget.position.z - base.mTransform.position.z; float target = Utils.getAngle(x, y); float current = base.mTransform.eulerAngles.y; float num6 = MathDxx.MoveTowardsAngle(current, target, this.perangle); float num7 = MathDxx.Abs((float)(current - num6)); float num8 = MathDxx.Abs((float)((current - num6) + 360f)); float num9 = MathDxx.Abs((float)((current - num6) - 360f)); if (num7 > num8) { num7 = num8; } if (num7 > num9) { num7 = num9; } this.currentrotateangle += num7; base.bulletAngle = num6; base.UpdateMoveDirection(); } } base.mTransform.position += new Vector3(base.moveX, 0f, base.moveY * 1.23f) * frameDistance; base.CurrentDistance += frameDistance; if (base.CurrentDistance >= base.Distance) { this.overDistance(); } }
public bool RotateOver() { if (this.OnRotateOverEvent != null) { return(this.OnRotateOverEvent()); } if (MathDxx.Abs((float)(this.updateangley - this.RotateAngle)) >= 1f) { return(false); } this.updateangley = Utils.getAngle(this.Direction.x, this.Direction.z); if (this.m_EntityHero.Child != null) { this.m_EntityHero.Child.transform.localRotation = Quaternion.Euler(0f, this.updateangley, 0f); } return(true); }
public Sequence PlayCount(int after, float alltime) { int num = MathDxx.Abs((int)(after - this.current)); float num2 = alltime; if (num != 0) { num2 = alltime / ((float)num); } num2 = MathDxx.Clamp(num2, 0f, 0.15f); this.PlayTextScale(1.4f, 0.15f); TweenSettingsExtensions.SetUpdate <Tweener>(DOTween.To(new DOGetter <int>(this, this.get_current), new DOSetter <int>(this, this.< PlayCount > m__0), after, num2 * num), true); Sequence sequence = DOTween.Sequence(); TweenSettingsExtensions.SetUpdate <Sequence>(TweenSettingsExtensions.AppendInterval(TweenSettingsExtensions.AppendCallback(TweenSettingsExtensions.AppendInterval(sequence, num2 * (num - 1)), new TweenCallback(this, this.< PlayCount > m__1)), num2), true); return(sequence); }
protected override HittedData OnHittedData(HittedData data, bool bulletthrough, float bulletangle) { if (!bulletthrough) { float y = base.eulerAngles.y; if (((MathDxx.Abs((float)(y - bulletangle)) < 90f) || (MathDxx.Abs((float)((y - bulletangle) + 360f)) < 90f)) || (MathDxx.Abs((float)((y - bulletangle) - 360f)) < 90f)) { return(data); } if (base.m_MoveCtrl.GetMoving()) { base.PlayEffect(0x13d621, base.m_Body.SpecialHitMask.transform.position); data.type = EHittedType.eDefence; data.hitratio = 0.4f; data.backtatio = 0.7f; return(data); } } return(data); }
private void OnUpdateGoto() { if (this.bGotoStart) { if (MathDxx.Abs((float)(this.mGotoTemp - this.mGotoValue)) < 3f) { this.bGotoStart = false; } if (base.horizontal) { this.mGotoTemp = Mathf.Lerp(base.get_content().anchoredPosition.x, this.mGotoValue, 0.2f); base.get_content().anchoredPosition = new Vector2(this.mGotoTemp, base.get_content().anchoredPosition.y); } else { this.mGotoTemp = Mathf.Lerp(base.get_content().anchoredPosition.y, this.mGotoValue, 0.2f); base.get_content().anchoredPosition = new Vector2(base.get_content().anchoredPosition.x, this.mGotoTemp); } } }
public void Init(int before, int after) { this.m_before = before; this.m_after = after; this.m_current = this.m_before; this.SetTextValue(this.m_before); this.child.localScale = new Vector3(0f, 1f, 1f); this.child.sizeDelta = new Vector2(this.Text_Value.preferredWidth, this.child.sizeDelta.y); this.image_bg.sizeDelta = new Vector2(this.Text_Value.preferredWidth + 300f, this.image_bg.sizeDelta.y); int num = after - before; bool flag = num >= 0; this.Text_Change.set_color(!flag ? color_reduce : color_add); string str = !flag ? "-" : "+"; object[] args = new object[] { str, MathDxx.Abs(num) }; this.Text_Change.text = Utils.FormatString("{0}{1}", args); this.Text_Change.get_rectTransform().anchoredPosition = new Vector2(this.Text_Value.preferredWidth + 10f, 0f); this.PlayAnimation(); }
protected override void OnUpdate() { float frameDistance = base.FrameDistance; float x = this.endpos.x - base.mTransform.position.x; float y = this.endpos.z - base.mTransform.position.z; float target = Utils.getAngle(x, y); float bulletAngle = base.bulletAngle; this.perangle++; if (this.currentrotateangle < this.maxangle) { float num6 = MathDxx.MoveTowardsAngle(bulletAngle, target, this.perangle); if (num6 == target) { this.currentrotateangle = 2.147484E+09f; } float num7 = MathDxx.Abs((float)(bulletAngle - num6)); float num8 = MathDxx.Abs((float)((bulletAngle - num6) + 360f)); float num9 = MathDxx.Abs((float)((bulletAngle - num6) - 360f)); if (num7 > num8) { num7 = num8; } if (num7 > num9) { num7 = num9; } this.currentrotateangle += num7; base.bulletAngle = num6; base.UpdateMoveDirection(); } base.mTransform.position += new Vector3(base.moveX, 0f, base.moveY * 1.23f) * frameDistance; base.CurrentDistance += frameDistance; if (base.CurrentDistance >= base.Distance) { this.overDistance(); } }
public List <EntityBase> GetSectorEntities(EntityBase self, float range, float middleangle, float offsetangle, bool sameteam) { List <EntityBase> targetList = this.GetTargetList(self, sameteam); this.Sector_list.Clear(); int num = 0; int count = targetList.Count; while (num < count) { this.Sector_e = targetList[num]; float num3 = Vector3.Distance(this.Sector_e.position, self.position); if ((((this.Sector_e != null) && (this.Sector_e != self)) && (this.Sector_e.gameObject.activeInHierarchy && !this.Sector_e.GetIsDead())) && (num3 < range)) { float num4 = Utils.getAngle(this.Sector_e.position.x - self.position.x, this.Sector_e.position.z - self.position.z); if (((MathDxx.Abs((float)(num4 - middleangle)) <= offsetangle) || (MathDxx.Abs((float)((num4 - middleangle) + 360f)) <= offsetangle)) || (MathDxx.Abs((float)((num4 - middleangle) - 360f)) <= offsetangle)) { this.Sector_list.Add(this.Sector_e); } } num++; } return(this.Sector_list); }
private void init_offset() { this.symbol = (this.offsetposx < 0f) ? ((float)(-1)) : ((float)1); this.offsetposx = MathDxx.Abs(this.offsetposx); this.speed = MathDxx.Abs(this.speed); }
private void OnEntityHittedOnce(HitStruct data) { if ((((base.m_Entity != null) && !base.m_Entity.GetIsDead()) && (base.m_Entity.Type != EntityType.Baby)) && (!base.m_Entity.m_EntityData.GetCanShieldCount() || (data.before_hit >= 0L))) { bool bulletthrough = false; float bulletangle = 0f; if ((data.bulletdata != null) && (data.bulletdata.weapon != null)) { bulletthrough = data.bulletdata.weapon.bThroughEntity; } if ((data.bulletdata != null) && (data.bulletdata.bullet != null)) { bulletangle = data.bulletdata.bullet.transform.eulerAngles.y; } HittedData hittedData = base.m_Entity.GetHittedData(bulletthrough, bulletangle); if (data.type == HitType.Rebound) { data.real_hit = data.before_hit; } else if (data.before_hit >= 0L) { data.real_hit = data.before_hit; } else { if (!hittedData.GetCanHitted()) { return; } switch (data.sourcetype) { case HitSourceType.eBullet: if (((base.m_Entity != null) && (data.bulletdata != null)) && (data.bulletdata.weapon != null)) { float num2 = data.before_hit; num2 *= hittedData.hitratio; if (data.source != null) { float num4 = Vector3.Distance(base.m_Entity.position, data.source.position) / ((float)data.source.m_EntityData.attribute.DistanceAttackValueDis.Value); if (num4 < 1f) { float num5 = (1f - num4) * data.source.m_EntityData.attribute.DistanceAttackValuePercent.Value; num2 *= 1f + num5; } } data.before_hit = (long)num2; data = base.m_Entity.m_EntityData.GetHurt(data); if (data.type != HitType.Rebound) { bool headShot = false; if (!headShot) { headShot = base.m_Entity.m_EntityData.GetHeadShot(); } if (((!headShot && (base.m_Entity.Type != EntityType.Boss)) && ((data.source != null) && (base.m_Entity.m_EntityData.GetHPPercent() < data.source.m_EntityData.attribute.KillMonsterLessHP.Value))) && (GameLogic.Random((float)0f, (float)1f) < data.source.m_EntityData.attribute.KillMonsterLessHPRatio.Value)) { headShot = true; } if (headShot) { data.real_hit = -9223372036854775807L; data.type = HitType.HeadShot; } if (data.source != null) { data.source.m_EntityData.ExcuteHitAdd(); } } break; } return; case HitSourceType.eTrap: data = base.m_Entity.m_EntityData.GetHurt(data); break; case HitSourceType.eBody: data = base.m_Entity.m_EntityData.GetHurt(data); break; case HitSourceType.eBuff: data = base.m_Entity.m_EntityData.GetHurt(data); break; case HitSourceType.eSkill: data = base.m_Entity.m_EntityData.GetHurt(data); break; } } if (data.real_hit == 0L) { if (data.type == HitType.Miss) { GameLogic.CreateHPChanger(data.source, base.m_Entity, data); } } else { if (data.real_hit < 0f) { if (((data.sourcetype == HitSourceType.eBullet) && (data.bulletdata != null)) && ((data.bulletdata.bullet != null) && (data.bulletdata.weapon != null))) { hittedData.AddBackRatio(data.bulletdata.weapon.BackRatio); hittedData.AddBackRatio(base.m_Entity.m_Data.BackRatio); hittedData.SetBullet(data.bulletdata.bullet); hittedData.hittype = data.type; base.m_Entity.SetHitted(hittedData); } if ((((data.sourcetype == HitSourceType.eBullet) || (data.sourcetype == HitSourceType.eTrap)) || (data.sourcetype == HitSourceType.eBody)) && (GameLogic.Hold.BattleData.Challenge_ismainchallenge() && base.m_Entity.IsSelf)) { GameLogic.Hold.BattleData.AddHittedCount(GameLogic.Release.Mode.RoomGenerate.GetCurrentRoomID()); } long shieldHitValue = base.m_Entity.m_EntityData.GetShieldHitValue(-data.real_hit); data.real_hit += shieldHitValue; if (base.m_Entity.OnHitted != null) { base.m_Entity.OnHitted(data.source, data.real_hit); } if (((data.sourcetype == HitSourceType.eBullet) || (data.sourcetype == HitSourceType.eBody)) && (((data.source != null) && (data.real_hit < 0L)) && (data.type != HitType.Rebound))) { int num7 = 0; if (base.m_Entity.m_EntityData.attribute.ReboundHit.Value > 0L) { num7 += (int)base.m_Entity.m_EntityData.attribute.ReboundHit.Value; } if ((base.m_Entity.m_EntityData.attribute.ReboundTargetPercent.Value > 0f) && (data.source.Type != EntityType.Boss)) { num7 += (int)(data.source.m_EntityData.MaxHP * base.m_Entity.m_EntityData.attribute.ReboundTargetPercent.Value); } if (num7 > 0) { data.before_hit = -num7; GameLogic.SendHit_Rebound(data.source, base.m_Entity, data); } } } if ((base.m_Entity.IsSelf && (data.real_hit < 0f)) && ((base.m_Entity.m_EntityData.mDeadRecover > 0) && (base.m_Entity.m_EntityData.CurrentHP <= 10L))) { base.m_Entity.m_EntityData.UseDeadRecover(); } else { if ((GameLogic.Hold.BattleData.Challenge_RecoverHP() && (data.real_hit > 0L)) || (data.real_hit < 0L)) { GameLogic.CreateHPChanger(data.source, base.m_Entity, data); } if (((data.type == HitType.Crit) && (data.source != null)) && (data.source.OnCrit != null)) { data.source.OnCrit(MathDxx.Abs(data.real_hit)); } if (((data.sourcetype == HitSourceType.eBullet) || (data.sourcetype == HitSourceType.eBody)) || ((data.sourcetype == HitSourceType.eSkill) || (data.sourcetype == HitSourceType.eTrap))) { if (data.real_hit < 0L) { base.m_Entity.PlayEffect(base.m_Entity.m_Data.HittedEffectID); } if ((data.real_hit < 0L) && (data.bulletdata != null)) { if ((((data.source != null) && data.source.m_EntityData.GetLight45()) && ((data.bulletdata != null) && (data.bulletdata.bullet != null))) && !data.bulletdata.bullet.GetLight45()) { if (data.source.OnLight45 != null) { data.source.OnLight45(base.m_Entity); } } else { base.m_Entity.PlayEffect(data.bulletdata.weapon.HittedEffectID, base.m_Entity.m_Body.EffectMask.transform.position, Quaternion.Euler(0f, 90f - Utils.getAngle(base.m_Entity.GetHittedDirection()), 0f)); } } base.m_Entity.PlaySound(data.soundid); } if (data.buffid > 0) { base.m_Entity.ChangeHPMust(data.source, data.real_hit); } else { base.m_Entity.ChangeHP(data.source, data.real_hit); } } } } }
public void SetEndPos(Vector3 endpos, float offsetangle) { this.endpos = endpos; this.maxangle = MathDxx.Abs(offsetangle) + 60f; }
public void Init(EntityBase entity, HitStruct hs) { this.mHitType = hs.type; this.curve_pos = GameLogic.GetHPChangerAnimation(this.mHitType, 0); this.curve_scale = GameLogic.GetHPChangerAnimation(this.mHitType, 1); this.curve_alpha = GameLogic.GetHPChangerAnimation(this.mHitType, 2); this.starttime = Updater.AliveTime; this.OffsetX = GameLogic.Random((float)-50f, (float)50f); this.OffsetY = GameLogic.Random((float)0f, (float)30f); this.MovePer.x = this.OffsetX / 14f; this.MovePer.y = this.OffsetY / 14f; this.CurrentMoveCount = 14; this.MoveAll = Vector3.zero; this.m_Entity = entity; this.entitypos = entity.position; this.entitybodypos = entity.m_Body.HPMask.transform.localPosition; if (hs.element != EElementType.eNone) { this.text.set_color(EntityData.ElementData[hs.element].color); this.text.text = hs.real_hit.ToString(); } else { switch (this.mHitType) { case HitType.Crit: { object[] args = new object[] { hs.real_hit }; this.text.text = Utils.FormatString("{0}!", args); this.text.set_color(Color.red); this.text.fontSize = (int)(this.FontSize * this.CritFontScale); return; } case HitType.HeadShot: this.text.text = GameLogic.Hold.Language.GetLanguageByTID("爆头", Array.Empty <object>()); this.text.set_color(Color.red); this.text.fontSize = (int)(this.FontSize * this.HeadShotFontScale); return; case HitType.Add: { object[] args = new object[] { hs.real_hit }; this.text.text = Utils.FormatString("+{0}", args); this.text.set_color(Color.green); return; } case HitType.Block: this.text.text = hs.real_hit.ToString(); this.text.set_color(Color.gray); return; case HitType.Miss: this.text.text = "Miss"; this.text.set_color(Color.yellow); return; case HitType.HPMaxChange: { string languageByTID = GameLogic.Hold.Language.GetLanguageByTID("生命上限", Array.Empty <object>()); object[] args = new object[] { languageByTID, MathDxx.GetSymbolString(hs.real_hit), MathDxx.Abs(hs.real_hit) }; this.text.text = Utils.FormatString("{0}{1}{2}", args); this.text.set_color((hs.real_hit < 0L) ? Color.red : Color.green); return; } } this.text.text = hs.real_hit.ToString(); this.text.set_color(Color.white); this.text.fontSize = this.FontSize; } }