private void OnCollisionStay2D(Collision2D collision) { if (collision.gameObject.CompareTag("enemy")) { EnemyFightSetScript enemy_set_script = collision.gameObject.transform.GetChild(0).gameObject.GetComponent <EnemyFightSetScript>(); for (int i = 0; i < enemy_set_script.EnemyName.Length; i++) { gameManager.Name.Add(enemy_set_script.EnemyName[i]); gameManager.Attack.Add(enemy_set_script.Attack[i]); gameManager.Defense.Add(enemy_set_script.Defense[i]); gameManager.Image.Add(enemy_set_script.Image[i]); gameManager.HP.Add(enemy_set_script.HP[i]); gameManager.AttackSpeed.Add(enemy_set_script.AttackSpeed[i]); gameManager.InitTurn.Add(enemy_set_script.InitTurnCount[i]); } gameManager.EnemyFightName = collision.gameObject.name; MoveToPlaceName = collision.gameObject.tag; Destroy(collision.gameObject); SceneManager.LoadScene("FightScene"); } if (collision.gameObject.CompareTag("item")) { target = collision.gameObject; } col = true; }
private void Awake() { enemy_script = this; }