// Use this for initialization void Start() { bulletDelay = 0; outOfAmmoText.gameObject.SetActive(false); myPowerUp = new Stack <PowerUpGun>(); controller = GetComponent <TankController>(); score = GetComponent <TankScore>(); ammoFill = GameObject.Find(ImageName).GetComponent <Image>(); //Assign who this is switch (controller.playerNum) { case 1: playerNum = Statics.Player.one; break; case 2: playerNum = Statics.Player.two; break; case 3: playerNum = Statics.Player.three; break; case 4: playerNum = Statics.Player.four; break; } }
// Use this for initialization void Start() { shootSound = GetComponent <AudioSource>(); score = GetComponent <TankScore>(); bulletPool = Statics.gunPool; controller = GetComponent <TankController>(); reloadingTimer = 0; switch (controller.playerNum) { case 1: playerNum = Statics.Player.one; break; case 2: playerNum = Statics.Player.two; break; case 3: playerNum = Statics.Player.three; break; case 4: playerNum = Statics.Player.four; break; } }
public override void shoot(TankScore score, Statics.Player playerNum, Transform spawnTrans) { currentSpecialAmmo--; //Bullet Spawning var mine = PowerUpPool.GetObject(); mine.SetActive(true); mine.transform.position = spawnTrans.transform.position; mine.transform.up = spawnTrans.transform.up; var mineProperties = mine.GetComponent <TankMine>(); mineProperties.score = score; mineProperties.playerNum = playerNum; }
// Update is called once per frame void Update() { Collider2D[] guysOnHill = Physics2D.OverlapCircleAll(transform.position, 2); numOnHill = 0; foreach (var guy in guysOnHill) { var isItTank = guy.GetComponentInParent <TankScore>(); if (isItTank != null) { numOnHill++; guyInHill = isItTank; } } if (numOnHill == 1) { guyInHill.updateScore(); } }
public override void shoot(TankScore score, Statics.Player playerNum, Transform spawnTrans) { currentSpecialAmmo--; var grenade = PowerUpPool.GetObject(); grenade.SetActive(true); grenade.transform.position = spawnTrans.transform.position; grenade.transform.up = spawnTrans.transform.up; Vector2 vel = grenade.transform.up * grenadeSpeed; grenade.GetComponent <Rigidbody2D>().velocity = vel; TankGrenade grenadeProperties = grenade.GetComponent <TankGrenade>(); grenadeProperties.startPos = spawnTrans.position; grenadeProperties.playerNum = playerNum; grenadeProperties.score = score; }
public override void shoot(TankScore score, Statics.Player playerNum, Transform spawnTrans) { currentSpecialAmmo--; //Bullet Spawning var bullet = PowerUpPool.GetObject(); bullet.SetActive(true); bullet.transform.position = spawnTrans.transform.position; bullet.transform.up = spawnTrans.transform.up; Vector2 vel = bullet.transform.up * bulletSpeed; bullet.GetComponent <Rigidbody2D>().velocity = vel; //Score and Owner TankBullet bulletProperties = bullet.GetComponent <TankBullet>(); bulletProperties.frontalDamage = frontDamage; bulletProperties.normalDamage = normalDamage; bulletProperties.playerNum = playerNum; bulletProperties.score = score; }
public virtual void shoot(TankScore score, Statics.Player playerNum, Transform spawnTrans) { }