private void LoadPrimaryFire() { primaryFirePool.Init(); for (int i = 0; i < primaryFirePoolSize; i++) { Transform spawnPoint; if (i % 2 == 0) { spawnPoint = firePointL; } else { spawnPoint = firePointR; } GameObject clone = Instantiate(bullet, spawnPoint.position, spawnPoint.rotation); BasicShot pf = clone.GetComponent <BasicShot>(); pf.SetId(id); SpriteRenderer pfsr = clone.GetComponent <SpriteRenderer>(); pfsr.sprite = primaryFireSprite; pf.pooler = primaryFirePool; primaryFirePool.SetPoolable(clone); } }
public void Shoot() { animator.Play("MCBasicShotAnim"); shotInstance = Instantiate(basicShotPrefab, transform.position, Quaternion.identity).GetComponent <BasicShot>(); shotInstance.IsPlayer1 = isPlayer1; shotInstance.Damage = damage; }
/// <summary> /// Grabs Scripts and components. /// </summary> private void Awake() { fireTrigger = GetComponent <FireTrigger>(); spiralShot = GetComponent <SpiralShot>(); basicShot = GetComponent <BasicShot>(); basicButt.onClick.AddListener(ToBasic); spinnyButt.onClick.AddListener(ToSpinny); }
void Shoot() { GameObject shooting = (GameObject)Instantiate(basicShot, projectileSpawn.position, projectileSpawn.rotation); BasicShot shot = shooting.GetComponent <BasicShot>(); if (shot != null) { shot.Attack(target); } }
public override void Activate() { if (canActivate) { BasicShot shot = Instantiate(shotPrefab).GetComponent <BasicShot>(); shot.Shoot(); GetComponent <Player>().shine -= shotCost; StartCoroutine(Cooldown()); } }
void OnCollisionEnter2D(Collision2D other) { BasicShot bs = other.gameObject.GetComponent <BasicShot>(); if (bs == null) { return; } bs.Kill(); }
void Shoot() { Debug.Log("Try"); GameObject shooting = (GameObject)Instantiate(RbasicShot, RProjectileSpawn.position, RProjectileSpawn.rotation); BasicShot shot = shooting.GetComponent <BasicShot>(); if (shot != null) { Debug.Log("shoot"); shot.Attack(target); } }
void OnTriggerEnter2D(Collider2D other) { BasicShot bs = other.gameObject.GetComponent <BasicShot>(); if (bs == null) { return; } bs.Kill(); Damage(); }
public void Shoot(Vector2 dir) { //if tick is zero then the player can shoot if (tick == 0) { lastShot = Instantiate(shot, transform.position, Quaternion.identity); BasicShot shotScript = lastShot.GetComponent <BasicShot> (); shotScript.SetDir(dir); Destroy(lastShot, shotScript.GetLifetime()); } //if the player isnt firing then call StartFire() if (!firing) { StartFire(); } }
void Shoot() { GameObject shooting = (GameObject)Instantiate(BbasicShot, BProjectileSpawn.position, BProjectileSpawn.rotation); BasicShot shot = shooting.GetComponent <BasicShot>(); if (shot != null) { shot.Attack(target); if (particle) { GameObject p = Instantiate(particle, BProjectileSpawn.position, BProjectileSpawn.rotation); Destroy(p, 5); } // play correct sound switch (TowerType) { case 'B': FindObjectOfType <AudioManager>().Play("BasicTowerShoot"); break; case 'R': FindObjectOfType <AudioManager>().Play("RapidTowerShoot"); break; case 'S': FindObjectOfType <AudioManager>().Play("SniperTowerShoot"); break; case 'A': FindObjectOfType <AudioManager>().Play("AOETowerShoot"); break; default: FindObjectOfType <AudioManager>().Play("BasicTowerShoot"); break; } // End of sound switch } }
private void OnCollisionEnter2D(Collision2D other) { Debug.Log("doood im heet!!"); Debug.Log(other); BasicShot shot = other.gameObject.GetComponent <BasicShot>(); if (shot == null || shot.id == id) { return; } if (model.CanTakeDamage && model.LifeLevel > 0f) { model.LifeLevel -= 25f; model.CanTakeDamage = false; if (model.LifeLevel <= 0) { model.IsAlive = false; } } }
void targetSelection() { // Searching for enemies and specifically dwarves enemies = GameObject.FindGameObjectsWithTag("Enemy"); // Destroy projectile if there are no enemies if(enemies.Length == 0) { Destroy(gameObject); } dwarves = GameObject.FindGameObjectsWithTag("Dwarf"); //If there are dwarves, use different attack if(dwarves.Length > 0) { dwarfPresent = true; dwarfShot(); basicShotScript = gameObject.GetComponent<BasicShot>(); basicShotScript.enabled = true; } //Execute basic attack else { dwarfPresent = false; BasicShot(); basicShotScript = gameObject.GetComponent<BasicShot>(); basicShotScript.enabled = true; } }
// Start is called before the first frame update void Start() { basicShot = GetComponent <BasicShot>(); gridShot = GetComponent <GridShot>(); }