상속: MonoBehaviour
예제 #1
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
예제 #2
0
    void Start()
    {
        int yRot = (int)transform.rotation.eulerAngles.y;

        switch (yRot)
        {
        case 0:
            dir = Direction.NORTH;
            break;

        case 90:
            dir = Direction.EAST;
            break;

        case 180:
            dir = Direction.SOUTH;
            break;

        case 270:
            dir = Direction.WEST;
            break;
        }

        turnDuration   = GameObject.Find("Game Manager").GetComponent <Interpreter>().turnDuration;
        startRotation  = transform.rotation.eulerAngles.y;
        startDirection = dir;
        comp           = GameObject.Find("Game Manager").GetComponent <LevelComplete>();
    }
예제 #3
0
    public void ShowMainMenu()
    {
        LoadMenuLevel();
        GamePanel.SetActive(false);
        PauseMenu.SetActive(false);
        HelpPanel.SetActive(false);
        LevelPickerPanel.SetActive(false);
        LevelPickerContainerContainer.SetActive(false);
        //LevelPickerContainerFunContainer.SetActive(false);
        //LevelPickerContainerCommunityContainer.SetActive(false);
        LevelFailed.SetActive(false);
        LevelComplete.SetActive(false);

        MainMenu.SetActive(true);
        SetCameraPosition(true);

        SetCameraTouchX(false);

        if (MainMenu.activeSelf)
        {
            //if (!EventSystem.current.alreadySelecting)
            EventSystem.current.SetSelectedGameObject(PlayButton);
        }

        _canStartMoving = true;
    }
 // Start is called before the first frame update
 void Start()
 {
     BGM  = GameObject.Find("BGM").GetComponent <AudioSource>();
     BGM2 = BGM.transform.GetChild(0).GetComponent <AudioSource>();
     //healthController = GameObject.Find("HealthBar").GetComponent<HealthController>();
     //rewindController = GameObject.Find("ManaBar").GetComponent<TimeRewindController>();
     levelComplete  = GameObject.Find("ScoreController").GetComponent <LevelComplete>();
     currentHealth  = health;
     currentRewinds = deathRewinds;
     healthController.SetMaxHealth(health);
     rewindController.SetMaxMana(deathRewinds);
     animator = GetComponent <Animator>();
     rbody    = GetComponent <Rigidbody2D>();
     AssassinBoxCollider2D = GetComponent <BoxCollider2D>();
     assassinTranforms     = new List <AssassinTransform>();
     AssassinDirection     = transform;
     assassinColliders     = transform.Find("Assassin_Ground_Collider").GetComponent <AssassinColliders>();
     //spawnDustL = transform.Find("Assassin_Wall_Slide_L").GetComponent<Transform>();
     spawnDustR     = transform.Find("Assassin_Wall_Slide_R").GetComponent <Transform>();
     attack_R       = transform.Find("Attack_R").gameObject;
     block_R        = transform.Find("Block_R").gameObject;
     assassinAttack = this.gameObject.transform.GetChild(6).GetComponent <AssassinAttackBlock>();
     assassinBlock  = this.gameObject.transform.GetChild(7).GetComponent <AssassinAttackBlock>();
     characterLines = this.gameObject.transform.GetChild(8).GetComponent <AudioSource>();
     attack_R.SetActive(false);
     block_R.SetActive(false);
     mainCamera = GameObject.Find("Main Camera").GetComponent <Transform>();
 }
예제 #5
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         LevelComplete.Invoke();
     }
 }
예제 #6
0
    private void Awake()
    {
        LevelComplete component = GameObject.Find("InGameLevelCompleteMenu").GetComponent <LevelComplete>();

        component.SetGoal(this.m_goal);
        component.SetChallenges(this.m_challenges);
    }
예제 #7
0
    // Can be called by anything in the scene which completes the level
    public void LevelWin()
    {
        // Save the score if its bigger than the previous one
        int oldScore = PlayerPrefs.GetInt("Score_" + SceneManager.GetActiveScene().name);

        if (collectedCollecibles > oldScore)
        {
            PlayerPrefs.SetInt("Score_" + SceneManager.GetActiveScene().name, collectedCollecibles);

            // And also add it to the collected total
            int diff = collectedCollecibles - oldScore;

            int total = PlayerPrefs.GetInt("TotalGearsCollected");
            PlayerPrefs.SetInt("TotalGearsCollected", total + diff);
        }

        // Since the level could be restarted many times, we don't need to grab
        // the reference to the level complete panel until we actually need to show it
        GameObject levelCompletePanel;

        levelCompletePanel = GameObject.Find("Canvas").transform.Find("LevelCompletePanel").gameObject;
        levelCompletePanel.SetActive(true); // The level panel has its own methods which continue from here

        LevelComplete lvlComplete = levelCompletePanel.transform.Find("InnerPanel").GetComponent <LevelComplete>();

        lvlComplete.ShowAcquiredCollectibles(collectedCollecibles, oldScore);
    }
예제 #8
0
    private void ReviewLevelState(EnemyShipBody ship)
    {
        Score += ship.points;

        if (EnemyManager.amountEnemies == 0)
        {
            GameObject player = GameObject.FindWithTag("Player");
            if (player == null)
            {
                Debug.Log("Player not found");
                return;
            }
            else if (!player.activeInHierarchy)
            {
                return;
            }

            //NEXT LEVEL
            LevelComplete?.Invoke();
        }
        else if (EnemyManager.amountEnemies < 0)
        {
            Debug.LogError("AmountEnemies can't be less than 0");
        }
    }
예제 #9
0
 public virtual void RetryLevel()
 {
     LevelFail.SetActive(false);
     LevelComplete.SetActive(false);
     //PointManager.ResetPoints();
     gameRunning = true;
 }
예제 #10
0
        public void OnSpaceOrEnterPressed()
        {
            var wordToMatch = _wordsToMatch[_currentWordIndex];

            if (wordToMatch == EnteredText)
            {
                WordsToType[_currentWordIndex].Active    = false;
                WordsToType[_currentWordIndex].Completed = true;

                var curWordTupple = WordsToType[_currentWordIndex].Text;
                curWordTupple.Compare = "";
                WordsToType[_currentWordIndex].Text = curWordTupple;

                CurrentWordIndex++;

                if (_currentWordIndex < WordsToType.Count)
                {
                    WordsToType[_currentWordIndex].Active = true;
                    WordToMatch = WordsToType[_currentWordIndex].Text.Display;
                }
                else
                {
                    _endTime = DateTime.Now;
                    UpdateCompletedMessage();
                    LevelComplete?.Invoke(this, new EventArgs());
                }
                EnteredText = "";
            }
            else
            {
                EnteredText = "";
                OnTextChanged();
            }
        }
예제 #11
0
    public override void CompleteLevel()
    {
        base.CompleteLevel();

        PointManager.AddPoints(PointType.issHealth, (int)Mathf.Floor(ISS.currentHealth) * 10);
        LevelComplete.SetPointsText(CreatePointsText());
    }
예제 #12
0
        public void LoadGameState()
        {
            if (!File.Exists(filename)) // Переход к загрузке только при наличии файла.
            //создаем новый
            {
                levelsSettings = new List <LevelSettings>();
                for (int i = 0; i < DefaultLevels; i++)
                {
                    LevelComplete complete = LevelComplete.opened;
                    if (i > 0)
                    {
                        complete = LevelComplete.closed;
                    }
                    levelsSettings.Add(new LevelSettings(i, Random.Range(1, 4) * 10,
                                                         Random.Range(1, DefaultEnemy + 1), Random.Range(1, DefaultEnemyship + 1), complete));
                }
                SaveGameState();
                return;
            }
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      stream    = File.Open(filename, FileMode.Open);
            //вытянули
            var gamestate = formatter.Deserialize(stream) as Dictionary <string, object>;

            stream.Close();
            levelsSettings = (List <LevelSettings>)gamestate["LevelsSettings"];
        }
예제 #13
0
 // Start is called before the first frame update
 void Start()
 {
     assassin       = GameObject.FindGameObjectWithTag("Player");
     timeController = GameObject.Find("Time").GetComponent <TimeController>();
     levelComplete  = GameObject.Find("ScoreController").GetComponent <LevelComplete>();
     healthCanvas   = GameObject.Find("HealthBar");
     timeCanvas     = GameObject.Find("Manabar");
 }
예제 #14
0
 public LevelSettings(int namelvl, int specifiedTime, int enemy, int enemyShip, LevelComplete levelComplete)
 {
     this.namelvl       = namelvl;
     this.specifiedTime = specifiedTime;
     this.enemy         = enemy;
     this.enemyShip     = enemyShip;
     curLevelComplete   = levelComplete;
 }
예제 #15
0
 public void OnClickRetryAfterLevelComplete()
 {
     PlaySound(buttonClick);
     if (levelComplete == null)
     {
         levelComplete = FindObjectOfType <LevelComplete>();
     }
     levelComplete.RetryCurrentLevel();
 }
예제 #16
0
    void OnTriggerEnter(Collider collider)
    {
        LevelComplete levelComplete = collider.GetComponent <LevelComplete>();

        if (levelComplete != null)
        {
            levelComplete.CompleteLevel(this);
        }
    }
예제 #17
0
 public void OnLoadNextLevelClicked()
 {
     PlaySound(buttonClick);
     if (levelComplete == null)
     {
         levelComplete = FindObjectOfType <LevelComplete>();
     }
     levelComplete.LoadNextLevel();
 }
예제 #18
0
    void OnDestroy()
    {
        Data.Instance.events.OnMissionComplete    -= OnMissionComplete;
        Data.Instance.events.OnAvatarCrash        -= OnAvatarCrash;
        Data.Instance.events.OnAvatarFall         -= OnAvatarCrash;
        Data.Instance.events.OnListenerDispatcher -= OnListenerDispatcher;

        events        = null;
        levelComplete = null;
    }
예제 #19
0
    void OnDestroy()
    {
        Data.Instance.events.OnMissionStart  -= OnMissionStart;
        Data.Instance.events.OnAvatarCrash   -= OnAvatarCrash;
        Data.Instance.events.OnAvatarFall    -= OnAvatarCrash;
        Data.Instance.events.OnBossActive    -= OnBossActive;
        Data.Instance.events.OnGenericUIText -= OnGenericUIText;

        levelComplete = null;
    }
예제 #20
0
파일: HiScore.cs 프로젝트: vezix/FYPGame
 // Start is called before the first frame update
 void Start()
 {
     highscore = PlayerPrefs.GetFloat(LevelScore, 0);
     Score     = gameObject.GetComponent <LevelComplete>();
     if (Score.Total > highscore)
     {
         PlayerPrefs.SetFloat(LevelScore, Score.Total);
         NewHighDisplay.SetActive(true);
     }
 }
예제 #21
0
 public PlayerData(LevelComplete player)
 {
     Button2 = player.Button2;
     Button3 = player.Button3;
     Button4 = player.Button4;
     Button5 = player.Button5;
     Button6 = player.Button6;
     Button7 = player.Button7;
     Button8 = player.Button8;
 }
예제 #22
0
    public static void SavePlayer(LevelComplete player)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/player2.f**k";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        PlayerData data = new PlayerData(player);

        formatter.Serialize(stream, data);
        stream.Close();
    }
예제 #23
0
    void OnDestroy()
    {
        Data.Instance.events.OnAvatarCrash        -= OnAvatarCrash;
        Data.Instance.events.OnAvatarFall         -= OnAvatarCrash;
        Data.Instance.events.OnBossActive         -= OnBossActive;
        Data.Instance.events.OnGenericUIText      -= OnGenericUIText;
        Data.Instance.events.OnGameOver           -= OnGameOver;
        Data.Instance.events.ResetHandwritingText -= ResetHandwritingText;

        levelComplete = null;
    }
예제 #24
0
 public void HideMainMenu()
 {
     GamePanel.SetActive(false);
     PauseMenu.SetActive(false);
     MainMenu.SetActive(false);
     HelpPanel.SetActive(false);
     LevelPickerPanel.SetActive(false);
     LevelFailed.SetActive(false);
     LevelComplete.SetActive(false);
     SetCameraPosition(false);
 }
예제 #25
0
    private void FinishLevel()
    {
        _canStartMoving = false;
        AppController.Instance.Save();
        var message = LevelComplete.transform.Find("Message").GetComponent <TMPro.TMP_Text>();

        message.text = CurrentLevelFinishMessage;
        LevelComplete.SetActive(true);
        EventSystem.current.SetSelectedGameObject(LevelCompleteButton);
        Time.timeScale = 0;
    }
예제 #26
0
    void Update()
    {
        if (minutes == 0 && seconds == 0)
        {
//			#if UNITY_EDITOR
//			UnityEditor.EditorApplication.isPlaying = false;
//			#endif
            if (PopUp == false)
            {
                PopUp = true;
                LevelComplete.PopUp();
                Time.timeScale = Time.timeScale == 0 ? 1 : 0;
                Victory        = GetComponentInChildren <AudioSource>();
                Victory.Play();
                if (PlayerPrefs.GetInt("noCrash") == 0)
                {
                    collision.GetComponent <Image>().enabled = true;
                    AddNCAchievement(PlayerPrefs.GetString("Username") + nocoll, 1);
                    PlayerPrefs.SetInt("noCrash", 1);
                    PlayerPrefs.Save();
                }
                if (ScoreManager.initialScore >= 2500)
                {
                    astar.GetComponent <Image>().enabled = true;
                    AddASAchievement(PlayerPrefs.GetString("Username") + ast, 1);
                }

                if (ifLevel10 && ScoreManager.initialScore >= 2500)
                {
                    BT.GetComponent <Image>().enabled = true;
                    AddBTAchievement(PlayerPrefs.GetString("Username") + beat, 1);
                }
            }
            return;
        }

        if (milliseconds <= 0)
        {
            if (seconds <= 0)
            {
                minutes--;
                seconds = 59;
            }
            else if (seconds >= 0)
            {
                seconds--;
            }
            milliseconds = 100;
        }
        milliseconds -= Time.deltaTime * 100;
        text.text     = string.Format("{0:0}:{1:00}", minutes, seconds);
    }
예제 #27
0
        public void LoadSounds()
        {
            GainOneUp                       = content.Load <SoundEffect>("smb_1-up");
            GainPowerUp                     = content.Load <SoundEffect>("smb_powerup");
            Coin                            = content.Load <SoundEffect>("smb_coin");
            CoinScore                       = content.Load <SoundEffect>("smb_coin_score");
            PowerUpAppears                  = content.Load <SoundEffect>("smb_powerup_appears");
            BlockBump                       = content.Load <SoundEffect>("smb_bump");
            BlockBreaking                   = content.Load <SoundEffect>("smb_breakblock");
            SmallJump                       = content.Load <SoundEffect>("smb_jump-small");
            BigJump                         = content.Load <SoundEffect>("smb_jump-super");
            PowerDown                       = content.Load <SoundEffect>("smb_pipe");
            EnemyStomp                      = content.Load <SoundEffect>("smb_stomp");
            EnemyKick                       = content.Load <SoundEffect>("smb_kick");
            MarioDeath                      = content.Load <SoundEffect>("smb_mariodie");
            Fireball                        = content.Load <SoundEffect>("smb_fireball");
            Flagpole                        = content.Load <SoundEffect>("smb_flagpole");
            LevelClear                      = content.Load <SoundEffect>("smb_stage_clear");
            TimeWarning                     = content.Load <SoundEffect>("smb_warning");
            TimeRunningOutOverworld         = content.Load <SoundEffect>("Overworld_Theme_Fast");
            TimeRunningOutStar              = content.Load <SoundEffect>("Star_Theme_Fast");
            WorldClear                      = content.Load <SoundEffect>("smb_world_clear");
            Fireworks                       = content.Load <SoundEffect>("smb_fireworks");
            GamePause                       = content.Load <SoundEffect>("smb_pause");
            GameOver                        = content.Load <SoundEffect>("smb_gameover");
            LevelComplete                   = content.Load <SoundEffect>("smb_level_complete");
            Star                            = content.Load <SoundEffect>("Star Theme");
            OverWorld                       = content.Load <SoundEffect>("Overworld_Theme");
            Underground                     = content.Load <SoundEffect>("smb_underground");
            YourCodeSucks                   = content.Load <SoundEffect>("YourCodeSucks");
            Laugh                           = content.Load <SoundEffect>("NormalLaugh");
            EvilLaugh                       = content.Load <SoundEffect>("EvilLaugh");
            YoshiSound                      = content.Load <SoundEffect>("YoshiSound");
            EggHatchingSound                = content.Load <SoundEffect>("EggHatchingSound");
            YoshiTongueSound                = content.Load <SoundEffect>("YoshiTongueSound");
            YoshiSwallowSound               = content.Load <SoundEffect>("YoshiSwallowSound");
            Dubstep                         = content.Load <SoundEffect>("Dubstep");
            UndergroundInstance             = Underground.CreateInstance();
            OverWorldInstance               = OverWorld.CreateInstance();
            StarInstance                    = Star.CreateInstance();
            TimeRunningOutOverworldInstance = TimeRunningOutOverworld.CreateInstance();
            TimeRunningOutStarInstance      = TimeRunningOutStar.CreateInstance();
            TimeWarningInstance             = TimeWarning.CreateInstance();
            LevelCompleteInstance           = LevelComplete.CreateInstance();
            GameOverInstance                = GameOver.CreateInstance();
            DubstepInstance                 = Dubstep.CreateInstance();

            TimeWarningInstance.IsLooped = false;
        }
예제 #28
0
파일: Main.cs 프로젝트: DmitGR/MonoDevGame
 protected void StartGame(int Level, int HP)
 {
     options  = new Options(graphics);
     gameOver = new GameOver(graphics);
     map      = new Map(graphics.GraphicsDevice.Viewport);
     map.Generate(Level, BlockSize);
     player           = new Player(map.Start);
     player.Health    = new HealthBar(HP);
     player.ArmorHud  = new ArmorHud();
     player.SplashHud = new SplashHud();
     levelComplete    = new LevelComplete(graphics);
     mainmenu         = new MainMenu(graphics);
     pause            = new Pause(graphics);
     logic            = new Logic(graphics.GraphicsDevice);
     base.Initialize();
 }
예제 #29
0
파일: Main.cs 프로젝트: DmitGR/MonoDevGame
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        ///
        protected override void Initialize()
        {
            MediaPlayer.Volume = 0.01f;
            Info             = false;
            options          = new Options(graphics);
            gameOver         = new GameOver(graphics);
            levelComplete    = new LevelComplete(graphics);
            map              = new Map(graphics.GraphicsDevice.Viewport);
            player           = new Player(Vector2.Zero);
            Level            = 1;
            HealthPoint      = 3;
            player.Health    = new HealthBar(HealthPoint);
            player.ArmorHud  = new ArmorHud();
            player.SplashHud = new SplashHud();
            mainmenu         = new MainMenu(graphics);
            pause            = new Pause(graphics);
            logic            = new Logic(graphics.GraphicsDevice);

            base.Initialize();
        }
예제 #30
0
    void Start()
    {
        lc = GameObject.Find("pacotinho").GetComponent <LevelComplete>();

        Nome = SceneManager.GetActiveScene().name;

        moedinhas = GameObject.Find("MoedinhasText").GetComponent <Text>();

        Cena = GameObject.Find("Moedas").GetComponent <SpriteRenderer>().sprite = moedas0;

        Gravar = GameObject.Find("Teste").GetComponent <SpriteRenderer>().sprite = moedas0;

        desempenho = GameObject.Find("DesempenhoText").GetComponent <Text>();



        vari2 = PlayerPrefs.GetInt("level1", moedas.contagem);



        if (vari2 == 0)
        {
            Gravar = GameObject.Find("Teste").GetComponent <SpriteRenderer>().sprite = moedas0;
        }

        if (vari2 == 1)
        {
            Gravar = GameObject.Find("Teste").GetComponent <SpriteRenderer>().sprite = moedas1;
        }

        if (vari2 == 2)
        {
            Gravar = GameObject.Find("Teste").GetComponent <SpriteRenderer>().sprite = moedas2;
        }

        if (vari2 == 3)
        {
            Gravar = GameObject.Find("Teste").GetComponent <SpriteRenderer>().sprite = moedas3;
        }
    }