void OnCollisionEnter(Collision collisionInfo) { HitTypes type = HitTypes.Other; var wall = collisionInfo.gameObject.GetComponent <Wall>(); var brick = collisionInfo.gameObject.GetComponent <Brick>(); var player = collisionInfo.gameObject.GetComponent <Player>(); this.gameObject.transform.rotation = Quaternion.identity; if (wall) { type = HitTypes.Wall; handleSpeed(wall.wallType); } else if (player) { type = HitTypes.Player; control(this.transform.position.x > collisionInfo.transform.position.x); } else if (brick) { type = HitTypes.Brick; handleBrickHit(); var randomMoveForward = new System.Random().Next(0, 2) == 0 ? true : false; control(randomMoveForward); } if (onHit != null) { onHit(type, brickHitsStreak); } }
protected override void ReportHit(HitTypes type) { misMan.SendMessage("OnTargetDeath"); GameObject explody = (GameObject)Instantiate(Resources.Load("DiscExplode")); explody.transform.position = transform.position; explody.transform.localScale *= .1f; GameObject explChld1 = explody.transform.GetChild(0).gameObject; GameObject explChld2 = explChld1.transform.GetChild(0).gameObject; GameObject explChld3 = explChld1.transform.GetChild(1).gameObject; Color myColor = gameMan.GetComponent<GameManager>().pColor[1]; // set the colors explChld1.GetComponent<ParticleSystem>().startColor = (myColor + Color.white * .3f); explChld2.GetComponent<ParticleSystem>().startColor = (myColor + Color.white * .3f); explChld3.GetComponent<ParticleSystem>().startColor = (myColor + Color.white * .3f); // and time its destroy Destroy(explody, 2.0f); // play a sound AkSoundEngine.PostEvent("Play_DiscHit", gameObject); Destroy(gameObject); }
public void OnHit(HitTypes type, int streak) { if (type == HitTypes.Brick) { Display(streak.ToString()); } }
public void OnHit(HitTypes type, int streak) { if (type == HitTypes.Brick && streak % hitStreakStep == 0) { this.score += additionalHitScore; UpdateScoreboard(); } }
public void TakeDamage(int damage, HitTypes source, bool generateStamina = true) { // perhaps change parameters to get enum of what attack killed it to determine death animation LastHitTime = Time.time; health -= damage; if(health <= 0 && !isDead){ isDead = true; lastHitType = source; _state.curState = ZombieSM.ZombieState.Die; // transform.FindChild("ZombieAttackRange").gameObject.SetActive(false); // Find better solution than turning them off // transform.FindChild("ZombieDetectionRange").gameObject.SetActive(false); if (generateStamina) { DropItem(); //GameObject.FindGameObjectWithTag("Player").GetComponent<Player>().curStamina += 20; } if(CountDeath) // removes from Zombie Spawner counter transform.parent.GetComponent<ZombieSpawner2>().ZombieCount--; // Just for Boss Zombie if(damage != 1007) StartCoroutine( TurnOffCharacterController(0.4f) ); else CC.enabled = false; direction facing = FindDirection(); ChooseDeathAnimation(facing); PlayDeathSound(source, generateStamina); //if (lastHitType == HitTypes.burstLaser) { // GetComponents<AudioSource>()[0].Play(); // disintigrate //} StartCoroutine( waitForAnimationToEnd()); } else if(isDead){ // In case the player keeps attacking the zombie even though it has already died // Don't process anything // Just for Boss if(damage == 1007) CC.enabled = false; } else if(isStunned){ // If Zombie is stunned curAnim.Play (); StartCoroutine( PauseWhenHit(hitPauseTime)); } else if(_state.curState == ZombieSM.ZombieState.TakingDamage){ hitMultipleTimes = true; } else{ // taking damage _state.curState = ZombieSM.ZombieState.TakingDamage; PlayRandomHitSound(); StartCoroutine( PauseWhenHit(hitPauseTime)); } }
public void Damage(float amount, HitTypes type = HitTypes.none) { //Dont process anything if we are already destroyed! if (destroyed || captured) { return; } //Set the last hit type. LastHitBy = type; //Subtract the health. Health -= amount; //Checking if the damage is a healing damage. if (amount > 0) { //here we take care of hurting. as the damage is greater than 0. if (HurtSoundEffect) { AudioPlayer.GetPlayer().PlaySound(HurtSoundEffect); } //Play the particle effect. if (StandardHit) { //StandardHit.transform.position = transform.position; StandardHit.Play(); } } else { //If there are any healting effects to apply. if (HealSoundEffect) { AudioPlayer.GetPlayer().PlaySound(HealSoundEffect); } if (HealEffect) { HealEffect.Play(); } } //Check to see if the target has been destroyed if (Health <= 0) { KillMe(); } }
// this is called if the disc is hit with registered hit type (and this is the active step) void DiscHit(HitTypes type) { // if the type of hit matches the step type if ((int)(type - 1) == (int)stepType) { // we've done the step stepPassed = true; // if we're supposed to display the "done" message, do it if (displayDone) DisplayDone(); } }
private void PlayDeathSound(HitTypes source, bool stam) { if (source == HitTypes.sword) { //if(Random.value < 0.4f){ audio.clip = DeathSounds[0]; audio.Play(); //} } else if (source == HitTypes.burstLaser && stam) { audio.clip = DeathSounds[1]; audio.Play(); } }
public int GetScore(HitTypes hitType) { switch (hitType) { case HitTypes.Outer: return 10; case HitTypes.Inner: return 25; case HitTypes.BullsEye: return 50; default: return 0; } }
private Task Track(HitTypes hitType, params KeyValuePair <string, string>[] parameters) { return(Task.Run(async() => { try { if (Context.Get <AllSettings>().ShareUsageStatistic) { List <KeyValuePair <string, string> > allParameters = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>(GAResources.ProtocolVersionKey, GAResources.ProtocolVersionFirst), new KeyValuePair <string, string>(GAResources.AccountIdKey, GAResources.AccountId), new KeyValuePair <string, string>(GAResources.ClientIdKey, Context.Get <AllSettings>().RegistrySettings.ClientId), new KeyValuePair <string, string>(GAResources.ApplicationNameKey, GAResources.ApplicationName), new KeyValuePair <string, string>(GAResources.HitTypeKey, hitType.ToString().ToLower()), new KeyValuePair <string, string>(GAResources.ProgramVersionKey, Context.Get <IVersionProvider>().VersionString), new KeyValuePair <string, string>(GAResources.UserLanguageKey, string.Format("{0} (installed) -> {1} (used)", CultureInfo.InstalledUICulture, Context.Get <AllSettings>().SelectedCulture)) }; string screenResolution = ScreenResolutionOrNull; if (screenResolution != null) { allParameters.Add(new KeyValuePair <string, string>(GAResources.ScreenResoultionKey, ScreenResolutionOrNull)); } allParameters.AddRange(parameters); using (HttpClient client = new HttpClient()) { HttpResponseMessage response = await client.PostAsync(GAResources.CollectUrl, new FormUrlEncodedContent(allParameters)); if (response.IsSuccessStatusCode) { await response.Content.ReadAsStringAsync(); } } } } catch (Exception exception) { Context.Get <IExceptionLogging>().Write(exception); } })); }
// abstract the underlying settings designer class because.. // - users are agnostic to the underlying Properties.Settings.Default get/set implementation // - simpler xaml binding to avoid need for either.. // - StaticResource reference; prone to errors if Default isn't referenced in Folder (i.e. else new class used) // e.g. <properties:Settings x:Key="Settings"/> // Text="{Binding Source={StaticResource Settings}, Folder=Default.FrontendFolder}" // - Static reference; too long // e.g. Text="{Binding Source={x:Static p:Settings.Default}, Folder=FrontendFolder}" // - vs a simple regular data binding // e.g. Text="{Binding FrontendFolder}" public Config() { CheckContentTypes = new ObservableStringCollection <string>(Properties.Settings.Default.CheckContentTypes).Observable; CheckHitTypes = new ObservableCollectionJson <HitTypeEnum>(Properties.Settings.Default.CheckHitTypes, value => Properties.Settings.Default.CheckHitTypes = value) .Observable; FixHitTypes = new ObservableCollectionJson <HitTypeEnum>(Properties.Settings.Default.FixHitTypes, value => Properties.Settings.Default.FixHitTypes = value).Observable; // reset the settings if the user's stored settings version differs to the default version if (Properties.Settings.Default.ActualVersion < Properties.Settings.Default.RequiredVersion) { Reset(); } ContentTypes = GetFrontendFolders().Where(x => !x.IsDatabase).ToArray(); HitTypes.ForEach(x => x.Description = x.Enum.GetDescription()); UpdateIsValid(); }
public static void RecordEvent(HitTypes hit, ConfusionMatrix a) { switch (hit) { case HitTypes.trueNegative: a.trueNs++; break; case HitTypes.truePositive: a.truePs++; break; case HitTypes.falsePositive: a.falsePs++; break; case HitTypes.falseNegative: a.falseNs++; break; default: break; } }
public void RecordEvent(HitTypes hit) { switch (hit) { case HitTypes.trueNegative: this.trueNs++; break; case HitTypes.truePositive: this.truePs++; break; case HitTypes.falsePositive: this.falsePs++; break; case HitTypes.falseNegative: this.falseNs++; break; default: break; } }
public void OnHit(HitTypes type, int streak) { if (type != HitTypes.Other) { if (streak % hitStreakStep == 0) { this.currentPitch += additionalHitPitch; } switch (type) { case HitTypes.Brick: Play(brickHit); break; case HitTypes.Player: Play(playerHit); break; case HitTypes.Wall: Play(wallHit); break; } } }
public int GetScore(HitTypes hitType) { return 0; }
public void TakeDamage(int damage, HitTypes source, bool generateStamina = true) // perhaps change parameters to get enum of what attack killed it to determine death animation { LastHitTime = Time.time; health -= damage; if (health <= 0 && !isDead) { isDead = true; lastHitType = source; _state.curState = ZombieSM.ZombieState.Die; // transform.FindChild("ZombieAttackRange").gameObject.SetActive(false); // Find better solution than turning them off // transform.FindChild("ZombieDetectionRange").gameObject.SetActive(false); if (generateStamina) { DropItem(); //GameObject.FindGameObjectWithTag("Player").GetComponent<Player>().curStamina += 20; } if (CountDeath) // removes from Zombie Spawner counter { transform.parent.GetComponent <ZombieSpawner2>().ZombieCount--; } // Just for Boss Zombie if (damage != 1007) { StartCoroutine(TurnOffCharacterController(0.4f)); } else { CC.enabled = false; } direction facing = FindDirection(); ChooseDeathAnimation(facing); PlayDeathSound(source, generateStamina); //if (lastHitType == HitTypes.burstLaser) { // GetComponents<AudioSource>()[0].Play(); // disintigrate //} StartCoroutine(waitForAnimationToEnd()); } else if (isDead) // In case the player keeps attacking the zombie even though it has already died // Don't process anything // Just for Boss { if (damage == 1007) { CC.enabled = false; } } else if (isStunned) // If Zombie is stunned { curAnim.Play(); StartCoroutine(PauseWhenHit(hitPauseTime)); } else if (_state.curState == ZombieSM.ZombieState.TakingDamage) { hitMultipleTimes = true; } else // taking damage { _state.curState = ZombieSM.ZombieState.TakingDamage; PlayRandomHitSound(); StartCoroutine(PauseWhenHit(hitPauseTime)); } }
public void Activate(HitTypes type) { gameObject.SetActive(this.Type == type); }
public BulletHitInfo(Player victim, HitTypes hitType) { Victim = victim; HitType = hitType; }
private Task Track(HitTypes hitType, params KeyValuePair<string, string>[] parameters) { return Task.Run(async () => { try { if (Context.Get<AllSettings>().ShareUsageStatistic) { List<KeyValuePair<string, string>> allParameters = new List<KeyValuePair<string, string>> { new KeyValuePair<string, string>(GAResources.ProtocolVersionKey, GAResources.ProtocolVersionFirst), new KeyValuePair<string, string>(GAResources.AccountIdKey, GAResources.AccountId), new KeyValuePair<string, string>(GAResources.ClientIdKey, Context.Get<AllSettings>().RegistrySettings.ClientId), new KeyValuePair<string, string>(GAResources.ApplicationNameKey, GAResources.ApplicationName), new KeyValuePair<string, string>(GAResources.HitTypeKey, hitType.ToString().ToLower()), new KeyValuePair<string, string>(GAResources.ProgramVersionKey, Context.Get<IVersionProvider>().VersionString), new KeyValuePair<string, string>(GAResources.UserLanguageKey, string.Format("{0} (installed) -> {1} (used)", CultureInfo.InstalledUICulture, Context.Get<AllSettings>().SelectedCulture)) }; string screenResolution = ScreenResolutionOrNull; if (screenResolution != null) allParameters.Add(new KeyValuePair<string, string>(GAResources.ScreenResoultionKey, ScreenResolutionOrNull)); allParameters.AddRange(parameters); using (HttpClient client = new HttpClient()) { HttpResponseMessage response = await client.PostAsync(GAResources.CollectUrl, new FormUrlEncodedContent(allParameters)); if (response.IsSuccessStatusCode) { await response.Content.ReadAsStringAsync(); } } } } catch (Exception exception) { Context.Get<IExceptionLogging>().Write(exception); } }); }
private void PlayDeathSound(HitTypes source, bool stam) { if(source == HitTypes.sword){ //if(Random.value < 0.4f){ audio.clip = DeathSounds[0]; audio.Play(); //} } else if(source == HitTypes.burstLaser && stam){ audio.clip = DeathSounds[1]; audio.Play(); } }
// report this hit to the tutorial manager protected virtual void ReportHit(HitTypes type) { if (tutMan.curStep != null) tutMan.curStep.SendMessage("DiscHit", type); }
public void OnShot(Key key, HitTypes hitType) { if (!presses.ContainsKey(key) || presses[key]++ >= 5) { return; } audioPlayer.Play(); gunAimPhysics.Jerk(0, -2); if (hitType == HitTypes.Miss) { return; } scores[key] += gunAimPhysics.GetScore(hitType); var shot = new ShotViewModel { X = CrossHair.X, Y = CrossHair.Y }; Shots.Add(shot); }