Ejemplo n.º 1
0
    public void setOnAllCars()
    {
        GameMngr gameMngr = gameMngrObj.GetComponent <GameMngr>();

        gameMngr.setOnAllCars();
        gameMngr.statsAddStartRaceCount();
    }
Ejemplo n.º 2
0
    bool setStatistics(int _playerPlace)
    {
        GameMngr gameMngrTmp = gameMngrObj.GetComponent <GameMngr>();

        gameMngrTmp.statsEndRace(_playerPlace);
        return(true);
    }
Ejemplo n.º 3
0
 void OnTriggerEnter2D(Collider2D hitInfo)
 {
     if (hitInfo.name == "Ball")
     {
         var wallName = transform.name;
         GameMngr.Score(wallName);
         hitInfo.gameObject.SendMessage("ResetBallTimer");
     }
 }
Ejemplo n.º 4
0
    public override void CalculateHit(int amount)
    {
        base.CalculateHit(amount);

        if (HitPoints <= 0)
        {
            GameMngr.IncrementScore();
            Destroy(this.gameObject);
        }
    }
Ejemplo n.º 5
0
    public override void CalculateHit(int amount)
    {
        //Remove heart from UI
        UserInterface.DecreasePlayerHealth();
        base.CalculateHit(amount);

        if (HitPoints <= 0)
        {
            GameMngr.EndGame();
        }
    }
Ejemplo n.º 6
0
    void Start()
    {
        stackColorCode    = DataScript.currentColorCode;
        isFallingFinished = false;
        isFallingOnGround = false;
        height            = 0;
        ikControl         = GetComponentInParent <IKControl>();
        collectedCubes    = new List <Transform>();

        gameMngr         = FindObjectOfType(typeof(GameMngr)) as GameMngr;
        playerController = GetComponentInParent <PlayerController>();
    }
Ejemplo n.º 7
0
    void OnTriggerEnter2D(Collider2D hitInfo)
    {
        if (hitInfo.name == "Ball")
        {
            var wallName = transform.name;
            GameMngr.Score(wallName);
            hitInfo.gameObject.SendMessage("ResetBallTimer");

            audioSource      = GetComponent <AudioSource>();
            audioSource.clip = scoreSound;
            audioSource.Play();
        }
    }
Ejemplo n.º 8
0
 void RpcTeamColor(int t)
 {
     if (!gm)
     {
         gm = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameMngr>();
     }
     //Debug.Log(gm.clientTeam);
     //Debug.Log(t);
     if (gm.clientTeam == t)
     {
         slider.GetComponent <Image>().color = Color.blue;
     }
 }
Ejemplo n.º 9
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
     enemies     = new List <Enemy>();
     boardScript = GetComponent <BoardManager>();
     //InitGame();
 }
Ejemplo n.º 10
0
    public void gameInit()
    {
        //Debug.Log("init");
        gm = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameMngr>();
        //CmdAssignConnection();
        //CmdUpdateScore(netId);
        CmdGetSpawn();
        GameObject ab = GameObject.FindGameObjectWithTag("Abil");

        if (ab)
        {
            abilities = ab.GetComponent <AbilSelector>();
            gm.popAs(abilities);
        }
    }
Ejemplo n.º 11
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
        board_script = GetComponent <BoardMngr>();
        InitGame();
    }
Ejemplo n.º 12
0
    void CmdGetSpawn()
    {
        #region Assign connections

        gm = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameMngr>();

        #endregion


        //NetworkInstanceId spawnID = sv.assignSpawn();
        ServerMngr.spawnInfo spnI = sv.getSpawn(myConId);
        NetworkConnection    nc   = connectionToClient;

        spawn = NetworkServer.FindLocalObject(spnI.sid);
        team  = spnI.team;

        gm.assignConnection(connectionToClient, netId, team);
        //for (uint i = 0; i < 10; i++)
        //{
        //    print(i + "  cmd  " + NetworkServer.FindLocalObject(new NetworkInstanceId(i)));
        //}
        TargetSetSpawn(nc, spnI.sid);
    }
Ejemplo n.º 13
0
    void Start()
    {
        mainMenuMngr  = mainMenuInterfaceObj.GetComponent <MainMenuManager>();
        playerData    = playerDataObj.GetComponent <PlayerData>();
        actualNrTrack = playerData.getActualTrack();
        actualLvl     = playerData.getActualLvl();
        minLvl        = playerData.getMinLvl();
        maxLvl        = playerData.getMaxLvl();
        nrLvlText     = nrLvlTextObj.GetComponent <Text>();
        setNrLvlText();
        checkRangeNrLvl();
        gameMngr            = gameMngrObj.GetComponent <GameMngr>();
        textMoney           = textMoneyObj.GetComponent <Text>();
        upgrades            = upgradesObj.GetComponent <UpgradesManager>();
        advMgr              = gameMngr.getAdvMgr();
        statisticsInterface = statisticsInterfaceObj.GetComponent <StatisticsInterfaceManager>();
        checkSoundsBtnOption();

        shopMgr = shopObj.GetComponent <ShopManager>();

        trackBtnMnr    = trackBtnObj.GetComponent <LvlNrInterfaceTrackBtnMnr>();
        advBtnLvlNrMgr = advBtnLvlNrMgrObj.GetComponent <LvlNrInterfaceAdButtonManager>();
    }
Ejemplo n.º 14
0
 // Use this for initialization
 void Awake()
 {
     gm = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameMngr>();
 }
Ejemplo n.º 15
0
    IEnumerator gameInit()
    {
        while (!players.TrueForAll(p => p.ghost.connectionToClient.isReady))
        {
            yield return(null);
        }

        //foreach(Player p in players)
        //{
        //    NetworkServer.SetClientReady(p.ghost.connectionToClient);
        //}
        NetworkServer.SpawnObjects();
        spawns = GameObject.FindGameObjectsWithTag("Respawn");
        GameObject gmO = GameObject.FindGameObjectWithTag("GameController");

        gm = gmO.GetComponent <GameMngr>();
        if (teams)
        {
            Dictionary <int, List <Player> > teamPlayers = new Dictionary <int, List <Player> >();
            foreach (Player p in players)
            {
                if (!teamPlayers.ContainsKey(p.team))
                {
                    teamPlayers.Add(p.team, new List <Player>()
                    {
                        p
                    });
                }
                else
                {
                    teamPlayers[p.team].Add(p);
                }
            }
            List <GameObject> teamSpawns = new List <GameObject>();
            int spawnNum = 0;
            List <GameObject> newSpawns = new List <GameObject>();
            foreach (GameObject s in spawns)
            {
                teamSpawns.Add(s);
            }

            foreach (int team in teamPlayers.Keys)
            {
                int        numPlayers = teamPlayers[team].Count;
                GameObject teamSpawn  = teamSpawns[spawnNum];
                spawnNum = (spawnNum + 1) % (teamSpawns.Count);
                for (int i = 0; i < numPlayers; i++)
                {
                    GameObject s = Instantiate(spawnPre,
                                               teamSpawn.transform.position +
                                               teamSpawn.transform.forward * ((i + 1) / 2 * (Mathf.Pow(-1, i))) * 2

                                               , teamSpawn.transform.rotation);
                    newSpawns.Add(s);
                    NetworkServer.Spawn(s);
                    teamPlayers[team][i].spawnInd = newSpawns.Count - 1;
                }
            }
            spawns = newSpawns.ToArray();
            foreach (GameObject s in teamSpawns)
            {
                Destroy(s);
            }

            foreach (Player p in players)
            {
                p.ghost.RpcInitilize();
            }
        }
        else
        {
            int spawnNum = 0;
            foreach (Player p in players)
            {
                p.spawnInd = spawnNum;
                spawnNum   = (spawnNum + 1) % (spawns.Length);
                p.ghost.RpcInitilize();
            }
        }
    }