public RudderEventBuilder SetRudderProperty(RudderProperty rudderProperty) { this.rudderProperty = rudderProperty; return(this); }
void Shoot() { // Reset the timer. timer = 0f; // Play the gun shot audioclip. gunAudio.Play(); // Enable the lights. gunLight.enabled = true; faceLight.enabled = true; // Stop the particles from playing if they were, then start the particles. gunParticles.Stop(); gunParticles.Play(); // Enable the line renderer and set it's first position to be the end of the gun. gunLine.enabled = true; gunLine.SetPosition(0, transform.position); // Set the shootRay so that it starts at the end of the gun and points forward from the barrel. shootRay.origin = transform.position; shootRay.direction = transform.forward; EnemyHealth enemyHealth = null; // Perform the raycast against gameobjects on the shootable layer and if it hits something... if (Physics.Raycast(shootRay, out shootHit, range, shootableMask)) { // Try and find an EnemyHealth script on the gameobject hit. enemyHealth = shootHit.collider.GetComponent <EnemyHealth>(); // If the EnemyHealth component exist... if (enemyHealth != null) { // ... the enemy should take damage. enemyHealth.TakeDamage(damagePerShot, shootHit.point); } // Set the second position of the line renderer to the point the raycast hit. gunLine.SetPosition(1, shootHit.point); } // If the raycast didn't hit anything on the shootable layer... else { // ... set the second position of the line renderer to the fullest extent of the gun's range. gunLine.SetPosition(1, shootRay.origin + shootRay.direction * range); } Debug.Log("Tracking Shoot"); RudderEvent rudderEvent = new RudderEventBuilder() .SetEventName("PlayerShooting_Shoot") .SetUserId("w240adxe7fseasn34m6u-4vpw1n7iac2jz9b135s7") .Build(); RudderProperty rudderProperty = new RudderProperty(); rudderProperty.AddProperty("category", "Shoot"); rudderProperty.AddProperty("transform_position", transform.position.ToString()); if (enemyHealth != null) { rudderProperty.AddProperty("enemy_health", enemyHealth.currentHealth.ToString()); } rudderEvent.SetProperties(rudderProperty); rudderEvent.AddIntegrations(RudderIntegrationPlatform.ALL, false); rudderEvent.AddIntegrations(RudderIntegrationPlatform.GOOGLE_ANALYTICS, true); rudderEvent.AddIntegrations(RudderIntegrationPlatform.AMPLITUDE, true); CompleteProject.PlayerMovement.rudderInstance.Track(rudderEvent); // Dictionary<string, object> demoOptions = new Dictionary<string, object>() { // {"category" , "Shoot" }, // {"transform_position" , transform.position.ToString()}, // {"rl_message_id" , rudderEvent.rl_message.rl_message_id} // }; // if (enemyHealth != null) // { // demoOptions.Add("enemy_health", enemyHealth.currentHealth); // } // Amplitude.Instance.logEvent("PlayerShooting_Shoot Direct", demoOptions); }
public RudderEventBuilder SetRudderProperty(RudderPropertyBuilder propertyBuilder) { this.rudderProperty = propertyBuilder.Build(); return(this); }
public void SetProperties(RudderProperty _properties) { this.SetProperties(_properties.GetPropertyMap()); }