void Start() { playerController = transform.parent.gameObject.GetComponent <scr_PlayerController>(); attackCooldown = 0.5f; attackCooldownTimer = 0f; }
void Start() { playerController = GameObject.Find("obj_Player").GetComponent <scr_PlayerController>(); rigidbody2d = GetComponent <Rigidbody2D>(); attackCooldownTimer = Random.Range(attackCooldown - 0.25f, attackCooldown + 0.25f); currentHP = maxHP; sentryPosition = transform.position; playerClose = false; }
void OnCollisionEnter2D(Collision2D other) { scr_PlayerController player = other.gameObject.GetComponent <scr_PlayerController>(); if (player != null) { player.ChangeHealth(-25); Die(); } }
void NoBullets() { scr_PlayerController p = GameObject.FindGameObjectWithTag("Player").GetComponent <scr_PlayerController>(); if ((p != null) && (p.canShoot == 0)) { p.CanShoott(1); } Destroy(gameObject); }
//public AudioClip collectedClip; void OnTriggerEnter2D(Collider2D other) { scr_PlayerController controller = other.GetComponent <scr_PlayerController>(); if (controller != null) { if (controller.health < controller.maxHealth) { controller.ChangeHealth(50); Destroy(gameObject); //controller.PlaySound(collectedClip); } } }
void Start() { playerController = transform.parent.GetComponent <scr_PlayerController>(); }