Exemple #1
0
    private void Start()
    {
        gameManager = TheGameManager.Instance;

        for (int i = 0; i < buttons.Length; i++)
        {
            if (i > lockIndex)
            {
                break;
            }

            buttons[i].GetComponent <Image>().color = colors[i];
        }

        cButtonIndex = playerNumber - 1;
        buttons[cButtonIndex].Select();
        buttons[cButtonIndex].transform.localScale = new Vector3(1.35f, 1.35f, 1);

        if (playerNumber == 2)
        {
            instructions.text = joinTxt;
        }

        joined = (playerNumber == 1) ? true : false;
    }
Exemple #2
0
    // Collision detection can be inherited too ?
    void OnCollisionEnter2D(Collision2D col)
    {
        if (TheGameManager.GetComponent <GameManager>().IsGameOver())
        {
            return;
        }

        //Manages health of the medkit bonus
        GameObject obj = col.gameObject;

        if (obj.name == BulletName)
        {
            if (obj.GetComponent <Bullet>().IsBulletLethal())
            {
                m_HP--;
                UpdateHealthDisplay();
                if (m_HP < 1)
                {
                    int owner = obj.GetComponent <Bullet>().GetOwningPlayer();
                    //This deals negative damage...
                    //Should make a separate function that processes healing but this works for the moment
                    TheGameManager.GetComponent <GameManager>().PlayerGotShot(-m_healAmount, owner);
                    DeactivateBonus();
                }
            }
        }
    }
Exemple #3
0
 private void Awake()
 {
     // Only one instance of this class may exist (Singleton Design Pattern)
     if (instance == null)
     {
         instance = this;
     }
 }
Exemple #4
0
    public override void OnStartClient()
    {
        base.OnStartClient();

        string        _netID  = GetComponent <NetworkIdentity>().netId.ToString();
        PlayerManager _player = GetComponent <PlayerManager>();

        TheGameManager.RetisterPlayer(_netID, _player);
    }
 public void Awake()
 {
     if (instance != null)
     {
         Debug.LogWarning("More than one instance of TheGameManager found!");
         return;
     }
     instance = this;
 }
Exemple #6
0
 void Awake(){
     if(instance == null){
         instance = this;
         //DontDestroyOnLoad(this.gameObject);
     }
     else{
         Destroy(gameObject);
     }
     currentLevel = PlayerPrefs.GetInt("CurrentLevel");
 }
Exemple #7
0
    void OnDisable()
    {
        Destroy(playerUIInstance);

        if (sceneCamera != null)
        {
            sceneCamera.gameObject.SetActive(true);
        }

        TheGameManager.UnRegisterPlayer(transform.name);
    }
    public void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            _instance = this;
        }


        InitRequiredComponents();
    }
Exemple #9
0
        void timer_Tick(object sender, EventArgs e)
        {
            Counter++;
            if (StopWatch.ElapsedMilliseconds > 1000)
            {
                DebugHelper.WriteLog(String.Format("Snakes Wpfed : number of snake parts is {0}", ArrayOfItems.OfType <SnakePiecePresenter>().Count()), "SnakesPresenter");
                DebugHelper.WriteLog(String.Format("Snakes Wpfed : fps is {0}", Counter), "SnakesPresenter");

                Counter = 0;
                StopWatch.Restart();
            }
            TheGameManager.UpdateGameBoard(ArrayOfItems);
            OnPropertyChanged("ArrayOfItems");
        }
 public void SetGMIMG(TheGameManager gm, InputManager im)
 {
     gameManager  = gm;
     inputManager = im;
 }