void Start() { GameObject gp = Instantiate(Resources.Load <GameObject>("GunPoint")); gp.transform.parent = transform; gp.transform.localPosition = Vector2.zero; gunPoint = gp.GetComponent <GunPoint>(); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.name == "CollectItemHitBox") { buffedObject = collision.transform.parent.gameObject.GetComponentInChildren <GunPoint>(); switch (effect) { case BuffEffect.attack_speed: { if (buffedObject.fireDelay > 0.25f) { buffedObject.fireDelay *= 0.85f; } break; } case BuffEffect.bullet_up: { buffedObject.BulletUp(); break; } case BuffEffect.num_bullet: { if (buffedObject.comboBulletCount < 6) { buffedObject.countBulletPerShot++; } break; } case BuffEffect.combo_up: { if (buffedObject.comboBulletCount < 4) { buffedObject.comboBulletCount++; } break; } case BuffEffect.gold_up: { GameObject.Find("TheGameManager").GetComponent <Game>().starCollected++; break; } case BuffEffect.diamond_up: { GameObject.Find("TheGameManager").GetComponent <Game>().diamondCollected++; break; } } Destroy(gameObject); } }
// Start is called before the first frame update void Start() { Particle = GunPoint.GetComponent <ParticleSystem>(); PD = Particle.gameObject.GetComponent <ParticleDamage>(); }