3 years ago

Hi everyone! I have one little problem.


I have 2 scripts: one for bullet and one for enemy. In EnemyController, there are function:

public void TakeDamage(int damage)

{

_health -= damage;

}

and I call it in script for bullet

if (hitInfo.collider.CompareTag("Enemy"))

{

hitInfo.collider.GetComponent<EnemyController>().TakeDamage(damage);

}

Unity says me, that it is error CS0103: The name 'damage' does not exist in the current context.

Why?



2 comments

Loading...

Next up

Вот, представляю вам: Тюленьи Когти!

Дополнение на тюленьи когти, добавляющее альтернативную атаку: Мелкий выстрел, замедляющий противника на пару секунд

Ура! Канал ожил! https://t.me/GRRRRRROB Господа и дамы, прошу!

This small game is a destructive playground involving an armed Octopus with pistols in each tentacle. Get ready for some destruction in the city.

https://gamejolt.com/games/glocktopus-attack/1027284

Елки-палки! Надеюсь, я когда-нибудь это доделаю!

Many players say Cult of Blood feels close to Sifu and Hellblade, do you agree?

#indiegame #gamedev #indie

Заменил еще скай бокс

Ну, тип один из скримеров для моей короткометражки для задания по режиссуре. Ну да

What kind of university is this? Recently finished the Chess Room! I'm happy how this one turned out! We are trying to add some uniqueness to each room to try make them feel more special. #gamedev #horrorgame #videogame #indiegame #retro #ps1 #psx

Ну, с Хэллоуином)