private void ActBhvr_DidGetHit(ActorBehavior arg1, HitStats arg2)
    {
        // Reset stun counter

        Debug.Log(this.gameObject.name + "got Hit");
        // Call Stun Function Here
    }
 private void ActBhvr_DidGetHit(ActorBehavior dfnsActBhvr, HitStats atckHitStats)
 {
     if (atckHitStats.WasBlocked)
     {
         // Flashes the mesh when hit blocked
         StartCoroutine(colorFlash(blckMeshColor));
     }
     else
     {
         // Flashes the mesh when damaged
         StartCoroutine(colorFlash(dmgMeshColor));
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Display how far the ball has gone in feet button
 /// </summary>
 /// <param name="distance"></param>
 /// <param name="isFoul"></param>
 /// <param name="isHomerun"></param>
 void OnHitDistanceEvent(int distance, bool isFoul, bool isHomerun, bool isCaught)
 {
     gcFSM.ChangeState(States.WaitForInput);
     hs           = new HitStats();
     hs.distance  = distance;
     hs.isFoul    = isFoul;
     hs.isHomerun = isHomerun;
     hs.isCaught  = isCaught;
     if (isHomerun == true)
     {
         audioCheer.PlayOneShot(audioCheer.clip, 0.6F);
     }
     hitStats.Add(hs);
     //Debug.Log("HIT ADDDED" + distance);
 }
Esempio n. 4
0
	public bool TakeDamage(GameObject HittingPlayer, int AttackingPlayerIndex, int AttackingClanIndex, float DamageAmount) {
			if (!IsSamePlayer (AttackingPlayerIndex, AttackingClanIndex)) { 	// check which player hits who - or has bounced ? then can shoot self
				// statistics - i should make visualizers for this
				HitStats HitStat = new HitStats ();
				HitStat.PlayerHitIndex = AttackingClanIndex;
				HitStat.DamageDone = DamageAmount;
				HitStat.HitTime = Time.time;
				HitList.Add (HitStat);
				// update stats
			bool IsItFriend = IsFriend(AttackingPlayerIndex, AttackingClanIndex);
			if (!(IsItFriend && DamageAmount > 0)) {
				MyStats.IncreaseState ("Health", -DamageAmount);
				CreateDamagePopup( HittingPlayer,gameObject, DamageAmount);
			}
			LastHitPlayer = HittingPlayer;
			// Change combat mode based on being hit
			BotPerception MyMovement = gameObject.GetComponent <BotPerception>();
			if (MyMovement != null) {
				MyMovement.TakeHit (Time.time, HittingPlayer.GetComponent<BaseCharacter>());
			}
			BeginAnimateColor();	// begin damage animation
			return true;
		}
		return false;
	}
Esempio n. 5
0
	public bool TakeHitBase(GameObject HittingObject) {
		MeshRenderer MyMeshRenderer = GetComponent<MeshRenderer> (); 
		if (!MyStats.IsDead) {
			BaseProjectile BaseProj = (BaseProjectile) HittingObject.gameObject.GetComponent ("BaseProjectile");
			if (BaseProj != null) {
				if (!BaseProj.DoneDamage ())
			//Debug.Log ("Damage: " + BaseProj.Damage + " Is being DELT! pewpew");
				if (!IsSamePlayer (BaseProj.GetPlayerIndex(), BaseProj.GetClanIndex())) { 	// check which player hits who - or has bounced ? then can shoot self
					BaseProj.HasHit ();
					bool IsItFriend = IsFriend (BaseProj.GetPlayerIndex(), BaseProj.GetClanIndex());
					// statistics - i should make visualizers for this
					HitStats HitStat = new HitStats ();
					HitStat.PlayerHitIndex = BaseProj.GetPlayerIndex();
					HitStat.DamageDone = BaseProj.GetDamage();
					HitStat.IsFriend = IsItFriend;
					HitStat.HitTime = Time.time;
					HitList.Add (HitStat);
					// update stats
					if (!(IsItFriend && BaseProj.GetDamage() > 0)) {
						MyStats.IncreaseState ("Health", -BaseProj.GetDamage());
						CreateDamagePopup (BaseProj.GetCharacterThatSpawned(), gameObject, BaseProj.GetDamage());
					}
					// add bullet effect - ie bleeding / burning / frozen

					BaseProj.ApplyOnHitEffects(this);

					LastHitPlayer = BaseProj.GetCharacterThatSpawned();
					// Change combat mode based on being hit
					BotPerception MyMovement = gameObject.GetComponent <BotPerception> ();
					if (MyMovement != null) {
						MyMovement.TakeHit (Time.time, BaseProj.GetCharacterThatSpawned().GetComponent<BaseCharacter> ());
					}

					BeginAnimateColor();	// begin damage animation
					return true;
				}
			} 
		}
			return false;
	}
 private void ActBhvr_DidHit(ActorBehavior arg1, HitStats arg2)
 {
     Debug.Log(this.gameObject.name + "Hit");
     // Call Hit Function here!
 }
    private void ActBhvr_DidHit(ActorBehavior atckActBhvr, HitStats atckHitStats)
    {
        if(atckHitStats.WasBlocked)
        {
            // Adjust damage
            atckHitStats.DamageDealt = chipDamage;
            // Set pitch to very low and play Hit sound.
            cmbPitch = 0.5f;
            punchSndPlyr.pitch = cmbPitch;
            punchSndPlyr.PlayOneShot(punchSndArray[0]);

            // Apply block knockback;

            // Drop Combo
            cmbCount = 0;
            isComboing = false;
            cmbDmgMult = 1.0f;
            prvsHit = null;
            return;
        }
        // Get current hit key
        string curHit = atckHitStats.Key;
        // Checks for Sync-hit
        if (atckHitStats.ComboTiming < cmbThreshold)
        {
            // New hit must be different from precious
            if (curHit != prvsHit)
            {
                // Increase combo count
                cmbCount++;
                // Reset Combo Timer
                comboTimer = cmbTimeout;
                // First Combo Hit
                if (!isComboing)
                { // Combo Start
                    isComboing = true;
                    StartCoroutine(ComboTimer());

                    // Reset pitch and play first Sync-Hit sound.
                    cmbPitch = 1.0f;
                    punchSndPlyr.pitch = cmbPitch;
                    punchSndPlyr.PlayOneShot(punchSndArray[0]);
                }
                else
                {
                    // Increase pitch linearly
                    cmbPitch += 0.2f;
                    // Apply current pitch and play second+ hit sound;
                    punchSndPlyr.pitch = cmbPitch;
                    punchSndPlyr.PlayOneShot(punchSndArray[0]);
                    // Cap Combo sound Pitch
                    if (cmbPitch > 2.4f) cmbPitch = 2.4f;
                }

                // Combo Multiplyer progression
                cmbDmgMult = 1 + (Mathf.Pow(cmbCount, 2)) / 20;
                // Cap combo Multiplier
                if (cmbDmgMult > 2.0f) cmbDmgMult = 2.0f;

                // Updates Damage
                atckHitStats.DamageDealt *= cmbDmgMult;
            }
            else
            { //Sync hit, but same hit - Drop combo.
                cmbCount = 0;
                isComboing = false;
                cmbDmgMult = 1.0f;

                // Reset pitch and play first Sync-Hit sound.
                cmbPitch = 1.0f;
                punchSndPlyr.pitch = cmbPitch;
                punchSndPlyr.PlayOneShot(punchSndArray[0]);
            }
        }
        else // Failed sync hit or blocked hit - Drop combo
        {
            cmbCount = 0;
            isComboing = false;
            cmbDmgMult = 1.0f;
        }
        // Update Combo HUD
        otherHUD.ShowCombo(cmbCount);
        otherHUD.SetComboAlpha(1);

        // Updates previous Hit
        prvsHit = curHit;
    }