protected void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Player" && !monsterController.player.isInvincible) { EnemyDataManager.EnemyManager.theScene = monsterController.scene; EnemyDataManager.EnemyManager.combatIcon = monsterController.combatSprite; EnemyDataManager.EnemyManager.combatSprite = monsterController.combatSprite; EnemyDataManager.EnemyManager.currentName = monsterController.monsterName; EnemyDataManager.EnemyManager.health = monsterController.health; EnemyDataManager.EnemyManager.experienceGives = monsterController.experienceToGive; EnemyDataManager.EnemyManager.speed = monsterController.combatSpeed; EnemyDataManager.EnemyManager.currentType = monsterController.monsterType; EnemyDataManager.EnemyManager.currentID = monsterController.monsterIdentifier; EnemyDataManager.EnemyManager.theMonster = this; monsterController.canMove = false; EnemyDataManager.EnemyManager.amountOfEnemies = 1; monsterController.player.State = States.CannotMove; if (hasSecondMonster) { SecondaryMonster secondMonster = GetComponent <SecondaryMonster>(); assignMonsterValues(secondMonster, EnemyDataManagerTwo.EnemyManagerTwo); } if (hasThirdMonster) { ThirdMonster thirdMonster = GetComponent <ThirdMonster>(); assignMonsterValues(thirdMonster, EnemyDataManagerThree.EnemyManagerThree); } Transitions.screenTransition.StartCoroutine(Transitions.screenTransition.FadeOut("CombatScene", .33f)); } }
private void assignMonsterValues(SecondaryMonster monster, EnemyDataManager enemyManager) { enemyManager.combatIcon = monster.iconSprite; enemyManager.combatSprite = monster.combatSprite; enemyManager.currentName = monster.monsterName; enemyManager.health = monster.health; enemyManager.experienceGives = monster.experienceToGive; enemyManager.speed = monster.speed; enemyManager.currentID = monster.monsterIdentifier; EnemyDataManager.EnemyManager.amountOfEnemies = 2; enemyManager.theMonster = this; }