Beispiel #1
0
 // Update is called once per frame
 void Update()
 {
     if (transitionManager == null)
     {
         transitionManager = FindObjectOfType <LevelTransition>();
     }
 }
Beispiel #2
0
    void Start()
    {
        if (transitionManager == null)
        {
            transitionManager = FindObjectOfType <LevelTransition>();
        }
        Titles       = new List <string>();
        Descriptions = new List <string>();
        Titles.Add("Dummy None Placeholder");
        Descriptions.Add("Dummy None Placeholder");
        Titles.Add("Your Money Ran Out!");
        Titles.Add("Your Family Ran Out of Food");
        Titles.Add("You Failed to Pay Housing Costs");
        Titles.Add("You Didn't Pay Taxes for the Day");
        Titles.Add("Data Breach");
        Titles.Add("Your Kid Dies of Polio");
        Titles.Add("You Made Too Many Mistakes");
        Titles.Add("You Conspired With The Enemy.");
        Descriptions.Add("Due to poor financial decisions, you're broke. In fact you're in debt. How did you manage that? Your family can't depend on a breadloser, you loser.");
        Descriptions.Add("While living the lavish life of spending money on not food somewhere along the way you somehow convinced yourself that food was no longer a necessity, the sudden realization causes you to look at yourself and you realize you are nothing but skin and bones, a walking skeleton, the fantasy of wellness has been shattered as well as the dream of living a normal life. You're a skeleton now you can't go to work like this, it's embarrassing!  ");
        Descriptions.Add("Due to your unwillingness to pay your own rent, your cold and unfeeling robot of a landlord physically throws you out of your home leaving you only with the clothes on your back and the money in your wallet. With your lack of housing, you turn to living on the streets, a new life of vagrancy is in store, with new horrible experiences on the horizon, explore and discover what the world of homelessness has in store for you. Get out there killer!");
        Descriptions.Add("Either because of your lack of money or lack of brain cells to comprehend the importance of taxes, no matter the case, the wolves are at your door and by wolves I mean tax collectors. Since you can't pay your taxes with money, they decided that you'll have to pay with something else, specifically your right arm! Get used to living the rest of your life being monoplegic, oh and you die of blood loss. What? You didn't expect them to send you to a hospital or something right? Those medical bills are expensive you know.");
        Descriptions.Add("Data Breach");
        Descriptions.Add("Because you refused to buy medicine for your son, your son died. Your neighbor soon found out and told the police about your negligence. You were convicted for the destruction of your child and sentenced to life in prison.");
        Descriptions.Add("A leakage of classified information has empowered international radical terrorist groups to seize power in your nation resulting in them taking control of all the world's freedom. You're dead, your family is dead, your friends are dead, all the pets are dead and the world hates you.");
        Descriptions.Add("Your supervisor took notice of your inability to perform simple tasks and with the approval from the higher ups at the company, has saw fit to relieve you of your position PERMANENTLY. You'll never see your co-worker, desk, or even your family again! No one knows where you were taken, so you were never killed, rather your official status is that you were erased.");

        //LoadEndGameText();
    }
Beispiel #3
0
 // Start is called before the first frame update
 void Start()
 {
     levelCheck      = FindObjectOfType <TutorialManager>();
     levelTransition = FindObjectOfType <LevelTransition>();
     activeScene     = SceneManager.GetActiveScene();
     sceneName       = activeScene.name;
 }
Beispiel #4
0
    // Use this for initialization
    void Start()
    {
        onCostPage = false;
        //load tutorial things
        inTutorial = true;
        foreach (Image i in TutorialPages)
        {
            i.gameObject.SetActive(false);
        }
        //TutorialPages[0].gameObject.SetActive(true);
        //currPage = 0;
        //look for transition manager
        if (transitionManager == null)
        {
            transitionManager = FindObjectOfType <LevelTransition>();
        }
        //look for player info
        if (playerInfo == null)
        {
            playerInfo = FindObjectOfType <PlayerInfo>();
            playerInfo.foodCostPerDay  = foodCostPerDay;
            playerInfo.houseCostPerDay = houseCostPerDay;
            playerInfo.taxCostPerDay   = taxCostPerDay;
        }
        //look for game over checker
        if (gameOverCheck == null)
        {
            gameOverCheck = FindObjectOfType <GameOverChecker>();
        }

        // Reset all newspaper objects
        leftLongBody.SetActive(false);
        leftShortBody.SetActive(false);
        leftImageObj.SetActive(false);
        rightLongBody.SetActive(false);
        rightShortBody.SetActive(false);
        rightImageObj.SetActive(false);
        newspaperCanvas.SetActive(false);

        // Reset all email objects
        emailCanvas.SetActive(false);

        // Start with newspaper if there is one
        if (todaysNewspaper != "null")
        {
            currentGameState = GameState.Newspaper;
            ParseNewspaperFile();
            UpdateNewspaperObjects();
            // Show newspaper
            newspaperCanvas.SetActive(true);
        }

        // Prepare email
        if (todaysEmail != "null")
        {
            ParseEmailFile();
            UpdateEmailObjects();
        }
    }
    void transitionToNextLevel()
    {
        LevelTransition.getInstance().setManager(this);
        LevelTransition.getInstance().startTransition();
        grow.Play();

        this.monster.setCurrentFood(0);
    }
Beispiel #6
0
 private void Start()
 {
     Instance = this;
     while (capsulatest.transform.position.z >= MoveToPos.position.z)
     {
         capsulatest.transform.position = Vector3.Lerp(capsulatest.transform.position, MoveToPos.position, 1);
     }
 }
Beispiel #7
0
 public static void GotoScene(string index, float fadeOut = 0.0f, float fadeIn = 0.0f)
 {
     if (fadeOut > Mathf.Epsilon || fadeIn > Mathf.Epsilon)
     {
         LevelTransition.LoadLevel(index, fadeOut, fadeIn, Color.black);
     }
     else
     {
         SceneManager.LoadScene(index);
     }
 }
Beispiel #8
0
    private void Awake()
    {
        isPaused        = false;
        levelTransition = FindObjectOfType <LevelTransition>();
        hudManager      = FindObjectOfType <HudManager>();

        pauseMenu.SetActive(false);
        playerDiedMenu.SetActive(false);
        levelCompletedMenu.SetActive(false);
        gameCompletedMenu.SetActive(false);
        gameOverMenu.SetActive(false);
    }
Beispiel #9
0
 void Update()
 {
     if (transitionManager == null)
     {
         transitionManager = FindObjectOfType <LevelTransition>();
     }
     if (playerInfo == null)
     {
         playerInfo = FindObjectOfType <PlayerInfo>();
         UpdateText(playerInfo.currState);
     }
 }
    public void Start()
    {
        // set the private level transition to this one
        _levelTransition = levelTransition;

        SetTransitionIn();

        if (loadOnStart)
        {
            StartCoroutine(SetOutTransition());
        }
    }
Beispiel #11
0
        public static void SpawnJellyfish(Scene gameScene, LevelTransition levelTransition)
        {
            var sign           = MachinaGame.Random.CleanRandom.NextDouble() < 0.5f ? 1 : 1;
            var x              = gameScene.camera.ViewportWidth * 1.5f * sign;
            var jellyFishActor = gameScene.AddActor("Jellyfish", new Vector2(x, levelTransition.transform.Position.Y));

            new BubbleSpawner(jellyFishActor, new Machina.Data.MinMax <int>(5, 7));
            new Fish(jellyFishActor, levelTransition.transform, FishStats.jellyfish);
            new Jellyfish(jellyFishActor, levelTransition);
            new JellyfishRenderer(jellyFishActor);
            new NewTargetOffsetWhenReachesCurrent(jellyFishActor);
        }
Beispiel #12
0
    // Update is called once per frame
    void Update()
    {
        if (LevelTransition.getInstance().getTransitioning())
        {
            return;
        }


        Vector3 direction = getDirectionVector();

        velocity += (velocity + direction) / ROTATION_FACTOR;

        if (velocity.magnitude > MAX_SPEED)
        {
            velocity.Normalize();
            velocity *= MAX_SPEED;
        }

        enemy.transform.rotation = Quaternion.FromToRotation(new Vector3(0, 0, 0), velocity);
        enemy.transform.Translate(MAX_SPEED * Time.deltaTime * velocity);
        enemy.transform.rotation = Quaternion.FromToRotation(new Vector3(1, 0, 0), velocity);
        enemy.transform.Rotate(new Vector3(0, 0, -90));

        if (killed)
        {
            if (killDelay > 0)
            {
                killDelay -= Time.deltaTime;
            }
            else
            {
                if (gameOverStart)
                {
                    if (gameOverDelay > 0)
                    {
                        gameOverDelay -= Time.deltaTime;
                    }
                    else
                    {
                        monster.kill();
                        Music.togglePause();
                    }
                }
                else
                {
                    Instantiate(gameOver).Play();
                }

                gameOverStart = true;
            }
        }
    }
Beispiel #13
0
    void Start()
    {
        levelTransition = FindObjectOfType <LevelTransition>();
        enter           = false;
        // canvas.GetComponent<Canvas>().enabled = false;
        counter = 0;
        dialog  = GameObject.Find("Text").GetComponent <Text>();

        activated = true;

        chop.GetComponent <Image>().enabled = false;
        baba.GetComponent <Image>().enabled = true;
    }
 /// <summary>
 ///     Get's elements, components, and scripts.
 /// </summary>
 private void GetUIElements()
 {
     _body            = GameObject.FindGameObjectWithTag("DialogueBody").GetComponent <Text>();
     _lPanel          = GameObject.FindGameObjectWithTag("NamePanelLeft").GetComponent <Image>();
     _rPanel          = GameObject.FindGameObjectWithTag("NamePanelRight").GetComponent <Image>();
     _lSprite         = GameObject.FindGameObjectWithTag("leftSprite").GetComponent <Image>();
     _rSprite         = GameObject.FindGameObjectWithTag("rightSprite").GetComponent <Image>();
     _lName           = GameObject.FindGameObjectWithTag("NameLeft").GetComponent <Text>();
     _rName           = GameObject.FindGameObjectWithTag("Nameright").GetComponent <Text>();
     canvas           = GameObject.FindGameObjectWithTag("CutsceneUI").GetComponent <Canvas>();
     _pause           = GameObject.FindGameObjectWithTag("Manager").GetComponent <Pause>();
     _levelTransition = GameObject.Find("FadeCanvas").GetComponentInChildren <LevelTransition>();
 }
Beispiel #15
0
    void Start()
    {
        staticCameraCopy     = staticCamera;
        winScreenCopy        = winScreen;
        wandCopy             = wand;
        playerHatCopy        = playerHat;
        sendCueLocationCopy  = sendCueLocation;
        sendCueLocationCopy2 = sendCueLocation2;

        transitioning     = false;
        currentRoom       = initialRoom;
        numberOfRoomsCopy = numberOfRooms;
    }
Beispiel #16
0
    private void Awake()
    {
        animator  = GetComponent <Animator>();
        rigidBody = GetComponent <Rigidbody>();
        floorMask = LayerMask.GetMask("Floor");

        levelTransition = FindObjectOfType <LevelTransition>();
        scenesManager   = FindObjectOfType <ScenesManager>();
        soundManager    = FindObjectOfType <SoundManager>();
        hudManager      = FindObjectOfType <HudManager>();

        currentHealth = startingHealth;
    }
Beispiel #17
0
    void Start()
    {
        levelTransition = FindObjectOfType <LevelTransition>();
        enter           = false;
        // canvas.GetComponent<Canvas>().enabled = false;
        counter = 0;
        dialog  = GameObject.Find("Text").GetComponent <Text>();

        activated = false;

        gameManager       = FindObjectOfType <GameManager>();
        eatingEnterDialog = FindObjectOfType <EatingEnterDialog>();
        showerEnterDialog = FindObjectOfType <ShowerEnterDialog>();
    }
Beispiel #18
0
 // Start is called before the first frame update
 void Start()
 {
     thisTransform        = transform;
     thisGameObject       = gameObject;
     transform.position   = GameManagerScript.Instance.playerStartPos;
     thisRigidBody2D      = thisGameObject.GetComponent <Rigidbody2D>();
     groundColliderCheck  = groundCheck.GetComponent <Collider2D>();
     ceilingColliderCheck = ceilingCheck.GetComponent <Collider2D>();
     thisCamera           = GameObject.Find("Main Camera").GetComponent <PlayerCamera>();
     thisAnimator         = GetComponent <Animator>();
     levelTransScript     = GameObject.Find("LevelTransition").GetComponent <LevelTransition>();
     yInteract.SetActive(false);
     health = GameManagerScript.Instance.currentMaxHealth;
 }
    public void LoadScene(string sceneName)
    {
        if (sceneName == SceneManager.GetActiveScene().name)
        {
            fastTravelMap.SetActive(false);
            EventSystem.current.SetSelectedGameObject(null);
            return;
        }

        LevelTransition transition = GetComponent <LevelTransition>();

        transition.nextLevel = "Scenes/" + sceneName;
        transition.StartTransition();
    }
Beispiel #20
0
    void OnGUI()
    {
        if (GUILayout.Button("Transition Trigger"))
        {
            foreach (GameObject obj in Selection.gameObjects)
            {
                if (obj != null)
                {
                    string name = obj.name;
                    if (!name.StartsWith("top") && !name.StartsWith("bot") &&
                        !name.StartsWith("left") && !name.StartsWith("right"))
                    {
                        EditorUtility.DisplayDialog("HKEdit",
                                                    "One of selected objects does not have a valid name.\n" +
                                                    "(starts with \"top\", \"bot\", \"left\", \"right\")", "OK");
                        return;
                    }
                }
            }

            foreach (GameObject obj in Selection.gameObjects)
            {
                if (obj != null)
                {
                    BoxCollider2D collid = obj.AddComponent <BoxCollider2D>();
                    collid.size = new Vector2(1, 4);
                    LevelTransition trans = obj.AddComponent <LevelTransition>();
                    trans.targetScene = "Town";
                    trans.entryPoint  = "left1";
                }
            }
        }
        if (GUILayout.Button("Camera Lock Area"))
        {
            foreach (GameObject obj in Selection.gameObjects)
            {
                if (obj != null)
                {
                    BoxCollider2D collid = obj.AddComponent <BoxCollider2D>();
                    collid.size = new Vector2(20, 15);
                    CameraLockArea area = obj.AddComponent <CameraLockArea>();
                    area.cameraXMin = -1;
                    area.cameraYMin = -1;
                    area.cameraXMax = -1;
                    area.cameraYMax = -1;
                }
            }
        }
    }
Beispiel #21
0
    void Start()
    {
        if (transitionManager == null)
        {
            transitionManager = FindObjectOfType <LevelTransition>();
        }

        BinaryFormatter bf       = new BinaryFormatter();
        FileStream      file     = File.Create(Application.dataPath + "/ss.ss");
        Data            saveFile = new Data();

        //write saveFile to file
        bf.Serialize(file, saveFile);
        file.Close();
    }
Beispiel #22
0
    void Start()
    {
        player      = GameObject.FindWithTag("Player");
        facingRight = true;

        soundManager        = FindObjectOfType <SoundManager>();
        levelTransition     = FindObjectOfType <LevelTransition>();
        levelCompleted      = FindObjectOfType <LevelCompleted>();
        gameCompleted       = FindObjectOfType <GameCompleted>();
        gameOver            = FindObjectOfType <GameOver>();
        playerDied          = FindObjectOfType <PlayerDied>();
        collectiblesManager = FindObjectOfType <CollectiblesManager>();
        lifeManager         = FindObjectOfType <LifeManager>();
        saveData            = FindObjectOfType <SaveData>();

        rigidBody = GetComponent <Rigidbody2D>();
        animator  = GetComponent <Animator>();
    }
Beispiel #23
0
    // Start is called before the first frame update
    void Start()
    {        // Set tutorial references and variables on start
        GameObject soundManagerObject = GameObject.FindWithTag("SoundManager");

        soundManager               = soundManagerObject.GetComponent <SoundManager>();
        playerController           = FindObjectOfType <PlayerController>();
        gameOver                   = FindObjectOfType <GameManager>();
        playerHitPoints            = FindObjectOfType <DetectPlayerCollisions>();
        scoreManager               = FindObjectOfType <ScoreManager>();
        levelTransition            = FindObjectOfType <LevelTransition>();
        playerWeapons              = FindObjectOfType <PlayerWeaponsController>();
        playerController.canEngage = false;
        playerController.canMove   = false;
        hazardHpDestroyed          = false;
        dangerWarning              = false;
        wasEnemyEngaged            = false;
        displayPanel.gameObject.SetActive(false);
        StartCoroutine(timePauseHalfNoIdex());
    }
Beispiel #24
0
    /// <summary>
    /// <para>If currentLevelDuration surpass the levelDuration then the transition will start and it will invoke the
    /// LevelTransition event</para>
    /// <para>If transitioning is true and the currentLevelDuration is higher than the levelTransitionTime then the
    /// NextLevel event is Invoke and the currentLevel is increase.</para>
    /// </summary>
    private void Update()
    {
        if (transitioning && currentLevelDuration >= levelTransitionTime)
        {
            currentLevel++;
            levelUI.UpdateValue(currentLevel);
            NextLevel?.Invoke(currentLevel);
            currentLevelDuration = 0;
            transitioning        = false;
            return;
        }

        if (currentLevelDuration >= levelDuration)
        {
            transitioning = true;
            LevelTransition?.Invoke();
            currentLevelDuration = 0;
            return;
        }

        currentLevelDuration += Time.deltaTime;
    }
Beispiel #25
0
        /// <summary>
        /// Unpack an interactable
        /// </summary>
        /// <param name="d"></param>
        /// <returns></returns>
        public Interactable Unpack(InteractableData d)
        {
            var    tex    = content.Load <Texture2D>(itemFilePath + d.textureName);
            Sprite sprite = new Sprite(tex, Utils.scaleForTexture(tex), Color.White);

            Interactable newInteractable;

            if (d is PowerupData p)
            {
                //Powerups are a very simple subclass of interactables,
                //they need no extra handling except their one piece of data
                var newPowerup = new Powerup(sprite, Vector2.Zero);
                newPowerup.powerupType = p.powerupType;
                newInteractable        = newPowerup;
            }
            else
            {
                switch (d.interactableType)
                {
                case InteractableType.coin:
                    newInteractable = new Coin(sprite, Vector2.Zero);
                    break;

                case InteractableType.nextLevel:
                    newInteractable = new LevelTransition(sprite, Vector2.Zero);
                    break;

                case InteractableType.extraLife:
                    newInteractable = new ExtraLife(sprite, Vector2.Zero);
                    break;

                default:
                    newInteractable = null;
                    break;
                }
            }

            return(newInteractable);
        }
Beispiel #26
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            SpriteBatch = new SpriteBatch(GraphicsDevice);
            Player      = new Player(new Vector2(EntityWidth * (float)PlayerStartColumn, EntityHeight * (float)(PlayerStartRow + 1)));
            m_DebugText = Content.Load <SpriteFont>("Fonts/Joystix_12");
            MapManager.LoadMaps(); //Maps must be loaded before levels - H.E.
            LevelManager.LoadLevels();
            MainMenu.LoadContent();
            LevelTransition.LoadContent();
            HUD.LoadContent();
            GameOverMenu.LoadContent();
            GameWinMenu.LoadContent();
            LevelTransition.LoadContent();
            Leaderboard.LoadContent();
            GetLeaderBoardResultsAsync();
            m_DebugPixel = new Texture2D(GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            m_DebugPixel.SetData(new[] { Color.White });

            ScanLines = Content.Load <Texture2D>("UI/ScanLines");
            Border    = Content.Load <Texture2D>("UI/Border");

            MenuMusic = Content.Load <SoundEffect>("Sounds/Menu");
            GameMusic = Content.Load <SoundEffect>("Sounds/Main"); //Sounds/Last_slice_hiphop
        }
Beispiel #27
0
 private void Awake()
 {
     DontDestroyOnLoad(this);
     m_Instance = this;
     m_Material = Resources.Load <Material>("Plane_No_zTest");
 }
Beispiel #28
0
        private void OnStateChange()
        {
            if (CurrentMusicInstance != null)
            {
                if (!(NextGameState == GameState.Menu && GameState == GameState.Menu))
                {
                    CurrentMusicInstance.Stop();
                }
                else if (CurrentMusicInstance.State == SoundState.Paused)
                {
                    CurrentMusicInstance.Play();
                }
            }

            if (NextGameState == GameState.GameOver) //Answer me Snake...Snake?! SNAKEEEEEEE!!!"
            {
                if (GameOverMenu.GameOverReason == GameOverReason.Win)
                {
                    CurrentScreen = GameWinMenu;
                    GameWinMenu.LastPlayerScore = Player.Score;
                }
                else
                {
                    CurrentScreen = GameOverMenu;
                    GameOverMenu.Awake();
                }

                GameState = GameState.Menu;
                Player.OnGameOver();
                LevelManager.OnGameOver();
                NextGameState = GameState.None;

                CurrentMusicInstance          = MenuMusic.CreateInstance();
                CurrentMusicInstance.IsLooped = true;
                CurrentMusicInstance.Play();
            }
            else
            {
                if (NextGameState == GameState.Menu)
                {
                    switch (NextUIType)
                    {
                    case UIType.MainMenu:
                    {
                        CurrentScreen = MainMenu;
                        break;
                    }

                    case UIType.LevelTransition:
                    {
                        LevelTransition.ResetState();
                        CurrentScreen = LevelTransition;
                        break;
                    }

                    case UIType.GameOver:
                    {
                        CurrentScreen = GameOverMenu;
                        break;
                    }

                    case UIType.Leaderboard:
                    {
                        CurrentScreen = Leaderboard;
                        break;
                    }

                    default:
                    {
                        break;
                    }
                    }
                }
                else if (NextGameState == GameState.Game)
                {
                    LevelManager.NextLevel();
                }
                else if (NextGameState == GameState.NewGame)
                {
                    NewGame();
                }

                if (NextGameState == GameState.Game)
                {
                    CurrentMusicInstance          = GameMusic.CreateInstance();
                    CurrentMusicInstance.IsLooped = true;
                }
                else if (CurrentMusicInstance == null || (GameState == GameState.Menu && CurrentScreen != LevelTransition && !(NextGameState == GameState.Menu && GameState == GameState.Menu)))
                {
                    CurrentMusicInstance          = MenuMusic.CreateInstance();
                    CurrentMusicInstance.IsLooped = true;
                    CurrentMusicInstance.Play();
                }

                GameState = NextGameState;
            }

            NextGameState = GameState.None;
            NextUIType    = UIType.None;
        }
Beispiel #29
0
 void Start()
 {
     levelTransition = FindObjectOfType <LevelTransition>();
 }
 private void Start()
 {
     player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>();
     trans  = GetComponent <LevelTransition>();
 }