Пример #1
0
 private void Start()
 {
     popupController = ClassManager.instance.popupController;
     resourceManager = ClassManager.instance.resourceManager;
     dataHolder      = ClassManager.instance.dataHolder;
     winManager      = ClassManager.instance.winManager;
 }
Пример #2
0
    void Start()
    {
        audioSource           = GetComponent <AudioSource>();
        audioSource.enabled   = true;
        Time.timeScale        = 1f;
        deathManager          = GameObject.Find("DeathManager").GetComponent <DeathManager>();
        winManager            = GameObject.Find("WinManager").GetComponent <WinManager>();
        waterSpeed            = speed / 2;
        originalSpeed         = speed;
        currentHealth         = maxHealth;
        healthSlider.maxValue = maxHealth;
        healthSlider.value    = currentHealth;
        healthFill.color      = healthGradient.Evaluate(1f);

        currentThirst         = maxThirst;
        thirstSlider.maxValue = maxThirst;
        thirstSlider.value    = currentThirst;
        thirstFill.color      = thirstGradient.Evaluate(1f);
        Coroutine thirstRoutine = StartCoroutine(thirst());

        currentHunger         = maxHunger;
        hungerSlider.maxValue = maxHunger;
        hungerSlider.value    = currentHunger;
        Coroutine hungerRoutine = StartCoroutine(hunger());


        // anim = GetComponent<Animator>();
        rb        = GetComponent <Rigidbody2D>();
        inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <Inventory>();
        buttons   = GameObject.FindGameObjectsWithTag("HotBar");
        for (int i = 0; i < buttons.Length; i++)
        {
            itemSelector[i] = (buttons[i].GetComponent <ItemSelector>());
        }
    }
Пример #3
0
 //窗体初始化,实例化等操作
 public void Init()
 {
     m_isInitControl = false;
     InitControls();
     AssignEvents();
     WinManager.GetInstance().AddWindow(this);
 }
Пример #4
0
    // Update is called once per frame
    void FixedUpdate()
    {
        //invincibility frames after being hit
        if (invincible > 0)
        {
            invincible -= 1;
        }

        //enemy death
        if (hp <= 0)
        {
            if (isBoss)
            {
                Instantiate(BossFinalForm, transform.position, transform.rotation);
            }
            else if (isFinalBoss)
            {
                WinManager winScript = GameObject.FindWithTag("Manager").GetComponent <WinManager>();
                winScript.win();
            }
            else
            {
                spawnPickup();
            }
            gameObject.SetActive(false);
        }
    }
Пример #5
0
    //change turn method switches the bool state

    public void ChangeTurn()
    {
        isItRedsTrun = !isItRedsTrun;
        FindObjectOfType <DDmanager>().HideAllDD();

        FindObjectOfType <CellManager>().HideAllCells();
        FindObjectOfType <CellManager>().UpdateFreeSpaces();

        myEndTurn.ChangeButtonState(false);

        Cell[] allCells = FindObjectsOfType <Cell>();

        foreach (Cell cell in allCells)
        {
            cell.isaSkipCell = false;
        }

        OctiPawn[] allOctis = FindObjectsOfType <OctiPawn>();

        foreach (OctiPawn maybeDeathOcti in allOctis)
        {
            if (maybeDeathOcti.isDeathHighlight)
            {
                Destroy(maybeDeathOcti);
                Destroy(maybeDeathOcti.gameObject);
            }
        }

        //0 is green win
        //1 is red win
        //2 is no win event

        //IsRedWin() is an int return type

        WinManager myWinManager = FindObjectOfType <WinManager>();

        if (myWinManager.IsRedWin() == 0)
        {
            //print("green wins");

            SaveData.Instance.DeleteGame(RECENT_KEY, 9999);
            WinTrack.winInt = 0;
            mySceneManager.LoadNextSceneOnDelay(1);
        }
        else if (myWinManager.IsRedWin() == 1)
        {
            //print("red wins");

            SaveData.Instance.DeleteGame(RECENT_KEY, 9999);
            WinTrack.winInt = 1;
            mySceneManager.LoadNextSceneOnDelay(1);
        }


        //turned off for developig purposes
        //
        //Camera mainCam = FindObjectOfType<Camera>();
        //mainCam.transform.Rotate(0.0f, 0.0f, 180.0f, Space.Self);
    }
Пример #6
0
    public void TakeDamage(int damage)
    {
        health -= damage;

        if (characterType == 5)
        {
            if (Random.Range(0, 2) == 0)
            {
                DropPotion(manaPotion, 50f);
            }
            if (Random.Range(0, 2) == 1)
            {
                DropPotion(healthPotion, 30f);
            }
        }

        HealthUI.text        = health.ToString();
        HealthBar.fillAmount = health / maxHealth;

        if (health <= 0)
        {
            if (manaPotion != null && characterType != 0 && characterType != 5)
            {
                int randomInt = Random.Range(0, 2);
                if (randomInt == 0)
                {
                    DropPotion(manaPotion, 101f);
                }
                if (randomInt == 1)
                {
                    DropPotion(healthPotion, 101f);
                }
            }

            if (characterType == 0)
            {
                GetComponent <PlayerController>().OnGameEnd(false);
                DeathManager.Death();
                MusicManager.PlaySound("youdied");
            }

            if (characterType > 0)
            {
                GameObject.FindWithTag("Player").GetComponent <PlayerController>().gaStats.Mobkills++;
                Debug.Log("Mobs killed: " + GameObject.FindWithTag("Player").GetComponent <PlayerController>().gaStats.Mobkills);
                if (characterType == 5)
                {
                    GameObject.FindWithTag("Player").GetComponent <PlayerController>().OnGameEnd(true);
                    WinManager.Win();
                    MusicManager.PlaySound("win");
                }
                else
                {
                    SoundManagerScript.PlaySound("enemydeath1");
                }
            }
            Destroy(gameObject);
        }
    }
Пример #7
0
 // Start is called before the first frame update
 void Start()
 {
     winner = 0;
     wm     = GetComponent <WinManager>();
     ai     = GetComponent <AIPlaceManager>();
     setPlayers(MenuManager.AIPlayers);
     players = shuffle(player1, player2, player3);
     gm      = new GameMatrix();
 }
Пример #8
0
 private void Awake()
 {
     if (instance != null)
     {
         Debug.LogWarning("Il y a plus d'un WinManager");
         return;
     }
     instance = this;
 }
Пример #9
0
 // Start is called before the first frame update
 void Start()
 {
     losePanel.SetActive(false);
     pauseManager     = FindObjectOfType <PauseManager>();
     winManager       = FindObjectOfType <WinManager>();
     swordRend.color  = swordColors[0];
     swordPowerNumber = 1;
     UIImageSelectedColor();
 }
Пример #10
0
 // Use this for initialization
 void Start()
 {
     _transform = this.transform;
     _camera = Camera.main;
     if (follower.GetComponent<NetworkView>().isMine)
     {
         _isOwner = true;
     }
     winManager = GameObject.Find("WinManager").GetComponent<WinManager>();
 }
Пример #11
0
    public void NoPressRestart()
    {
        restartMenu.SetActive(false);
        WeaponAttack playerScript = GameObject.FindWithTag("Player").GetComponent <WeaponAttack>();
        WinManager   winScript    = GameObject.FindWithTag("Manager").GetComponent <WinManager>();

        if (playerScript.hp <= 0 || winScript.wonGame)
        {
            SceneManager.LoadScene("MenuScene");
        }
    }
Пример #12
0
 private void Awake()
 {
     if (_instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         _instance = this;
     }
 }
Пример #13
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Debug.LogWarning("Duplicate death manager instance found", this.gameObject);
         Destroy(this);
     }
 }
Пример #14
0
        private void OnAttach(object sender, EventArgs e)
        {
            var cCuenta = (DTO.Configuration.Cuenta)((ToolStripMenuItem)sender).Tag;

            var cuenta = BLL.ClientManager.AttachPW(cCuenta);

            if (cuenta != null)
            {
                WinManager.AddClient(cuenta);
            }

            LastCuentaCreated = cuenta;
        }
Пример #15
0
    // Start is called before the first frame update
    void Start()
    {
        Time.timeScale = 1;
        gameLost       = false;

        winManager = FindObjectOfType <WinManager>();

        paused = false;
        PauseCanvas.SetActive(false);

        GameSource.clip = gameMusic;
        GameSource.Play();
    }
Пример #16
0
    void Start()
    {
        DontDestroyOnLoad(this.gameObject);

        if (winManagerInstance == null)
        {
            winManagerInstance = this;
        }
        else
        {
            Object.Destroy(this.gameObject);
        }
    }
Пример #17
0
        private void OnAbrirNuevo(object sender, EventArgs e)
        {
            var cCuenta = (DTO.Configuration.Cuenta)((ToolStripMenuItem)sender).Tag;

            var cuenta = BLL.ClientManager.OpenPW(cCuenta);

            cuenta.Action.Global.DoLogin(true);
            if (cuenta != null)
            {
                WinManager.AddClient(cuenta);
            }

            LastCuentaCreated = cuenta;
        }
Пример #18
0
    private void Start()
    {
        resourceManager = ResourceManagement.instance;

        #region Maintain a single instance
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
        #endregion
    }
Пример #19
0
 private void Awake()
 {
     SetSingleton();
     playerControllers = new PlayerController[4];
     playersInGame     = new bool[4];
     playerConnect     = PlayerConnected.GetSingleton;
     tutoStart         = GetComponent <TutoStart>();
     winManager        = GetComponent <WinManager>();
     scoreManager      = GetComponent <ScoreManager>();
     itemManager       = GetComponent <ItemManager>();
     if (!objectDynamiclyCreated)
     {
         Debug.LogError("error");
     }
 }
Пример #20
0
    // Start is called before the first frame update
    void Start()
    {
        SoundEffectSource = GameObject.Find("SoundEffect Source  2").GetComponent <AudioSource>();

        stunState    = new StunState(this);
        burnState    = new BurnState(this);
        chaseState   = new ChaseState(this);
        currentState = chaseState;

        player     = FindObjectOfType <PlayerController>();
        winManager = FindObjectOfType <WinManager>();

        burnCounter = 0f;

        ChasePlayer();
    }
Пример #21
0
 private void setClasses()
 {
     inputManager          = gameObject.GetComponent <InputManager>();
     dataHolder            = gameObject.GetComponent <DataHolder>();
     selectionManager      = gameObject.GetComponent <SelectionManager>();
     prefabManager         = gameObject.GetComponent <PrefabManager>();
     hudController         = gameObject.GetComponent <HudController>();
     cursorManager         = gameObject.GetComponent <CursorManager>();
     resourceManager       = gameObject.GetComponent <ResourceManager>();
     randomResourceSpawner = gameObject.GetComponent <RandomResourceSpawner>();
     popupController       = gameObject.GetComponent <PopupController>();
     characterUiManager    = gameObject.GetComponent <CharacterUiManager>();
     winManager            = gameObject.GetComponent <WinManager>();
     graveyardManager      = gameObject.GetComponent <GraveyardManager>();
     tipManager            = gameObject.GetComponent <TipManager>();
     soundManager          = gameObject.GetComponent <SoundManager>();
 }
Пример #22
0
    private void Awake()
    {
        if (current == null)
        {
            current = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        Enemy[] es = FindObjectsOfType <Enemy>();

        foreach (Enemy e in es)
        {
            enemies.Add(e);
        }
    }
Пример #23
0
    private IEnumerator ActuallyWin()
    {
        if (!dead)
        {
            dead = true;
            WinManager w = FindObjectOfType <WinManager>();
            if (w)
            {
                w.FadeIn(2);
            }
            yield return(new WaitForSeconds(4));

            SceneLoader loader = FindObjectOfType <SceneLoader>();
            if (loader)
            {
                loader.Load("menu");
            }
        }
        yield break;
    }
Пример #24
0
    private void Start()
    {
        // If Game started in unity on the gameplay scene then go to the card scene
        // otherwise run as normal
        if (GameObject.Find("CardManager") != null)
        {
            cardManager = GameObject.Find("CardManager").GetComponent <CardManager>();
        }
        else
        {
            SceneManager.LoadScene("CardDraw", LoadSceneMode.Single);
        }

        if (GameObject.Find("SettingsManager") != null)
        {
            settingsManager = GameObject.Find("SettingsManager").GetComponent <SettingsManager>();
            pointsToWin     = settingsManager.pointsToWin;
        }

        scoreboardManager = GameObject.Find("ScoreboardManager").GetComponent <ScoreboardManager>();
        winManager        = GameObject.Find("WinManager").GetComponent <WinManager>();
    }
Пример #25
0
 private void Start()
 {
     instance = this;
 }
Пример #26
0
 private void Awake()
 {
     Instance = this;
 }
Пример #27
0
 void Awake()
 {
     m_Singleton = this;
 }
        private void btnEnter_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(tbLogin.Text))
            {
                ClassMessageBox.MessageBoxInfo("Введите логин");
                tbLogin.Focus();
            }
            else if (string.IsNullOrEmpty(pbPassword.Password))
            {
                ClassMessageBox.MessageBoxInfo("Введите пароль");
                pbPassword.Focus();
            }
            else
            {
                try
                {
                    connection.Open();
                    cmd = new SqlCommand("SELECT [RoleId], " +
                                         "[Password] FROM [User] " +
                                         $"WHERE [Login] = '{tbLogin.Text}'", connection);
                    reader = cmd.ExecuteReader();
                    reader.Read();

                    if (reader[1].ToString() != pbPassword.Password)
                    {
                        ClassMessageBox.MessageBoxError("Не верный " +
                                                        "логин или пароль");
                        tbLogin.Focus();
                    }
                    else
                    {
                        App.Login    = tbLogin.Text;
                        App.Password = reader[1].ToString();
                        App.Role     = reader[0].ToString();

                        switch (App.Role)
                        {
                        case "1":
                            WinCustomer winCustomer = new WinCustomer();
                            winCustomer.Show();
                            this.Close();
                            break;

                        case "2":
                            WinManager winManager = new WinManager();
                            winManager.Show();
                            this.Close();
                            break;

                        case "3":
                            WinStorekeeper winStorekeeper = new WinStorekeeper();
                            winStorekeeper.Show();
                            this.Close();
                            break;

                        case "4":
                            WinDirectorate winDirectorate = new WinDirectorate();
                            winDirectorate.Show();
                            this.Close();
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    ClassMessageBox.MessageBoxError(ex.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
Пример #29
0
 public EndLevelTrigger(
     WinManager winManager)
 {
     _winManager = winManager;
 }
Пример #30
0
 public void SetWinManager(WinManager winMan)
 {
     theWinManager = winMan;
 }
Пример #31
0
 void Awake()
 {
     anim       = GetComponent <Animator>();
     winManager = GetComponent <WinManager>();
 }