Ejemplo n.º 1
0
    // Use this for initialization
    public void Setup(LevelManager _lm)
    {
        name = "UI";
        _levman = _lm;
        transform.position = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, -100f);

        GameEventManager.GameStart += GameStart;
        GameEventManager.GameOver += GameOver;
        GameEventManager.Respawn += Respawn;

        _IngameUI = FETool.findWithinChildren(this.gameObject, "Ingame").GetComponent<IngameUI>();
        _GameOverUI = FETool.findWithinChildren(this.gameObject, "GameOver").GetComponent<GameOverUI>();
        _EntryUI = FETool.findWithinChildren(this.gameObject, "EntryMenu").GetComponent<EntryUI>();
        _EndGameUI = FETool.findWithinChildren(this.gameObject, "EndGame").GetComponent<EndGameUI>();
        BottomPos = FETool.findWithinChildren(gameObject, "BottomPos").transform;
        TopPos = FETool.findWithinChildren(gameObject, "TopPos").transform;

        _IngameUI.SetupSub(this);
        _IngameUI.Setup();
        _GameOverUI.SetupSub(this);
        _GameOverUI.Setup();
        _EntryUI.SetupSub(this);
        _EntryUI.Setup();
        _EndGameUI.SetupSub(this);
        _EndGameUI.Setup();

        if (_lm._profile.SETUP.GameType == GameSetup.versionType.Demo)
        {
            _IngameUI.initPos = IngamePlaceDemo;
            _GameOverUI.lbInitpos = LeaderboardPlaceDemo;
            _EndGameUI.lbInitpos = LeaderboardPlaceDemo;
        }
    }
 IEnumerator EndGame_()
 {
     StartCoroutine(ToLevelExclusive(endName));
     while (inLoad)
     {
         yield return(null);
     }
     EndGameUI.Init();
 }
Ejemplo n.º 3
0
    public EndGameUI EngGame()
    {
        Canvas canvas = FindObjectOfType <Canvas>();

        EndGameUI     endGame = Instantiate <EndGameUI>(_endGamePrefab);
        RectTransform rect    = endGame.GetComponent <RectTransform>();

        rect.transform.parent = canvas.transform;
        rect.localScale       = Vector3.one;
        rect.anchorMax        = Vector2.one;
        rect.anchorMin        = Vector2.one;

        endGame.EndGame(_score);

        return(endGame);
    }
Ejemplo n.º 4
0
        private void Update()
        {
            if (InteractableManager.InteractableList.Length == 0)
            {
                return;
            }

            if (GameManager.Mode == GameMode.Rehearsal)
            {
                if (!isNextHighlighted)
                {
                    InteractablePath.InitializeNextInteractable();
                    isNextHighlighted = true;
                }

                if (InteractablePath.PathComplete)
                {
                    GameManager.State = GameState.End;
                    EndGameUI.ToggleOn();
                }
                else if (LevelManager.IsMultiLevelGame && ShowLevelComplete)
                {
                    GameManager.State = GameState.Menu;
                    if (!GameManager.TutorialMode)
                    {
                        LevelClearUI.ToggleOn();
                    }
                }
            }
            else if (GameManager.Mode == GameMode.Recall)
            {
                if (InteractableLog.PathComplete)
                {
                    GameManager.State = GameState.End;
                    EndGameUI.ToggleOn();
                }
                else if (LevelManager.IsMultiLevelGame && ShowLevelComplete)
                {
                    GameManager.State = GameState.Menu;
                    if (!GameManager.TutorialMode)
                    {
                        LevelClearUI.ToggleOn();
                    }
                }
            }
        }
Ejemplo n.º 5
0
    void Start()
    {
        endGame = GameObject.Find("Canvas2").GetComponent <EndGameUI>();
        Count   = 12;
        list    = new List <Enemy>();
        list.Add(Instantiate(Resources.Load <Enemy>("BatArmySword")));
        list.Add(Instantiate(Resources.Load <Enemy>("Bomber")));
        list.Add(Instantiate(Resources.Load <Enemy>("Onager")));

        for (int i = 3; i < 12; i += 3)
        {
            list.Add(Instantiate(list[0]));
            list.Add(Instantiate(list[1]));
            list.Add(Instantiate(list[2]));
        }

        StartCoroutine(Next());
    }
Ejemplo n.º 6
0
        private void Update()
        {
            if (InteractableManager.InteractableList.Length == 0)
            {
                return;
            }

            if (GameManager.Mode == GameMode.Rehearsal)
            {
                if (!isNextHighlighted)
                {
                    InteractablePath.InitializeNextInteractable();
                    isNextHighlighted = true;
                }

                if (InteractablePath.PathComplete)
                {
                    GameManager.State = GameState.End;
                    EndGameUI.ToggleOn();
                }
                else if (LevelManager.IsMultiLevelGame && ShowLevelComplete)
                {
                    GameManager.State = GameState.Menu;
                    LevelClearUI.ToggleOn();
                }
            }
            else if (GameManager.Mode == GameMode.Recall)
            {
                if (InteractableLog.PathComplete)
                {
                    SeedConverter converter = new SeedConverter();
                    SeedString        = converter.DecodeSeed();
                    GameManager.State = GameState.End;
                    EndGameUI.ToggleOn();
                }
                else if (LevelManager.IsMultiLevelGame && ShowLevelComplete)
                {
                    GameManager.State = GameState.Menu;
                    LevelClearUI.ToggleOn();
                }
            }
        }
Ejemplo n.º 7
0
    public void EndGame()
    {
        if (PlayerPrefs.GetInt("GameAdsCount", 0) >= 3)
        {
            if (AppLovin.HasPreloadedInterstitial())
            {
                PlayerPrefs.SetInt("GameAdsCount", 0);
                AppLovin.ShowInterstitial();
            }
        }
        GameAnalytics.NewProgressionEvent(GAProgressionStatus.Complete, "game", SpaceShipController.instance.score);
        ShowEndScreen();

        SaveScore();
        LoadScore();
        InGameUI.SetActive(false);
        EndGameUI.SetActive(true);
        HighScoreTxt2.text = HighScoreTxt.text;
        ScoreTxt2.text     = ScoreTxt.text;
    }
Ejemplo n.º 8
0
    public void InitializeServices()
    {
        _cardSpawner = null ?? GetComponent <CardSpawner>();

        _sceneHandler = null ?? GetComponent <EndGameUI>();

        _hudManager = null ?? GetComponent <HUDManager>();

        _gameData = null ?? new GameDataManager();

        _pairChecker = null ?? new PairChecker();

        _serverCommunication = null ?? new ServerCommunications();

        _serializer = null ?? new JsonSerializer(saveFolder);

        _scoreCalculator = null ?? new ScoreCalculator();

        _scoreboardManager = null ?? new ScoreboardManager(_gameData, _scoreCalculator, _serializer);
    }
Ejemplo n.º 9
0
    private void OnCollisionEnter2D(Collision2D other)
    {
        print(other.gameObject.name);
        if (other.gameObject.tag == "Station")
        {
            state = State.landing;
            StartCoroutine(Land(other));
            SoundEffect.PlayOneShot(SoundOnLandingNormal);
        }

        if (other.gameObject.tag == "Death")
        {
            rb.velocity = Vector2.zero;
            state       = State.idle;
            m_Anim.SetTrigger("Death");
            SoundEffect.PlayOneShot(SoundOnDeath);
            //Game Over
            EndGameUI.SetActive(true);
            StartCoroutine("GameOver");
        }
    }
Ejemplo n.º 10
0
    private void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.tag == "Station")
        {
            rb.velocity = Vector2.zero;
            state       = State.idle;
            if (other.contacts[0].normal.y >= 0.9f)
            {
                Vector3 angle = new Vector3(0f, 0f, 0f);
                spaceman.transform.rotation = Quaternion.Euler(angle);
            }
            else if (other.contacts[0].normal.y <= -0.9f)
            {
                Vector3 angle = new Vector3(0f, 0f, 180f);
                spaceman.transform.rotation = Quaternion.Euler(angle);
            }
            else if (other.contacts[0].normal.x >= 0.9f)
            {
                Vector3 angle = new Vector3(0f, 0f, 270f);
                spaceman.transform.rotation = Quaternion.Euler(angle);
            }
            else if (other.contacts[0].normal.x <= -0.9f)
            {
                Vector3 angle = new Vector3(0f, 0f, 90f);
                spaceman.transform.rotation = Quaternion.Euler(angle);
            }

            // adjust to perpendicular position
        }

        if (other.gameObject.tag == "Death")
        {
            rb.velocity = Vector2.zero;
            state       = State.idle;
            //Game Over
            EndGameUI.SetActive(true);
        }
    }
Ejemplo n.º 11
0
 public IEnumerator CountDown()
 {
     if (isGameOver)
     {
         PlayerPrefs.SetInt("GameAdsCount", PlayerPrefs.GetInt("GameAdsCount"));
         EndGameUI.SetActive(false);
         CountDownUI.SetActive(true);
         for (i = 3; i > 0; i--)
         {
             CountDownText.text = i.ToString();
             CountDownText.gameObject.transform.localScale = Vector3.one;
             CountDownText.gameObject.transform.DOScale(Vector3.zero, 1f).SetEase(Ease.Linear);
             yield return(new WaitForSeconds(1f));
         }
         if (i == 0)
         {
             ResumeGame();
         }
     }
     else
     {
         yield return(null);
     }
 }
Ejemplo n.º 12
0
    public override void _Ready()
    {
        sprite           = GetNode <AnimatedSprite>("Sprite");
        collisionShape2D = GetNode <CollisionShape2D>("CollisionShape2D");
        bloodParticles   = GetNode <Particles2D>("BloodParticles");
        camera2D         = GetNode <Camera2D>("Camera2D");

        crunchSounds[0] = GetNode <AudioStreamPlayer2D>("sounds/CrunchSoundOne");
        crunchSounds[1] = GetNode <AudioStreamPlayer2D>("sounds/CrunchSoundTwo");
        crunchSounds[2] = GetNode <AudioStreamPlayer2D>("sounds/CrunchSoundThree");
        crunchSounds[3] = GetNode <AudioStreamPlayer2D>("sounds/CrunchSoundFour");
        moneyGained     = GetNode <AudioStreamPlayer2D>("sounds/MoneyGained");
        hitSound        = GetNode <AudioStreamPlayer2D>("sounds/HitSound");
        healSound       = GetNode <AudioStreamPlayer2D>("sounds/HealSound");
        rayCast2D       = GetNode <RayCast2D>("RayCast2D");

        healthBar = GetNode <HealthBar>("HealthBarNode");

        this.inGameUI           = GetNode <InGameUI>("Camera2D/HudLayer/UI");
        this.endGameUI          = GetNode <EndGameUI>("Camera2D/HudLayer/EndGameUI");
        this.healParticleEffect = GetNode <Particles2D>("healParticleEffect");

        this.bulletNodes = new BulletNode[maxBullets];

        for (int i = 0; i < maxBullets; i++)
        {
            BulletNode bulletInstance = (BulletNode)BulletScene.Instance();
            AddChild(bulletInstance);

            bulletNodes[i] = bulletInstance;
        }
        endGameUI.Visible = false;

        inGameUI.SetSpendingMoney(spendingMoney);
        inGameUI.SetWeaponDamage(damage);
    }
Ejemplo n.º 13
0
 static private EndGameUI setInstance()
 {
     instance = HUDManager.Instance.GetComponentInChildren <EndGameUI>(true); return(instance);
 }
Ejemplo n.º 14
0
 void Start()
 {
     instance = this;
 }
Ejemplo n.º 15
0
 void Start()
 {
     endGame        = GameObject.Find("Canvas2").GetComponent <EndGameUI>();
     spriteRenderer = GetComponent <SpriteRenderer>();
 }