public BattleSettings(int startingHp, int maxHp, BattleDamage missedBeatDamage, BattleDamage invalidInputDamage, int hitsInARowToHeal) { this.startingHp = startingHp; this.maxHp = maxHp; this.missedBeatDamage = missedBeatDamage; this.invalidInputDamage = invalidInputDamage; this.hitsInARowToHeal = hitsInARowToHeal; }
void OnTriggerEnter(Collider target) { BattleDamage damage = target.gameObject.GetComponent <BattleDamage>(); if (damage) { damage.TakeDamage(target, hitDamage); m_splatSound.Play(); } }
void OnCollisionEnter(Collision target) { //Debug.Log(ToString() + " bitch slapping collision target " + target.gameObject.ToString() + " with impulse " + target.impulse.ToString() + " and relative velocity " + target.relativeVelocity.ToString()); BattleDamage damage = target.gameObject.GetComponent <BattleDamage>(); if (damage) { damage.TakeDamage(target.collider, hitDamage); m_splatSound.Play(); } }
//Shoot calculates the initial ballistics direction public void Shoot() { // Check if our raycast has hit anything if (targetHit) { //Debug.Log("Target hit at " + hitTarget.distance + "m at collider " + hitTarget.collider.ToString() + " belonging to " + hitTarget.collider.gameObject.name); BattleDamage battleDamage = hitTarget.collider.gameObject.GetComponent <BattleDamage>(); if (battleDamage) { //damage the target battleDamage.TakeDamage(hitTarget, damagePoint); } } }
void AssignGameComponents() { animator = GetComponent <Animator>(); //establish the observer relationship controller = new MyStuff.Controller(this); animationContext = new MyStuff.AnimationContext(animator); movementContext = new MyStuff.MovementContext(this); lateralMovementVector = new Vector3(); rigidBody = GetComponent <Rigidbody>(); groundContact = true; fpsCamera = fpsCameraObj.GetComponent <Camera>(); health = GetComponent <Health>(); bodyDamage = GetComponent <BattleDamage>(); AssignWeapon(); deathSequence = GetComponent <Dead>(); m_enableIK = true; }