// Start is called before the first frame update void Start() { Score = FindObjectOfType <TextManager>(); gameOver = FindObjectOfType <GameOver>(); isDead = FindObjectOfType <MoveToPlayer>(); anim = GetComponent <Animator>(); deathSound = GetComponent <AudioSource>(); a = FindObjectOfType <MoveToPlayer>(); }
// Use this for initialization void Start() { moveToPlayer = gameObject.GetComponent <MoveToPlayer>(); anim = gameObject.GetComponent <Animator>(); IsShooten = false; anim.SetBool("isDead", false); anim.SetBool("isWalk", true); audioSource = gameObject.GetComponent <AudioSource>(); player = GameObject.FindGameObjectWithTag("Player"); gameController = GameObject.FindGameObjectWithTag("GameController"); }
void Start() { if (move != null) { move = gameObject.GetComponent <MoveToPlayer>(); } else if (randMove != null) { randMove = gameObject.GetComponent <RandomWalking>(); } }
void OnTriggerEnter(Collider other) { // Overlap was a pickup if (other.gameObject.CompareTag("Pickup")) { // Logic MoveToPlayer movementScript = other.gameObject.GetComponent <MoveToPlayer>(); if (movementScript != null) { movementScript.BeginMovement(); } } }
void Start() { _audio = gameObject.GetComponent <AudioSource> (); _enemyData = gameObject.GetComponent <EnemyData> (); if (gameObject.GetComponent <RandomWalking> () != null) { _enemyMovement = gameObject.GetComponent <RandomWalking> (); } else { _moveToPlayer = gameObject.GetComponent <MoveToPlayer>(); } }
// Use this for initialization void Start() { fishAgent = GetComponent <NavMeshAgent>(); GameObject.FindGameObjectsWithTag("fish"); fishAgent.updatePosition = true; fishAgent.updateRotation = true; wayPoints = GameObject.FindGameObjectsWithTag("waypoint"); wayPointInd = Random.Range(0, wayPoints.Length); AIState = KoiFishAI.fishState.MOVE; playerCapsule = GetComponent <MoveToPlayer>(); RB = GetComponent <Rigidbody>(); StartCoroutine("FSM"); moveSpeed = Random.Range(0.8f, 1.2f); }
public void Destroy() { if (player) { StartCoroutine("restartGame"); } else { //TODO: this should all really be in its own subclass of destroyable for enemies MoveToPlayer mtp = GetComponent <MoveToPlayer>(); if (mtp) { DestroyObject(mtp.agent.gameObject); if (remains) { Instantiate(remains, this.transform.position, this.transform.rotation); } } DestroyObject(this.gameObject); } }
// Update is called once per frame void Update() { isDead = this.gameObject.GetComponent <MoveToPlayer>(); }
void Start() { move = gameObject.GetComponent <MoveToPlayer> (); PosMalinche(QuestData.levelSpot); }