public void InitLaser(NodeAddedEvent e, SelfActiveTankNode activeTank, [JoinByTank] WeaponWithLaser weapon, [JoinAll] SingleNode <LaserSightSettingsComponent> settings) { if (settings.component.Enabled) { GameObject asset = weapon.shaftAimingLaser.Asset; for (int i = 0; i < weapon.muzzlePoint.Points.Length; i++) { GetInstanceFromPoolEvent eventInstance = new GetInstanceFromPoolEvent { Prefab = asset }; base.ScheduleEvent(eventInstance, activeTank); Transform instance = eventInstance.Instance; GameObject gameObject = instance.gameObject; ShaftAimingLaserBehaviour component = gameObject.GetComponent <ShaftAimingLaserBehaviour>(); weapon.shaftAimingLaser.EffectInstance = component; CustomRenderQueue.SetQueue(gameObject, 0xc4e); Transform transform = weapon.weaponInstance.WeaponInstance.transform; instance.position = transform.position; instance.rotation = transform.rotation; gameObject.SetActive(true); component.Init(); component.SetColor(Color.red); component.Show(); } weapon.Entity.AddComponent <ShaftAimingLaserReadyComponent>(); } }
public void Init(MuzzlePointComponent muzzlePoint) { GameObject gameObject = Instantiate <GameObject>(this.effectPrefab); UnityUtil.InheritAndEmplace(gameObject.transform, muzzlePoint.Current); this.Instance = gameObject.GetComponent <StreamEffectBehaviour>(); CustomRenderQueue.SetQueue(gameObject, 0xc4e); }
public void CreateEffect(NodeAddedEvent e, IsisRayEffectInitNode node) { GameObject gameObject = Object.Instantiate <GameObject>(node.isisGraphics.RayPrefab); CustomRenderQueue.SetQueue(gameObject, 0xc4e); UnityUtil.InheritAndEmplace(gameObject.transform, node.muzzlePoint.Current); node.isisGraphics.Ray = gameObject.GetComponent <IsisRayEffectBehaviour>(); node.isisGraphics.Ray.Init(); node.Entity.AddComponent <IsisGraphicsReadyComponent>(); }
public void Init(NodeAddedEvent evt, PelletThrowingGraphicsInitNode node) { MuzzlePointComponent muzzlePoint = node.muzzlePoint; PelletThrowingGraphicsComponent pelletThrowingGraphics = node.pelletThrowingGraphics; pelletThrowingGraphics.Trails = InstantiateAndInherit(muzzlePoint, pelletThrowingGraphics.Trails); pelletThrowingGraphics.Hits = InstantiateAndInherit(muzzlePoint, pelletThrowingGraphics.Hits); CustomRenderQueue.SetQueue(pelletThrowingGraphics.gameObject, 0xc4e); node.Entity.AddComponent <PelletThrowingGraphicsReadyComponent>(); }
private void InstantiateMuzzleEffect(GameObject prefab, MuzzlePointNode muzzlePointNode, float duration) { GetInstanceFromPoolEvent eventInstance = new GetInstanceFromPoolEvent { Prefab = prefab, AutoRecycleTime = duration }; base.ScheduleEvent(eventInstance, muzzlePointNode); GameObject gameObject = eventInstance.Instance.gameObject; UnityUtil.InheritAndEmplace(gameObject.transform, muzzlePointNode.muzzlePoint.Current); CustomRenderQueue.SetQueue(gameObject, 0xc4e); gameObject.gameObject.SetActive(true); }
public void InstantiateLaserForRemoteTank(NodeAddedEvent evt, ShaftAimingLaserNode weapon, [Context, JoinByTank] RemoteTankNode remoteTank) { if (remoteTank.assembledTank.AssemblyRoot) { GameObject gameObject = Object.Instantiate <GameObject>(weapon.shaftAimingLaser.Asset); ShaftAimingLaserBehaviour component = gameObject.GetComponent <ShaftAimingLaserBehaviour>(); weapon.shaftAimingLaser.EffectInstance = component; CustomRenderQueue.SetQueue(gameObject, 0xc4e); Transform transform = weapon.shaftAimingLaserSource.gameObject.transform; gameObject.transform.position = transform.position; gameObject.transform.rotation = transform.rotation; component.Init(); component.SetColor(weapon.shaftAimingColorEffect.ChoosenColor); weapon.Entity.AddComponent <ShaftAimingLaserReadyComponent>(); } }
public void Build(NodeAddedEvent e, BulletNode node, [JoinBy(typeof(TankGroupComponent))] WeaponNode weaponNode) { BulletComponent bullet = node.bullet; Quaternion quaternion = Quaternion.LookRotation(bullet.Direction); BulletEffectInstanceComponent component = new BulletEffectInstanceComponent(); GetInstanceFromPoolEvent eventInstance = new GetInstanceFromPoolEvent { Prefab = weaponNode.bulletEffect.BulletPrefab }; base.ScheduleEvent(eventInstance, node); GameObject gameObject = eventInstance.Instance.gameObject; gameObject.transform.position = bullet.Position; gameObject.transform.rotation = quaternion; gameObject.SetActive(true); component.Effect = gameObject; CustomRenderQueue.SetQueue(gameObject, 0xc4e); node.Entity.AddComponent(component); }
private void StartRailgunChargingByBaseEvent(BaseRailgunChargingShotEvent evt, RailgunChargingNode muzzle, TankActiveNode tank) { RailgunChargingWeaponComponent railgunChargingWeapon = muzzle.railgunChargingWeapon; GetInstanceFromPoolEvent eventInstance = new GetInstanceFromPoolEvent { Prefab = muzzle.railgunChargingEffect.Prefab, AutoRecycleTime = railgunChargingWeapon.ChargingTime }; base.ScheduleEvent(eventInstance, muzzle); Transform instance = eventInstance.Instance; GameObject gameObject = instance.gameObject; CustomRenderQueue.SetQueue(gameObject, 0xc4e); ParticleSystem component = gameObject.GetComponent <ParticleSystem>(); component.main.startLifetime = railgunChargingWeapon.ChargingTime; component.emission.enabled = true; UnityUtil.InheritAndEmplace(instance, muzzle.muzzlePoint.Current); gameObject.SetActive(true); base.CreateEntity("railgun_charging").AddComponent(new TankGroupComponent(tank.Entity)); }
private void DrawShotTrailEffect(Vector3 shotPosition, Vector3 hitPosition, GameObject prefab, GameObject tipPrefab) { GetInstanceFromPoolEvent eventInstance = new GetInstanceFromPoolEvent { Prefab = tipPrefab, AutoRecycleTime = tipPrefab.GetComponent <LineRendererEffectBehaviour>().duration }; base.ScheduleEvent(eventInstance, new EntityStub()); GameObject gameObject = eventInstance.Instance.gameObject; CustomRenderQueue.SetQueue(gameObject, 0xc4e); LineRendererEffectBehaviour component = gameObject.GetComponent <LineRendererEffectBehaviour>(); gameObject.SetActive(true); base.ScheduleEvent(eventInstance, new EntityStub()); GameObject obj3 = eventInstance.Instance.gameObject; LineRendererEffectBehaviour behaviour2 = obj3.GetComponent <LineRendererEffectBehaviour>(); obj3.SetActive(true); Vector3 vector = hitPosition - shotPosition; float magnitude = vector.magnitude; vector /= magnitude; if (magnitude <= 5f) { Vector3 vector5 = Vector3.Lerp(shotPosition, hitPosition, 0.5f); behaviour2.invertAlpha = true; Vector3[] vertices = new Vector3[] { shotPosition, vector5 }; behaviour2.Init(component.LastScale, vertices); Vector3[] vectorArray5 = new Vector3[] { vector5, hitPosition }; component.Init(behaviour2.LastScale, vectorArray5); } else { eventInstance.Prefab = prefab; eventInstance.AutoRecycleTime = prefab.GetComponent <LineRendererEffectBehaviour>().duration; base.ScheduleEvent(eventInstance, new EntityStub()); GameObject obj4 = eventInstance.Instance.gameObject; LineRendererEffectBehaviour behaviour3 = obj4.GetComponent <LineRendererEffectBehaviour>(); obj4.SetActive(true); Vector3 vector2 = vector * 2.5f; Vector3 vector3 = shotPosition + vector2; Vector3 vector4 = hitPosition - vector2; behaviour2.invertAlpha = true; Vector3[] vertices = new Vector3[] { shotPosition, vector3 }; behaviour2.Init(component.LastScale, vertices); Vector3[] vectorArray2 = new Vector3[] { vector3, vector4 }; behaviour3.Init(behaviour2.LastScale, vectorArray2); int index = 0; while (true) { if (index >= behaviour2.LastScale.Length) { Vector3[] vectorArray3 = new Vector3[] { vector4, hitPosition }; component.Init(behaviour2.LastScale, vectorArray3); break; } behaviour2.LastScale[index] += behaviour3.LastScale[index]; index++; } } }