private void OnNewLevel(LevelBehaviour newLevel) {
     BestResult.text = MainController.Instance.ProfileController.BestResult.ToString();
     CurrentResult.text = 0.ToString();
     ResultsPanel.gameObject.SetActive(true);
     StartPanel.gameObject.SetActive(false);
     NewResultPanel.SetActive(false);
     newLevel.OnPointsChanged += OnPointsChanged;
 }
 void Start()
 {
     Levelbehaviour = GameObject.Find("Main Camera").GetComponent <LevelBehaviour> ();
     for (int i = 0; i < Levelbehaviour.getAmmo; i++)
     {
         _fullAmmo.Add(_ammo);
     }
 }
    public Vector3 GetNextLevelPosition(LevelBehaviour nextLevelBehaviour)
    {
        float nextLevelXPosition = transform.Find("LevelEnd").transform.position.x +
                                   nextLevelBehaviour.transform.Find("LevelEnd").transform.localPosition.x;
        Vector3 currentLevelPosition = transform.position;

        return(new Vector3(nextLevelXPosition, currentLevelPosition.y, currentLevelPosition.z));
    }
示例#4
0
 /// <summary>
 /// Chooses level given, for playing in session.
 /// </summary>
 /// <param name="lvlBhvr">Lvl bhvr.</param>
 private void ChooseLevel(LevelBehaviour lvlBhvr)
 {
     AssignLevel(lvlBhvr);
     SoftwareModel.netwRout.TCPRequest(
         NetworkRoutines.EmptyCallback,
         new string[] { "req", "sessionId", "levelIndex" },
         new string[] { "changeLevel", UserStatics.SessionId.ToString(), currentLevelIndex.ToString() });
 }
示例#5
0
 private void Awake()
 {
     if (stackHoldRoot == null)
     {
         stackHoldRoot = transform;
     }
     levelBehaviour = LevelBehaviour.Instance();
     levelBehaviour.pauseBehaviour.SubscribeToPauseState((isPaused) => SetEnabled(isPaused));
 }
 public virtual void OnEnable()
 {
     if (currentLevel == null)
     {
         currentLevel = this;
     }
     BallSpawner.instance.BallSpawnEvent += Spawn;
     preciousActionCompleteTime           = DateTime.Now;
 }
 private void OnNewLevel(LevelBehaviour newLevel)
 {
     BestResult.text    = MainController.Instance.ProfileController.BestResult.ToString();
     CurrentResult.text = 0.ToString();
     ResultsPanel.gameObject.SetActive(true);
     StartPanel.gameObject.SetActive(false);
     NewResultPanel.SetActive(false);
     newLevel.OnPointsChanged += OnPointsChanged;
 }
示例#8
0
 private void Awake()
 {
     if (stackPositionRoot == null)
     {
         stackPositionRoot = transform;
     }
     levelBehaviour = LevelBehaviour.Instance();
     levelBehaviour.pauseBehaviour.SubscribeToPauseState(SetEnabled);
 }
示例#9
0
 public void StartLevel(LevelSettings _levelSettings)
 {
     Debug.Log("Level Controller Start: " + _levelSettings.LevelName);
     _activeLevelBehaviour =
         ObjectPool.GetObjectFromPool <LevelBehaviour>(_levelSettings.levelBehaviour, levelPrefabParent);
     _activeLevelBehaviour.Init(_levelSettings, objectSpritesDatabase, this);
     _activeLevelBehaviour.onCollectAll  += OnVictory;
     _activeLevelBehaviour.onObjectClick += onItemFound;
     InitLevel();
 }
示例#10
0
    private void SetupLevel(LevelBehaviour _levelBehaviour)
    {
        levelBehaviour = _levelBehaviour;
        Show();
        _levelBehaviour.onReload += Restart;
        Debug.Log("UI level Setup");

        InitNames();
        UpdateHintText(hintsController.HintsValue);
    }
示例#11
0
        private void PrepareLevel()
        {
            CurrentLevel = Instantiate(_levels[(PlayerData.Level - 1) % _levels.Count]);
            CurrentLevel.Initialize();

            CurrentLevel.Completed += OnLevelCompleted;

            ViewController.Instance.LoadingView.Close();
            ViewController.Instance.MainMenuView.Open(new MainMenuViewParameters(StartGame));
        }
 private void Awake()
 {
     if (stackPositionRoot == null)
     {
         stackPositionRoot = transform;
     }
     updateSpeed();
     initializeStackContent();
     levelBehaviour = LevelBehaviour.Instance();
     levelBehaviour.pauseBehaviour.SubscribeToPauseState(SetEnabled);
 }
示例#13
0
    // Start is called before the first frame update
    void Start()
    {
        spriteScale = 0.388f;


        levelBehaviour = FindObjectOfType <LevelBehaviour>();
        levelBehaviour.addBlock();

        currentHits = 0;

        pointsToAddToScore = 5 * hitpoints;
    }
示例#14
0
 public void CreateNewLevel() {
     if(Level != null) {
         GameObject.Destroy(Level.gameObject);
     }
     Level = GameObject.Instantiate(levelPrefab);
     Level.transform.SetParent(MainController.Instance.transform, false);
     Level.OnNewResult += OnNewResult;
     Level.Init();
     if(OnNewLevel != null) {
         OnNewLevel(Level);
     }
 }
示例#15
0
        private void changeLevelModel()
        {
            string         tempPath = currentLevelModel.bgPath;
            RufusModel     temp     = GameModel.levelsModels.ElementAt(GameModel.getNextLevelActive());
            LevelBehaviour temp2    = (LevelBehaviour)(temp.behaviour);

            currentLevelModel = temp2.levelModel;
            if (currentLevelModel.bgPath != tempPath)
            {
                changeLevelGraphics();
            }
        }
        public override void Start()
        {
            base.Start();

            GameObject levelObject = GameObject.Find("LocationRoot");

            levelBehaiour = levelObject.GetComponent <LevelBehaviour>();

            var jsonTextFile = Resources.Load <TextAsset>("data");

            gameSettings = JsonUtility.FromJson <Data>(jsonTextFile.text);

            levelBehaiour.CameraController.CameraSettings = gameSettings.cameraSettings;
        }
示例#17
0
 public void CreateNewLevel()
 {
     if (Level != null)
     {
         GameObject.Destroy(Level.gameObject);
     }
     Level = GameObject.Instantiate(levelPrefab);
     Level.transform.SetParent(MainController.Instance.transform, false);
     Level.OnNewResult += OnNewResult;
     Level.Init();
     if (OnNewLevel != null)
     {
         OnNewLevel(Level);
     }
 }
示例#18
0
 // Use this for initialization
 void Start()
 {
     //Spawn villagers on screen when game starts
     if (!level)
     {
         level = GameObject.Find("Level").GetComponent <LevelBehaviour> ();
     }
     for (int i = 0; i < respawnCount; i++)
     {
         //Spawn villagers at fitted positions (this can be tweaked later if there
         //Will be more than 5 villagers on screen
         Spawn(villagerPrefab, transform.position + new Vector3(-2.0f + i, -4.6f), transform.rotation);
         //villagers.Add((GameObject)Instantiate (villagerPrefab, transform.position + new Vector3 (-2.0f + i, -4.6f), transform.rotation));
     }
     villagerSpawnRate = 1.0f / villagerPrefab.GetComponent <VillagerBehaviour> ().movementSpeed;
 }
    public void MoveRight()
    {
        if (changingLine || !enabled)
        {
            return;
        }
        CardinalDirection nextCardinalDirection = MainController.Instance.LevelController.Level.NextPartDirection;

        if (LevelBehaviour.GetDirection(cardinalDirection, nextCardinalDirection) == Direction.Right && nextCardinalDirection != cardinalDirection)
        {
            transform.Rotate(0, 90f, 0);
            cardinalDirection = nextCardinalDirection;
            SetCorrectPositionForNextPart();
        }
        else if (line != Line.Right)
        {
            StartCoroutine(ChangeLine(line + 1));
        }
    }
示例#20
0
    // Use this for initialization
    private void Start()
    {
        var tileMapGameObject = GameObject.Find("TileMap");

        m_tileMap = tileMapGameObject.GetComponent <TileMapBehaviour>();
        if (m_tileMap == null)
        {
            Debug.LogError("TileMapBehaviour not found");
        }
        m_levelBehaviour = tileMapGameObject.GetComponent <LevelBehaviour>();
        if (m_levelBehaviour == null)
        {
            Debug.LogError("LevelBehaviour not found");
        }
        m_sceneFadeInOut = GameObject.Find("SceneFader").GetComponent <SceneFadeInOut>();
        if (m_sceneFadeInOut == null)
        {
            Debug.LogError("SceneFadeInOut not found");
        }
    }
示例#21
0
    private void SetupLevel(LevelBehaviour _levelBehaviour)
    {
        Debug.Log("Level behaviour reset");
        System.Random random = new System.Random();
        int[]         points = Enumerable.Range(0, itemPoints.Count).OrderBy(x => random.Next()).Take(levelSettings.ItemsCount)
                               .ToArray();
        int[] items = Enumerable.Range(0, levelSettings.LevelItems.Count).OrderBy(x => random.Next())
                      .Take(levelSettings.ItemsCount).ToArray();

        ClearPoints();
        for (int i = 0; i < levelSettings.ItemsCount; i++)
        {
            HiddenObjectPrefab hiddenObj = ObjectPool.GetObjectFromPool(hiddenObjectPrefab, itemPoints[points[i]]);
            hiddenObj.Init(levelSettings.LevelItems[items[i]],
                           objectSpritesDatabase.GetSpriteByID(levelSettings.LevelItems[items[i]]));
            currentLevelObjects.Add(hiddenObj);
        }

        UpdateActiveButtons();
        onReload?.Invoke();
    }
    public void SwitchCurrentLevel()
    {
        if (PreviousLevel == null)
        {
            PreviousLevel = CurrentLevel;
        }
        else
        {
            PreviousLevel.SetActive(false);
            CurrentLevel = NextLevel;
        }
        LevelBehaviour levelBehaviour     = CurrentLevel.GetComponent <LevelBehaviour>();
        GameObject     nextLevel          = levelBehaviour.GetPossibleNextLevel();
        LevelBehaviour nextLevelBehaviour = CurrentLevel.GetComponent <LevelBehaviour>();
        Vector3        nextLevelPosition  = levelBehaviour.GetNextLevelPosition(nextLevelBehaviour);

        NextLevel = Instantiate(nextLevel);
        NextLevel.transform.position = nextLevelPosition;

        //////////////////////////////// USING SINGLETON ///////////////////////////////////////
        ScoreBehaviour.Instance.UpdateScore();
        //////////////////////////////// USING SINGLETON ///////////////////////////////////////
    }
示例#23
0
 public void Init() {
     levelPrefab = Resources.Load<LevelBehaviour>(LEVEL_PREFAB_PATH);
 }
示例#24
0
 public AStar(LevelBehaviour levelBehaviour)
 {
     m_levelBehaviour = levelBehaviour;
 }
示例#25
0
 void Awake()
 {
     Levelbehaviour = GetComponent <LevelBehaviour> ();
     Levelbehaviour.Level(_amountOfAmmo, _desiredScore, _typeOfPlanet, _cannon, _planetPosition, _cannonPosition);
 }
示例#26
0
 public void Remove() {
     GameObject.Destroy(Level.gameObject);
     Level = null;
 }
示例#27
0
 public void Remove()
 {
     GameObject.Destroy(Level.gameObject);
     Level = null;
 }
示例#28
0
 /// <summary>
 /// Assigns the level to be played in session.
 /// </summary>
 /// <param name="lvlBhvr">Lvl bhvr.</param>
 private void AssignLevel(LevelBehaviour lvlBhvr)
 {
     levelBehaviour = lvlBhvr;
     toggleLevelText.GetComponent <Text> ().text = "Choose level:   " + levelBehaviour.SceneName();
 }
示例#29
0
 private void SetLevelTime(LevelBehaviour _levelBehaviour)
 {
     timeReference  = _levelBehaviour.LevelTime();
     activeCooldown = _levelBehaviour.LevelTime();
     isTimerActive  = true;
 }
示例#30
0
 // Use this for initialization
 void Start()
 {
     Dano.SetActive(false);
     level      = this.GetComponent <LevelBehaviour>();
     timerEnemy = 0;
 }
示例#31
0
 private void Awake()
 {
     levelBehaviour = LevelBehaviour.Instance();
     levelBehaviour.pauseBehaviour.SubscribeToPauseState(SetEnabled);
 }
示例#32
0
        public override void build()
        {
            base.build();

            loadScreen.init(content);
            //SALVAR O CENARIO ATUAL
            RufusModel     temp  = GameModel.levelsModels.ElementAt(GameModel.currentLevelID);
            LevelBehaviour temp2 = (LevelBehaviour)(temp.behaviour);

            currentLevelModel = temp2.levelModel;

            background = new BackLevelView(currentLevelModel.bgPath);
            if (currentLevelModel.clouds != null)
            {
                background.addClouds(currentLevelModel.clouds);
            }
            background.setColor(currentLevelModel.color);

            background.init(content);
            addChild(background);
            background.start();
            outt = false;

            ButtonModel playModel = new ButtonModel(".\\Sprites\\GUI\\readyButton\\readyButton", ".\\Sprites\\GUI\\readyButton\\readyButtonXML", null);

            playButton = new SimpleButton(playModel, "", new Point(), gotoGame);
            playButton.init(content);
            playButton.position.Y = 570;
            playButton.position.X = 400 - playButton.texture.Width / 2;
            playButton.tweener    = new Tweener(playButton.position.Y, 350f, TimeSpan.FromSeconds(1.0f), Back.EaseOut);
            playButton.tweener.Start();

            locationButton = new SimpleButton(new ButtonModel(".\\Sprites\\GUI\\locationButton\\locationButton", ".\\Sprites\\GUI\\locationButton\\locationButtonXML", null), "", new Point(), changeLevelModel);
            locationButton.init(content);
            locationButton.position.Y = 480;
            locationButton.position.X = 400 - locationButton.texture.Width / 2;
            locationButton.tweener    = new Tweener(locationButton.position.Y, 260f, TimeSpan.FromSeconds(1.0f), Back.EaseOut);
            locationButton.tweener.Start();

            backButton = new HomeButton(gotoInit);
            backButton.init(content);
            backButton.position.Y = 40;
            backButton.position.X = 40;
            // backButton.tweener = new Tweener(backButton.position.Y, 40f, TimeSpan.FromSeconds(1.0f), Back.EaseOut);
            // backButton.tweener.Start();

            changeLevel = new ArrowButton(changeRufus);
            changeLevel.init(content);
            changeLevel.position.Y    = -40;
            changeLevel.position.X    = 490;
            changeLevel.spriteEffects = SpriteEffects.FlipHorizontally;
            changeLevel.scale         = new Vector2(.8f);
            changeLevel.tweener       = new Tweener(changeLevel.position.Y, 120f, TimeSpan.FromSeconds(1.0f), Cubic.EaseOut);
            changeLevel.tweener.Start();

            changeLevelBack = new ArrowButton(changeRufusBack);
            changeLevelBack.init(content);
            changeLevelBack.position.Y    = -40;
            changeLevelBack.position.X    = 268;
            changeLevelBack.spriteEffects = SpriteEffects.None;
            changeLevelBack.scale         = new Vector2(.8f);
            changeLevelBack.tweener       = new Tweener(changeLevel.position.Y, 120f, TimeSpan.FromSeconds(1.0f), Cubic.EaseOut);
            changeLevelBack.tweener.Start();

            backRufusBox = new SimpleButton(new ButtonModel(".\\Sprites\\GUI\\backChoiceRufus", "", null), "", new Point(), openCard);
            backRufusBox.init(content);
            backRufusBox.position.Y = -backRufusBox.texture.Height;
            backRufusBox.position.X = 400 - backRufusBox.texture.Width / 2;
            backRufusBox.tweener    = new Tweener(backRufusBox.position.Y, 40f, TimeSpan.FromSeconds(1.0f), Cubic.EaseOut);
            backRufusBox.tweener.Start();


            rufusImage = new StaticObject(GameModel.rufusModels.ElementAt(GameModel.currentRufusID).largePath);
            rufusImage.init(content);
            rufusImage.position.Y = backRufusBox.position.Y + rufusImage.texture.Height / 2 + backRufusBox.texture.Height / 2;
            rufusImage.position.X = 400 - rufusImage.texture.Width / 2;

            soundButton = new SoundButton(null);
            soundButton.init(content);
            soundButton.position.X = 700f;
            soundButton.position.Y = 40f;

            helpButton = new HelpButton(null);
            helpButton.init(content);
            helpButton.position.X = 600f;
            helpButton.position.Y = 40f;

            addChild(backRufusBox);
            addChild(playButton);
            addChild(changeLevel);
            addChild(changeLevelBack);
            addChild(locationButton);
            addChild(backButton);
            addChild(rufusImage);
            addChild(soundButton);
            addChild(helpButton);
        }
 public static void ChangeLevel(LevelBehaviour targetLevel)
 {
     currentLevel = targetLevel;
 }
示例#34
0
 public void Setup()
 {
     level         = Object.Instantiate(Resources.Load <GameObject>("Prefabs/levelPrefab"));
     levelMovement = level.GetComponent <LevelBehaviour>();
     player        = levelMovement.player;
 }
示例#35
0
    private void Start()
    {
		 


		noMove = true;
		simula = false;
	    syncRunEvent = new AnimationEvent();
		anim = transform.Search ("character_rig").GetComponent<Animator> ();
		 
	 

		effects = transform.Search ("Effects Keen").gameObject;
		 


        var tileMapGameObject = GameObject.Find("TileMap");
        m_tileMap = tileMapGameObject.GetComponent<TileMapBehaviour>();
        if (m_tileMap == null)
            Debug.LogError("TileMapBehaviour not found");
        m_levelBehaviour = tileMapGameObject.GetComponent<LevelBehaviour>();
        if (m_levelBehaviour == null)
            Debug.LogError("LevelBehaviour not found");
        m_sceneFadeInOut = GameObject.Find("SceneFader").GetComponent<SceneFadeInOut>();
        if (m_sceneFadeInOut == null)
            Debug.LogError("SceneFadeInOut not found");

		enemieBehaviourGameObject = GameObject.Find("Enemies");
		if (enemieBehaviourGameObject == null)
			Debug.LogError ("EnemieBehaviour not found");

		itemBehaviourGameObject = GameObject.Find("Itens");
		if (itemBehaviourGameObject == null)
			Debug.LogError ("itens obj not found");

		blocks = GameObject.Find("Blocks");
		
		if (blocks == null)
		{
			Debug.LogError("blocks not found");
			return;
		}
	
		mapPrefab= GameObject.Find("Map");
		
		if (mapPrefab == null)
		{
			Debug.LogError("Map not found");
			return;
		}

		swipeToMove = 10;
		updadeEnemie = false;
		move_slash = false;
		enterDoor = 0;
		haveKey = false;
	
		lifeHitParticle.GetComponent<ParticleSystem> ().enableEmission = false;

		velReal = vel;

    }