public Coin(LevelObjectView playerView, List <LevelObjectView> coinsView, SpriteAnimator coinSpriteAnimator, UIController UIcontroller) { _playerView = playerView; _coinSpriteAnimator = coinSpriteAnimator; _coinsView = coinsView; _UIcontroller = UIcontroller; playerView.OnLevelObjectContact += OnLevelObjectContact; }
private void Awake() { _playerAnimatorConfig = Resources.Load <SpriteAnimatorConfig>("PlayerAnimatorConfig"); _gumboAnimatorConfig = Resources.Load <SpriteAnimatorConfig>("GumboAnimatorConfig"); _boxAnimatorConfig = Resources.Load <SpriteAnimatorConfig>("BoxAnimatorConfig"); _coinAnimatorConfig = Resources.Load <SpriteAnimatorConfig>("CoinAnimatorConfig"); _UIAnimatorConfig = Resources.Load <UIAnimatorConfig>("UISpriteAnimatorConfig"); _playerAnimator = new SpriteAnimator(_playerAnimatorConfig); _gumboAnimator = new SpriteAnimator(_gumboAnimatorConfig); _boxAnimator = new SpriteAnimator(_boxAnimatorConfig); _coinAnimator = new SpriteAnimator(_coinAnimatorConfig); _UIAnimator = new SpriteAnimator(_UIAnimatorConfig); _playerContactsPuller = new ContactsPuller(_playerView.Collider2D); _playerController = new PlayerController(_playerView, _playerAnimator, _playerContactsPuller); _gunController = new Gun(_gunView, _bulletView, _playerView); _flagController = new Flag(_playerView, _flagView); _UIController = new UIController(_UIView, _UIAnimator, _UIAnimatorConfig); _levelGeneratorController = new LevelGeneratorController(_levelGeneratorView); /// _levelGeneratorController.Awake(); /// foreach (Transform gumbo in _gumbos.GetComponentInChildren <Transform>()) { _gumboAnimator.StartAnimation(gumbo.gameObject.GetComponent <SpriteRenderer>(), AnimTrack.Run, true, 5); } foreach (Transform box in _boxes.GetComponentInChildren <Transform>()) { _boxAnimator.StartAnimation(box.gameObject.GetComponent <SpriteRenderer>(), AnimTrack.Idle, true); } _coinsView = new List <LevelObjectView>(_coins.transform.childCount); foreach (Transform coin in _coins.GetComponentInChildren <Transform>()) { _coinsView.Add(coin.gameObject.GetComponent <LevelObjectView>()); _coinAnimator.StartAnimation(coin.gameObject.GetComponent <SpriteRenderer>(), AnimTrack.Idle, true, 5); } _coinController = new Coin(_playerView, _coinsView, _coinAnimator, _UIController); }
public UIController(UIView UIview, SpriteAnimator UIAnimator, UIAnimatorConfig UIConfig) { // 100 - 200 - 400 - 500 - 800 - 1000 - 2000 - 4000 - 5000 - 8000 - 1UP - 1UP - 1UP _scoreTable = new int[11] { 0, //0 100, //1 200, //2 400, //3 500, //4 800, //5 1000, //6 2000, //7 4000, //8 5000, //9 8000 //10 }; _UIView = UIview; _UIAnimator = UIAnimator; _UISpriteConfig = UIConfig; _figures = _UIView.transform.Find("Score Display").GetComponent <Image>(); _hundreds = _UIView.transform.Find("KiloScore Display").GetComponent <Image>(); spriteListFromConfig = _UISpriteConfig.Sequences[0].Sprites; // spriteListFromConfig[0] // 00 // spriteListFromConfig[1], // 0 // spriteListFromConfig[2], // 10 // spriteListFromConfig[3], // 20 // spriteListFromConfig[4], // 40 // spriteListFromConfig[5], // 50 // spriteListFromConfig[6], // 80 SetStartingScore(); }
public PlayerController(LevelObjectView view, SpriteAnimator spriteAnimator, ContactsPuller contactsPuller) { _view = view; _spriteAnimator = spriteAnimator; _contactsPuller = contactsPuller; }