void Start() { Enemystat = gameObject.GetComponent <EnemyScripts>(); csc = gameObject.GetComponent <Cardsc>(); batsys = gameObject.GetComponent <BattleSystem>(); sm = gameObject.GetComponent <Sommon>(); ma = gameObject.GetComponent <MobAnime>(); Lookimg = LookCard.GetComponent <Image>(); Power = Powergo.GetComponent <Text>(); HP = HPgo.GetComponent <Text>(); SommonMonster[0].SetActive(false); SommonMonster[1].SetActive(false); SommonMonster[2].SetActive(false); StatusNBuff[0].SetActive(false); StatusNBuff[1].SetActive(false); StatusNBuff[2].SetActive(false); Sommoned[0] = false; Sommoned[1] = false; Sommoned[2] = false; ons = false; isOn = false; mobAttackturn = 0; Updating(); StartSommonEnemy(); }
private void OnCollisionEnter2D(Collision2D collision) { bool isDamagePlayer = false; EnemyScripts enemy = collision.gameObject.GetComponent <EnemyScripts>(); if (enemy != null) { HealthShotScripts enemyHealth = enemy.GetComponent <HealthShotScripts>(); if (enemyHealth != null) { enemyHealth.Damage(enemyHealth.hp); } isDamagePlayer = true; } if (isDamagePlayer) { HealthShotScripts playerHealth = this.GetComponent <HealthShotScripts>(); if (playerHealth != null) { playerHealth.Damage(1); } } }