private void ClearLines() { for (int i = 0; i < this.mLines.Count; i++) { BulletRedLineCtrl ctrl = this.mLines[i]; if (ctrl != null) { Object.Destroy(ctrl.gameObject); } } this.mLines.Clear(); }
protected override void OnInstall() { base.AttackEffect = "WeaponHand1066Effect"; this.redline = Object.Instantiate <GameObject>(ResourceManager.Load <GameObject>("Game/Bullet/Bullet1066_RedLine")); this.redline.SetParentNormal(base.m_Entity.m_Body.transform); this.ctrl = this.redline.GetComponent <BulletRedLineCtrl>(); this.ctrl.SetLine(true, 0f); this.time = 0f; Vector3 vector = new Vector3(MathDxx.Sin(base.m_Entity.eulerAngles.y + 90f), 0f, MathDxx.Cos(base.m_Entity.eulerAngles.y + 90f)) * 0.5f; RayCastManager.CastMinDistance(base.m_Entity.m_Body.transform.position + vector, base.m_Entity.eulerAngles.y, false, out float num); RayCastManager.CastMinDistance(base.m_Entity.m_Body.transform.position - vector, base.m_Entity.eulerAngles.y, false, out float num2); this.mindis = (num >= num2) ? num2 : num; Updater.AddUpdate("Weapon1066", new Action <float>(this.OnUpdate), false); base.OnInstall(); }
private void showlines(bool show) { if (this.mLines.Count == 0) { for (int i = 0; i < 4; i++) { GameObject child = Object.Instantiate <GameObject>(ResourceManager.Load <GameObject>("Game/Bullet/Bullet1102_RedLine")); child.SetParentNormal(base.m_Entity.m_Body.LeftBullet.transform); BulletRedLineCtrl component = child.GetComponent <BulletRedLineCtrl>(); this.mLines.Add(component); } } if (show) { int index = 0; int count = this.mLines.Count; while (index < count) { BulletRedLineCtrl ctrl2 = this.mLines[index]; ctrl2.gameObject.SetActive(true); if (this.startangle == 0f) { ctrl2.transform.rotation = Quaternion.Euler(0f, (index * 90f) + this.startangle, 0f); } else { ctrl2.transform.rotation = Quaternion.Euler(0f, angles[index], 0f); } ctrl2.UpdateLine(false, 0.5f); ctrl2.PlayLineWidth(); index++; } } else { int num4 = 0; int count = this.mLines.Count; while (num4 < count) { this.mLines[num4].gameObject.SetActive(false); num4++; } } }
public void Init(EntityBase entity, int count, float[] angles) { this.Deinit(); this.time = 0f; for (int i = 0; i < count; i++) { GameObject child = Object.Instantiate <GameObject>(ResourceManager.Load <GameObject>("Game/Bullet/Bullet1066_RedLine")); child.SetParentNormal(entity.m_Body.transform); child.transform.localRotation = Quaternion.Euler(0f, angles[i], 0f); BulletRedLineCtrl component = child.GetComponent <BulletRedLineCtrl>(); component.SetLine(true, 0f); Vector3 vector = new Vector3(MathDxx.Sin(angles[i] + 90f), 0f, MathDxx.Cos(angles[i] + 90f)) * 0.5f; RayCastManager.CastMinDistance(entity.m_Body.transform.position + vector, entity.eulerAngles.y, false, out float num2); RayCastManager.CastMinDistance(entity.m_Body.transform.position - vector, entity.eulerAngles.y, false, out float num3); this.mindiss.Add((num2 >= num3) ? num3 : num2); this.list.Add(component); } Updater.AddUpdate("Weapon1066", new Action <float>(this.OnUpdate), false); }