Added Projectiles hit criteria . If rope Projectile hits a carnivores , or elephant or wildebeest induce player damage and If a bullet Projectile hits a sheep, induce damage

posted in: Weekly Progress | 0

Added Projectiles hit criteria
a. If rope Projectile hits a carnivores , or elephant or wildebeest induce player damage.
b. If a bullet Projectile hits a sheep, induce damage.

In animal script these variables are initialized.

 

public int ProjectileCollisionDamage;
public int AnimalKillDamage;
a.) If rope Projectile hits a carnivores , or elephant or wildebeest induce player damage.

In coyote script  Give damage to the player function is added.

public void GiveDamage(GameObject instigator)
{
var ropeLoop = instigator.GetComponent<RopeProjectile>();

if (ropeLoop)
{
_player.DecreaseHealth(ProjectileCollisionDamage);
}
}

 

In Elephant script Give damage to the player function is added.

public void GiveDamage(GameObject instigator)
{
var ropeLoop = instigator.GetComponent<RopeProjectile>();

if (ropeLoop)
{
_player.DecreaseHealth(ProjectileCollisionDamage);
}
}

 

In lion script Give damage to the player function is added.

public void GiveDamage(GameObject instigator)
{
var ropeLoop = instigator.GetComponent<RopeProjectile>();

if (ropeLoop)
{
_player.DecreaseHealth(ProjectileCollisionDamage);
}
}

 

b. If a bullet Projectile hits a sheep, induce damage.

if player fire the sheep Player will be damaged.

 

public void GiveDamage(GameObject instigator)
{
var rifleBullet = instigator.GetComponent<RifleProjectile>();
var shotgunBullet = instigator.GetComponent<ShotgunProjectile>();

if (rifleBullet || shotgunBullet)
{
_player.DecreaseHealth(AnimalKillDamage);
}
}

Leave a Reply