public void OnTriggerStay2D(Collider2D collision) { if (collision.tag == "Monster") { childrelCharMotor = collision.gameObject.GetComponent <CharactersMotor>(); OnColisionTrue = true; childrelMonsterScope = collision.gameObject.GetComponent <MonsterScope>(); } }
void Start() { thisSpriteRender = GetComponent <SpriteRenderer>(); thisRigidbody = GetComponent <Rigidbody2D>(); thisTransform = transform; thisAnimator = GetComponent <Animator>(); player = GameObject.FindGameObjectWithTag("Player"); playerTransform = player.transform; frontView = thisTransform.Find("FrontFieldView"); frontVisibility = float.Parse(frontView.localScale.x.ToString()); backView = thisTransform.Find("BackFieldView"); playerScript = FindObjectOfType <Player>(); monsterHp = GetComponent <CharacterHp>(); monsterScope = GetComponent <MonsterScope>(); monstersLoot = GetComponent <MonstersDropLoot>(); }