protected override void FireBulletAtEnemy(GameObject trackedObject) { //Gets a copy of the bullet from the object pooler GameObject bulletInstance = ObjectPooler.SharedInstance.GetPooledObject(bulletFired.tag); //Then, the bullet is repositioned to the firing indicator's position bulletInstance.transform.position = bulletHolder.transform.position; //Finally, the bullet's attributes are set up and the bullet is enabled and ready to go bulletInstance.GetComponent <BulletDispatcher>().SetupProjectile(damage, trackedObject, splashDamage: splashDamage, debuffDuration: debuffDuration, splashRange: splashRange, movementSpeedMultiplier: movementSpeedMultiplier); bulletInstance.SetActive(true); //Gets a copy of the bullet from the object pooler GameObject effectInstance = ObjectPooler.SharedInstance.GetPooledObject(nova.tag); //Then, the bullet is repositioned to the firing indicator's position effectInstance.transform.position = transform.position; //Setup the hitbox script of the splash effect HitboxScript splash = effectInstance.GetComponent <HitboxScript>(); Buff splashBuff = new Buff(name: "Slow", duration: debuffDuration, speedMultiplier: movementSpeedMultiplier); splash.SetupHitboxScript(splashDamage, splashRange, new List <Buff>() { splashBuff }); effectInstance.SetActive(true); }
// Use this for initialization void Start() { anim = GetComponent <Animator> (); hbs = GetComponentInChildren <HitboxScript> (); cc = GetComponent <CharacterController> (); state = "patrol"; }
void Start() { //if this an archer or enemy, don't use the spread option if (GetComponent <Archer>() || this.tag == "Enemy") { spread = false; //spread the alley } Academy = GameObject.FindObjectOfType <GameSystem>(); //print(Academy); //get the audio source source = GetComponent <AudioSource>(); maxAlliesPerEnemy = 1; //find navmesh agent component agent = this.GetComponent <NavMeshAgent>(); animator = this.GetComponent <Animator>(); /* * //find objects attached to this character * health = transform.Find("Health").gameObject; * healthbar = health.transform.Find("Healthbar").gameObject; * health.SetActive(false); */ lastLives = lives; //set healtbar value //healthbar.GetComponent<Slider>().maxValue = lives; startLives = lives; Academy.AllInitLives += lives; //get default stopping distance defaultStoppingDistance = agent.stoppingDistance; //if there's a dust effect, find and assign it if (transform.Find("dust")) { dustEffect = transform.Find("dust").gameObject.GetComponent <ParticleSystem>(); } //find the area so the character can walk around area = GameObject.FindObjectOfType <WalkArea>(); inspector = new UnitInspect(Academy); inspector.cam = FindObjectOfType <CamController>(); rnd = new System.Random(); HitboxComponent = Hitbox.GetComponent <HitboxScript>(); isPassedInit = true; if (!Academy.showanim) { animator.enabled = false; } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Hitbox") { HitboxScript hitboxScript = FindObjectOfType <HitboxScript>(); int damage = hitboxScript.returnDamage(); health -= damage; FloatingTextController.CreateFloatingText(damage.ToString(), transform); Debug.Log("Dummy is at " + health + " health"); } }
protected override void InstantiateHitEffect(GameObject effect, Vector3 position, Quaternion rotation) { if (effect != null) { //Gets a copy of the hit effect from the object pool GameObject effectInstance = ObjectPooler.SharedInstance.GetPooledObject(effect.tag); //Setup the hitbox script of the splash effect HitboxScript splash = effectInstance.GetComponent <HitboxScript>(); Buff splashBuff = new Buff(name: debuffName, duration: debuffDuration, speedMultiplier: movementSpeedMultiplier); splash.SetupHitboxScript(splashDamage, splashRange, new List <Buff>() { splashBuff }); //Moves the hit effect to a given position and rotation effectInstance.transform.position = position; effectInstance.transform.rotation = rotation; effectInstance.SetActive(true); //The particle effect will be killed in another script called KillParticles } }
void BasicStrike() { HitboxScript hitboxScript = FindObjectOfType <HitboxScript>(); Debug.Log("Attacking with a " + comboLevel + " Combo!"); if (comboLevel > 1) { hitboxScript.setDamage(30); } else { hitboxScript.setDamage(25); } anim.SetTrigger("BasicAttack"); //attack animation hitboxScript.Attack(false); //generates the hitbox attackInitiated = false; }
void ChargedStrike() { HitboxScript hitboxScript = FindObjectOfType <HitboxScript>(); if (chargeLevel == 1) { hitboxScript.setDamage(30); } else if (chargeLevel == 2) { hitboxScript.setDamage(50); } else if (chargeLevel == 3) { hitboxScript.setDamage(100); } anim.SetTrigger("SpinAttack"); //attack animation hitboxScript.Attack(true); //generates the hitbox attackInitiated = false; }
public override void innerInitializeAgent() { HitboxComponent = Hitbox[0].GetComponent <HitboxScript>(); }
public override void innerInitializeAgent() { HitboxComponent = Hitbox[0].GetComponent <HitboxScript>(); HealingParticle.Stop(); }