void Update() { if (Input.GetKeyDown(KeyCode.Z)) { FirePDU fire = new FirePDU(); fire.EventId = new EventId(8, 9, 10); fire.BurstDescriptor.Munition = new EntityType(1, 2, 3, 4, 5, 6, 7); fire.Location = new Vector3Double(11, 22, 33); ExerciseConnection.Instance.SendPDU(fire); } if (Input.GetKeyDown(KeyCode.X)) { DetonationPDU detoantion = new DetonationPDU(); detoantion.EventId = new EventId(999, 888, 777); detoantion.BurstDescriptor.Munition = new EntityType(9, 8, 7, 6, 5, 4, 3); detoantion.Location = new Vector3Double(11, 22, 33); ExerciseConnection.Instance.SendPDU(detoantion); } if (Input.GetKeyDown(KeyCode.C)) { EventReportPDU eventReport = new EventReportPDU(); eventReport.EventType = 33; eventReport.FixedDatumRecords.Add(new FixedDatumRecord() { FixedDatumID = 12, FixedDatumValue = 34 }); eventReport.VariableDatumRecords.Add(new VariableDatumRecord() { VariableDatumID = 55, VariableDatumValue = new byte[] { 0x11, 0x22, 0x33, 0x44 } }); eventReport.VariableDatumRecords.Add(new VariableDatumRecord() { VariableDatumID = 70, VariableDatumValue = System.Text.Encoding.UTF8.GetBytes("Hello!") }); ExerciseConnection.Instance.SendPDU(eventReport); } if (Input.GetKeyDown(KeyCode.V)) { var sampleEventReport = new SampleEventReport(); sampleEventReport.A = 123.456f; sampleEventReport.B = 789; CustomEventReportsManager.Instance.Send(sampleEventReport); } if (Input.GetKeyDown(KeyCode.B)) { var damageState = (DamageState)UnityEngine.Random.Range(0, 4); var lifeformState = (LifeformState)UnityEngine.Random.Range(0, 10); var primaryWeaponState = (WeaponState)UnityEngine.Random.Range(0, 4); _publishedEntity.State.Appearance.DamageState = damageState; _publishedEntity.State.Appearance.LifeformState = lifeformState; _publishedEntity.State.Appearance.PrimaryWeaponState = primaryWeaponState; Debug.Log($"Set damageState={damageState} lifeformState={lifeformState} primaryWeaponState={primaryWeaponState}"); } if (Input.GetKeyDown(KeyCode.N)) { var reflectedEntity = FindObjectOfType <ReflectedEntity>(); var damageState = reflectedEntity.State.Appearance.DamageState; var lifeformState = reflectedEntity.State.Appearance.LifeformState; var primaryWeaponState = reflectedEntity.State.Appearance.PrimaryWeaponState; Debug.Log($"RefletedEntity damageState={damageState} lifeformState={lifeformState} primaryWeaponState={primaryWeaponState}"); } UpdateMovement(); }
private void ReceivedDetonationPDU(DetonationPDU detonation) { Debug.Log($"Received detonation PDU! ({detonation.Location.X}, {detonation.Location.Y}, {detonation.Location.Z})"); }