// Binding View Model private void OnBindView() { HandHeldCardsController handheldCardsController = Object.FindObjectOfType <HandHeldCardsController>(); PlayerGroupController playerGroupController = Object.FindObjectOfType <PlayerGroupController>(); EnemyGroupController enemyGroupController = Object.FindObjectOfType <EnemyGroupController>(); PowerUIController powerUIController = Object.FindObjectOfType <PowerUIController>(); EndTurnUIController endTurnController = Object.FindObjectOfType <EndTurnUIController>(); ComboButtonGroupController comboBtnGpController = Object.FindObjectOfType <ComboButtonGroupController>(); //binding player UI playerGroupController.Bind(_battleContext.Player); enemyGroupController.Bind(_battleContext.EnemyList); //binding Power UI powerUIController.Bind(_battleContext.Player.Power); //binding cards UI handheldCardsController.Bind(_battleContext.Player.HandheldSet); // Binding End Turn Button endTurnController.Bind(_battleContext.CurrentActor); // Binding Ultimate Cards comboBtnGpController.HideAll(); for (int cnt = 0; cnt < _battleContext.UltimateCards.Count; cnt++) { comboBtnGpController.BindUltimateCard(cnt, _battleContext.UltimateCards[cnt]); } }
//Singleton pattern private void Awake() { int gameStatusCount = FindObjectsOfType <GameSession>().Length; if (gameStatusCount > 1) { gameObject.SetActive(false); Destroy(gameObject); } else { DontDestroyOnLoad(gameObject); enemies = FindObjectOfType <EnemyGroupController>(); } }
// Start is called before the first frame update void Start() { curStage = TutorialState.START; enemies = FindObjectsOfType <EnemyController>(); barriers = FindObjectsOfType <DestructibleBarrier>(); enemyGroup = FindObjectOfType <EnemyGroupController>(); player = FindObjectOfType <PlayerControl>(); lives = FindObjectOfType <LivesController>(); session = FindObjectOfType <GameSession>(); session.SetGame(false); initialLives = lives.GetLives(); initialSpeed = player.moveSpeed; initialProjectileSpeed = player.projectileSpeed; totalEnemies = enemies.Length; totalBarriers = barriers.Length; DeactivateObjects(); DeactivateStages(); }