コード例 #1
0
    void Start()
    {
        //Assign static's so scripts can access properties when needed
        StaticWallPrefab     = theWallPrefab;
        StaticPlayerPrefab   = thePlayerPrefab;
        StaticDoorPrefab     = theDoorPrefab;
        StaticLeverPrefab    = theLeverPrefab;
        StaticEnemyPrefab    = theEnemyPrefab;
        StaticPositionPoints = thePosPoints;
        StaticSpikePrefab    = theSpikePrefab;

        EnemySpawned = false;

        //Loop through all the levels, and instantiate the level set by a string matching a script obj level name
        foreach (LevelInformation LvlInfo in theLevelBank)
        {
            if (LvlInfo.name.Equals(theLevelToPlay))
            {
                //Deserialize level
                DeserializeFromScriptObj(LvlInfo);

                //Update temp script obj with level
                theTempLevel         = ScriptableObject.CreateInstance <LevelInformation>();
                theTempLevel.tagList = LvlInfo.tagList;
                theTempLevel.tagGameObjectListJSON = LvlInfo.tagGameObjectListJSON;
                theTempLevel.switcherControlJSON   = LvlInfo.switcherControlJSON;
                theTempLevel.playerStartPosition   = LvlInfo.playerStartPosition;

                //Update ui buttons to map to player
                theSaveWorldButton.GetComponent <Button>().onClick.AddListener(CallSaveWorld);
                theLoadWorldButton.GetComponent <Button>().onClick.AddListener(CallLoadWorld);
                theSavePositionButton.GetComponent <Button>().onClick.AddListener(CallSavePosition);
                theLoadPositionButton.GetComponent <Button>().onClick.AddListener(CallLoadPosition);

                break;
            }
        }
    }
コード例 #2
0
 public void ResetStats(bool resetTeams = true)
 {
     DispatcherHelper.CheckBeginInvokeOnUI(delegate
     {
         AverageHealthDamage   = 0;
         AverageHltvRating     = 0;
         AverageEseaRws        = 0;
         AssistPerRound        = 0;
         DeathPerRound         = 0;
         KillPerRound          = 0;
         DamageHealthCount     = 0;
         DamageArmorCount      = 0;
         MvpCount              = 0;
         KillCount             = 0;
         KnifeKillCount        = 0;
         TeamKillCount         = 0;
         HeadshotCount         = 0;
         AssistCount           = 0;
         DeathCount            = 0;
         SmokeThrownCount      = 0;
         FlashbangThrownCount  = 0;
         HeadshotCount         = 0;
         DecoyThrownCount      = 0;
         MolotovThrownCount    = 0;
         IncendiaryThrownCount = 0;
         HitCount              = 0;
         WeaponFiredCount      = 0;
         AssistPerRound        = 0;
         DeathPerRound         = 0;
         OneKillCount          = 0;
         TwoKillCount          = 0;
         ThreeKillCount        = 0;
         FourKillCount         = 0;
         FiveKillCount         = 0;
         ScoreTeam1            = 0;
         ScoreTeam2            = 0;
         ScoreFirstHalfTeam1   = 0;
         ScoreFirstHalfTeam2   = 0;
         ScoreSecondHalfTeam1  = 0;
         ScoreSecondHalfTeam2  = 0;
         Rounds.Clear();
         WeaponFired.Clear();
         Kills.Clear();
         Overtimes.Clear();
         PositionPoints.Clear();
         MolotovsFireStarted.Clear();
         DecoyStarted.Clear();
         BombPlanted.Clear();
         BombDefused.Clear();
         BombExploded.Clear();
         BombPlanted.Clear();
         BombDefused.Clear();
         BombExploded.Clear();
         ClutchCount           = 0;
         ClutchLostCount       = 0;
         ClutchWonCount        = 0;
         EntryKillCount        = 0;
         MostBombPlantedPlayer = null;
         MostEntryKillPlayer   = null;
         MostHeadshotPlayer    = null;
         MostKillingWeapon     = null;
         HasCheater            = false;
         PlayersHurted.Clear();
         PlayerBlinded.Clear();
         Winner    = null;
         Surrender = null;
         if (resetTeams)
         {
             Players.Clear();
             TeamCT.Clear();
             TeamT.Clear();
         }
         else
         {
             foreach (Player playerExtended in Players)
             {
                 playerExtended.ResetStats();
             }
         }
     });
 }