void Spawn() { timer--; if (timer < 0) { int i = Random.Range(0, spawns.Count - 1); Vector3 spawnPos = spawns[i].transform.position; int x = Mathf.RoundToInt(spawnPos.x); int y = Mathf.RoundToInt(spawnPos.y); PlayerInfo npc = (MapDataController.map[x, y].GetNpc()); if (npc == null) { GameObject.Instantiate(enemy, spawns[i].transform.position, Quaternion.identity); timer = timerStart; sm.AddSpawnSum(); } } }