public void ProcessNextRoom()
        {
            _currentRoomIndex++;
            if (_currentRoom != null)
            {
                Destroy(_currentRoom);
                foreach (Transform child in AppModel.DropManager().GetDropped())
                {
                    Destroy(child.gameObject);
                }
            }
            var nextRoom = predefinedRooms[_currentRoomIndex];

            _currentRoom = Instantiate(nextRoom);
            _currentRoom.AddComponent <StraightRoomController>();
            AppModel.PlayerTransform().position = _currentRoom.transform.Find("StartPoint").position;
        }
        void Awake()
        {
            InitCamera();
            InitContainers();
            BalanceLoader.LoadBalance();
            if (_initplayer)
            {
                InitPlayer();
            }
            else
            {
                AppModel.SetPlayer(GameObject.Find("Player"));
            }
            var straightLevelController = GameObject.Find("StraightLevelController");

            if (straightLevelController != null)
            {
                DoStraightLevelLogic(straightLevelController.GetComponent <StraightLevelController>());
            }
        }
예제 #3
0
        private void OnTriggerEnter2D(Collider2D other)
        {
            // Hit self
            if (other.gameObject == Owner)
            {
                return;
            }
            // Hit ENV
            if (_envTags.Contains(other.tag))
            {
                var hit = Physics2D.Raycast(transform.position, transform.forward);
                var fx  = Instantiate(_envHitFx, transform.position,
                                      Quaternion.LookRotation(Vector3.forward, Direction * new Vector2(-1, -1)));
                fx.transform.SetParent(AppModel.FxContainer().transform);
                if (other.CompareTag("Environment"))
                {
                    DamageManager.Hit(other.GetComponent <Level.Environment>(), Weapon);
                }
                Destroy(gameObject);
            }
            if (!IsPlayerBullet && other.CompareTag("Player"))
            {
                HitPlayer(other);
                Destroy(gameObject);
            }

            if (IsPlayerBullet && other.CompareTag("Enemy"))
            {
                if (_enemyHitFx != null)
                {
                    Instantiate(_enemyHitFx, transform.position, transform.rotation);
                }
                HitEnemy(other);
                Destroy(gameObject);
            }
        }
        private void InitPlayer()
        {
            var playerGo = Instantiate(_player).gameObject;

            AppModel.SetPlayer(playerGo);
        }
예제 #5
0
 void Start()
 {
     _player = AppModel.PlayerTransform();
 }