init
This commit is contained in:
commit
a8c6025cd3
158 changed files with 86052 additions and 0 deletions
34
Assets/Coin.cs
Normal file
34
Assets/Coin.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Coin : MonoBehaviour{
|
||||
|
||||
HealthBar health;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start(){
|
||||
health = GameObject.FindGameObjectWithTag("Health").GetComponent<HealthBar>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update(){
|
||||
|
||||
}
|
||||
private void OnTriggerEnter2D(Collider2D col){
|
||||
if(col.gameObject.tag == "Player"){
|
||||
Destroy(this.gameObject);
|
||||
health.SendMessage("TakeDamage", -1);
|
||||
}
|
||||
if(col.gameObject.tag == "Bullet"){
|
||||
Bullet bullet = col.GetComponent<Bullet>();
|
||||
bullet.speed = bullet.speed * 2;
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
if (col.gameObject.tag == "Enemy"){
|
||||
EnemyController enemy = col.GetComponent<EnemyController>();
|
||||
enemy.maxSpeed++;
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue