void OnTriggerStay2D(Collider2D other) { if (other.tag == "enemy" || other.tag == "Boss") { var phase = GodTouch.GetPhase(); //タッチ判定 if (phase == GodPhase.Began) { startTime = Time.time; } else if (phase == GodPhase.Ended) { if (Time.time - startTime < CheckTime) { //相手のDamage関数を実行する if (other.tag == "enemy") { EnemyDamageScript Edam = other.GetComponent <EnemyDamageScript> (); Edam.Damage(); DamageSeScript DamSEScript = this.GetComponent <DamageSeScript>(); DamSEScript.EmemyDamageSound(); } else if (other.tag == "Boss") { BossDamageScript Bdam = other.GetComponent <BossDamageScript> (); Bdam.Damage(); DamageSeScript DamSEScript = this.GetComponent <DamageSeScript>(); DamSEScript.BossDamageSound(); } //相手がいたところにエフェクト Instantiate(AttackEffect, other.transform.position, Quaternion.identity); } } } }
// Update is called once per frame void Update() { BossDamageScript Bdam = Boss.GetComponent <BossDamageScript> (); BossHPBar.fillAmount = Bdam.HPsend() / BossFullHP; }