void Start() { KilledText = FindObjectOfType <KillCounter>(); permanentSpeed = speed; target = GameObject.FindGameObjectWithTag("Player").transform; rgbd = gameObject.GetComponent <Rigidbody2D>(); }
void Start() { _counter = GameObject.Find("Kill count").GetComponent <KillCounter>(); Cursor.visible = true; Cursor.lockState = CursorLockMode.None; lastPos = enemy.transform.position; }
IEnumerator Start() { //target = GameObject.Find("Player").transform; target = FindObjectOfType <PlayerController>().transform; rb = GetComponent <Rigidbody2D>(); playerHealth = FindObjectOfType <HealthBar>(); score = FindObjectOfType <Score>(); killcounter = FindObjectOfType <KillCounter>(); audioManager = AudioManager.instance; if (audioManager == null) { Debug.LogError("No AudioManager found in scene."); } //ChangeState(EnemyAIState.Idle); //ChooseState(); ChangeState(EnemyAIState.Wander); while (true) { switch (enemyState) { case EnemyAIState.Idle: //run idle function Idle(); break; case EnemyAIState.Wander: if (isGrounded) { Wander(); } break; case EnemyAIState.Aggro: //run aggro function Aggro(); break; case EnemyAIState.Combat: //run combat function Combat(); break; case EnemyAIState.Dead: //enemy dead break; case EnemyAIState.Knockback: Knockback(); break; } yield return(new WaitForEndOfFrame()); } }
public void GameWon() { timer = FindObjectOfType <Timer>(); finalTime = timer.ReadTimer(); killCounter = FindObjectOfType <KillCounter>(); finalKills = killCounter.ReadKills(); gameWon = true; }
// Start is called before the first frame update void Start() { _killCounter = GameObject.FindWithTag("KillCounter").GetComponent <KillCounter>(); _stageComplete = GetComponent <TextMeshProUGUI>(); _stageComplete.enabled = false; _audioManager = GameObject.FindWithTag("AudioManager").GetComponent <AudioManagerScript>(); _menu = GameObject.FindWithTag("IGMenu").GetComponent <MenuCanvasScript>(); }
void Start() { KilledText = FindObjectOfType <KillCounter>(); temp = speed; target = GameObject.FindGameObjectWithTag("Player").transform; rgbd = gameObject.GetComponent <Rigidbody2D>(); StartCoroutine(DistanceAttack()); }
// Start is called before the first frame update void Start() { _bossAnimator = GetComponent <Animator>(); _target = GameObject.FindWithTag("Player").transform; _agent = GetComponent <NavMeshAgent>(); _health = GetComponent <Health>(); _killCounter = GameObject.FindWithTag("KillCounter").GetComponent <KillCounter>(); _audioManager = GameObject.FindWithTag("AudioManager").GetComponent <AudioManagerScript>(); }
void Start() { _health = GetComponent <Health>(); _killCounter = GameObject.FindWithTag("KillCounter")?.GetComponent <KillCounter>(); if (_killCounter != null) { _killCounter.killGoal = killsToComplete; _killCounter.UpdateText(); } }
// Start is called before the first frame update void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } }
public Player(int id, int x, int y, string name, int hitpoints, int attack, int defence, int level, int experience, int gold) : base(name, hitpoints, attack, defence) { this.level = level; this.experience = experience; this.gold = gold; this.items = new List <Item>(); itemCount = 0; this.x = x; this.y = y; kc = new KillCounter(); }
// Start is called before the first frame update void Start() { _player = GameObject.FindWithTag("Player").transform; _navMeshAgent = GetComponent <NavMeshAgent>(); _ability = gameObject.GetComponentInChildren <EnemyAbility>(); isPaused = false; _killCounter = GameObject.FindWithTag("KillCounter").GetComponent <KillCounter>(); _loot = GetComponent <DropLoot>(); _animator = GetComponent <Animator>(); _audioManager = GameObject.FindWithTag("AudioManager").GetComponent <AudioManagerScript>(); }
void Start() { if(NotifyKillCounter) killCounter = GameObject.FindWithTag(KillCounterTag).GetComponent<KillCounter>(); healthBar = this.GetComponent<HealthBar>(); if (healthBar == null) { Debug.LogWarning("It is advised to have a HealthBar script attached to the same GameObject!"); } }
public void Die() { if (gameObject.name == "Bat Enemy") { batDead = true; despawnTime += Time.time + despawnOffset; Debug.Log("DEAD"); animator.SetBool("isDead", true); GetComponent <CircleCollider2D>().enabled = false; GetComponent <AIDestinationSetter>().enabled = false; KillCounter k = FindObjectOfType <KillCounter>(); k.setSceneKills(k.getSceneKills() + 1); } else if (gameObject.name == "King") { kingDead = true; sceneEndTime += Time.time + sceneEndDelay; animator.SetBool("isDead", true); GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeAll; GetComponent <Collider2D>().enabled = false; GetComponent <KingEnemyMain>().enabled = false; GetComponentInChildren <CircleCollider2D>().enabled = false; } else if (gameObject.name == "Pikeman") { pikemanDead = true; pikemanDespawntime += Time.time + pikemanDespawnOffset; Debug.Log("DEAD"); animator.SetBool("isDead", true); GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeAll; GetComponent <Collider2D>().enabled = false; KillCounter k = FindObjectOfType <KillCounter>(); k.setSceneKills(k.getSceneKills() + 1); GetComponent <PikemanEnemyMain>().enabled = false; } else if (gameObject.name == "Lizard") { lizardDead = true; lizardDespawntime += Time.time + lizardDespawnOffset; Debug.Log("DEAD"); animator.SetBool("isDead", true); GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeAll; GetComponent <Collider2D>().enabled = false; KillCounter k = FindObjectOfType <KillCounter>(); k.setSceneKills(k.getSceneKills() + 1); GetComponent <LizardEnemyMain>().enabled = false; GetComponentInChildren <Hazard>().setEnabled(false); } }
public void TakeDamage(float damage) { //subtract health and check if goblin's still alive currentHealth -= damage; if (currentHealth <= 0) { //if there's a killScript on the goblin, send a kill to the game manager KillCounter killScript = GetComponent <KillCounter>(); if (killScript != null) { killScript.Killed(); } Explode(true); } }
private void Start() { _gc = GetComponent <GroundCheck>(); _kc = FindObjectOfType <KillCounter>(); _grounded = true; _inCombat = false; _freezeMovement = false; _attackTimer = 0f; _baseScale = _parent.localScale.x; _attackCooldown = Random.Range(_attackCooldownMM.x, _attackCooldownMM.y); _layerMask = ~(LayerMask.GetMask("Enemies")); Vector3 startPos = _obstacleCheckOffset; startPos.x *= Mathf.Sign(_parent.localScale.x); _playerCheck = Physics2D.Raycast(transform.position + startPos, Vector2.left * Mathf.Sign(_parent.localScale.x), _combatRange); _patrolling = StartCoroutine(Patrol()); }
public void Start() { counter = FindObjectOfType <Player>().Killcounter; }
private void Start() { _KillCounter = GameObject.FindWithTag("KillCounter").GetComponent <KillCounter>(); }
private void OnDestroy() { KillCounter.kill(); }
public QuestSystem() { killCounter = new KillCounter(); collectCounter = new CollectCounter(); questList = new List<Quest>(); }
void Start() { Instance = this; }
public void Awake() { Killcounter = new KillCounter(); }