void Awake() { enemySight = GetComponent<EnemySight>(); nav = GetComponent<NavMeshAgent>(); lastPlayerSighting = GameObject.FindGameObjectWithTag("GameController").GetComponent<LastPlayerSighting>(); player = GameObject.FindGameObjectWithTag("Player").transform; playerHealth = player.GetComponent<PlayerHealth>(); playerMovement = player.GetComponent<Char_Movement>(); anim = animObj.GetComponent<Animator>(); audio = GetComponent<AudioSource>(); enemAttack = transform.Find("SmackZone").gameObject.GetComponent<EnemyAttack>(); }
void Awake() { enemySight = GetComponent <EnemySight>(); nav = GetComponent <NavMeshAgent>(); lastPlayerSighting = GameObject.FindGameObjectWithTag("GameController").GetComponent <LastPlayerSighting>(); player = GameObject.FindGameObjectWithTag("Player").transform; playerHealth = player.GetComponent <PlayerHealth>(); playerMovement = player.GetComponent <Char_Movement>(); anim = animObj.GetComponent <Animator>(); audio = GetComponent <AudioSource>(); enemAttack = transform.Find("SmackZone").gameObject.GetComponent <EnemyAttack>(); }
private void Start() { audio = gameObject.GetComponent <AudioSource>(); character = GameObject.Find("Character").GetComponent <Char_Movement>(); if (GameObject.Find("BlueDoor")) { blueDoor = GameObject.Find("BlueDoor").GetComponent <BlueDoor_Script>(); //"BlueDoor objesini bul, scriptini al." demektir. blueDoor.spriteRenderer.color = blueDoor_Alpha; //sprite renklerine ekledik. alphayı -> blueDoor.spriteRenderer.color.a şeklinde ayarlayamadığımızdan başka bir renge ayarladık. } }
private void Start() { audio = gameObject.GetComponent <AudioSource>(); if (GameObject.Find("RedDoor_Spawn")) //her bölümde açılan bir kapı olmayabilir! { redDoor_Spawn = GameObject.Find("RedDoor_Spawn").GetComponent <RedDoorSpawn>(); redDoor_Spawn.spriteRenderer.color = redDoorSpawn_Alpha; } character = GameObject.Find("Character").GetComponent <Char_Movement>(); if (GameObject.Find("RedDoor")) { redDoor = GameObject.Find("RedDoor").GetComponent <RedDoor_Script>(); //BAŞKA BİR SCRİPT KULLANIRKEN BUNU YAZ YOKSA BAZEN ALGILAMIYOR (NULL REFERANCE ) redDoor.spriteRenderer.color = redDoor_Alpha; } //spriteHandler = GameObject.Find("Character").GetComponent<SpriteHandler>(); }
void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent<Char_Movement>(); }
void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <Char_Movement>(); }