public void OnPlayerGhostDeath(PlayerGhost ghost, PlayerCorpse corpse)
        {
            ((MyRoundLogic)base.Session.RoundLogic).OnPlayerGhostDeath(ghost, corpse);
            if (this.wasFinalKill && base.Session.CurrentLevel.LivingPlayers == 0)
            {
                base.CancelFinalKill();
            }
            else if (base.FFACheckForAllButOneDead())
            {
                int num = -1;

                List <Entity> players = this.Session.CurrentLevel[GameTags.Player];
                for (int i = 0; i < players.Count; i++)
                {
                    Player item = (Player)players[i];
                    if (!item.Dead)
                    {
                        num = item.PlayerIndex;
                        break;
                    }
                }

                base.Session.CurrentLevel.Ending = true;
                if (num != -1 && base.Session.Scores [num] >= base.Session.MatchSettings.GoalScore - 1)
                {
                    this.wasFinalKill = true;
                    base.FinalKill(corpse, num);
                }
            }
        }
예제 #2
0
 public PlayerGhostShield(LevelEntity owner) : base(false, false)
 {
     this.owner  = owner;
     this.sprite = TFGame.SpriteData.GetSpritePartInt("Shield");
     if (owner is PlayerGhost)
     {
         PlayerGhost ghost = owner as PlayerGhost;
         this.sprite.Color = ArcherData.GetColorB(ghost.PlayerIndex, ghost.Allegiance);
         if (ghost.Allegiance != Allegiance.Neutral)
         {
             this.particleType = Particles.TeamDash[(int)ghost.Allegiance];
         }
         else
         {
             this.particleType = Particles.Dash[ghost.PlayerIndex];
         }
     }
     else
     {
         this.sprite.Color = ArcherData.Enemies.ColorB;
         this.particleType = Particles.TeamDash[1];
     }
     this.sprite.Play(0, false);
     base.Add(this.sprite);
     this.sine = new SineWave(120);
     base.Add(this.sine);
 }
예제 #3
0
 void Update()
 {
     if (netID.hasAuthority)
     {
         if (Observers == 0)
         {
             if (Target != null)
             {
                 if (Vector3.Distance(this.transform.position, Target.transform.position) < KillDistance)
                 {
                     Target.CmdKill("Killed by SCP-173");
                     CmdPlayKillSound(Target.transform.position + new Vector3(0f, 1f, 0f));
                     Target = null;
                 }
                 else
                 {
                     _rigidbody.isKinematic = false;
                     LookAt(Target.transform.position);
                     _rigidbody.MovePosition(_rigidbody.position + (transform.forward * MoveSpeed) * Time.fixedDeltaTime);
                 }
             }
         }
         else
         {
             _rigidbody.isKinematic = true;
         }
     }
 }
예제 #4
0
        public override void OnPlayerGhostCollide(PlayerGhost ghost)
        {
            if (!base.Flashing && this.type != Types.Large && this.type != Types.Bottomless)
            {
                if (((MyMatchVariants)Level.Session.MatchSettings.Variants).GhostItems)
                {
                    MyPlayerGhost g = (MyPlayerGhost)ghost;
                    if (this.pickups[0].ToString() == "SpeedBoots" && !g.HasSpeedBoots ||
                        this.pickups[0].ToString() == "Shield" && !g.HasShield ||
                        this.pickups[0].ToString().Contains("Orb"))
                    {
                        this.OpenChest(ghost.PlayerIndex);
                    }
                    else
                    {
                        this.OpenChestForceBomb(ghost.PlayerIndex);
                    }
                }
                else
                {
                    this.OpenChestForceBomb(ghost.PlayerIndex);
                }

                TFGame.PlayerInputs[ghost.PlayerIndex].Rumble(0.5f, 12);
            }
        }
예제 #5
0
    void setTeamUI(bool isTurn)
    {
        if (currentTurn == -1)
        {
            return;
        }
        if (teams.Count <= 1)
        {
            return;
        }

        foreach (uint playerID in teams.Keys)
        {
            if (teams[playerID] == currentTurn)
            {
                PlayerGhost p = NetworkIdentity.spawned[playerID].GetComponent <PlayerGhost>();

                //p.TargetSetTurn(p.netIdentity.connectionToClient, isTurn);
                if (isTurn)
                {
                    pipe.TargetAddViewEvent(p.netIdentity.connectionToClient, new ViewEvent(ViewType.beginTurn, 0, 0, Time.time));
                }
                else
                {
                    pipe.TargetAddViewEvent(p.netIdentity.connectionToClient, new ViewEvent(ViewType.endTurn, 0, 0, Time.time));
                }
            }
        }
    }
예제 #6
0
 public override void OnPlayerGhostCollide(PlayerGhost ghost)
 {
     if (((MyMatchVariants)base.Level.Session.MatchSettings.Variants).GhostJoust)
     {
         if (this.dodging && (base.Allegiance == Allegiance.Neutral || ghost.Allegiance != base.Allegiance))
         {
             Vector2 value = Calc.SafeNormalize(ghost.Position - base.Position);
             if (((MyPlayerGhost)ghost).dodging)
             {
                 if (this.HasSpeedBoots && !((MyPlayerGhost)ghost).HasSpeedBoots)
                 {
                 }
                 else
                 {
                     this.Hurt(-value * 4f, 1, ghost.PlayerIndex, null, null, null);
                 }
             }
             ghost.Hurt(value * 4f, 1, this.PlayerIndex, null, null, null);
         }
         else
         {
             base.OnPlayerGhostCollide(ghost);
         }
     }
     else
     {
         base.OnPlayerGhostCollide(ghost);
     }
 }
예제 #7
0
    void roundEndActions(PlayerGhost p)
    {
        int roundInd = roundCounter - 1;

        if ((roundCounter + 1) % card_rate == 0)
        {
            p.drawCardsOnTurn();
        }
        //if ((roundCounter - 1) % max_cap_rate == 0)
        if (roundInd < maxCapacity.Length && maxCapacity[roundInd])
        {
            p.increaseMaxResources();
        }
        //Debug.Log(roundCounter % resource_rate);
        if (roundCounter % resource_rate == 0)
        {
            p.refreshResources();
        }
        if (roundInd < maxSpendLimit.Length && maxSpendLimit[roundInd])
        {
            p.increaseSpendResources();
        }

        //if ((roundCounter+ max_income_rate/2) % max_income_rate == 0 && roundCounter > max_income_rate/2)
        if (roundInd < maxIncome.Length && maxIncome[roundInd])
        {
            p.increaseIncomeResources();
        }
    }
예제 #8
0
    public void abilityCast(uint ownerID, uint abilID, uint tileID)
    {
        if (!messageCheck(ownerID, abilID, tileID))
        {
            return;
        }
        Ordnance    castAbility = NetworkIdentity.spawned[abilID].GetComponent <Ordnance>();
        PlayerGhost player      = NetworkIdentity.spawned[ownerID].GetComponent <PlayerGhost>();
        Targeting   t           = castAbility.GetComponent <Targeting>();
        Tile        target      = NetworkIdentity.spawned[tileID].GetComponent <Tile>();


        if (
            castAbility &&
            player.getCurrentResources() >= castAbility.resourceCost &&
            castAbility.caster.canCast
            //&& t.evaluate(target, teams[ownerID], castAbility.caster.loc) //Inside cast now
            )
        {
            if (castAbility.castAbil(target, castAbility.getTeam(), castAbility.caster.loc))
            {
                player.spendResources(castAbility.resourceCost);
                pipe.RpcAddViewEvent(new ViewEvent(ViewType.playEffect, abilID, tileID, Time.time));
            }
        }
    }
예제 #9
0
        public override void OnPlayerGhostCollide(PlayerGhost ghost)
        {
            base.Level.Layers[ghost.LayerIndex].Add(new LightFade().Init(this, null));
            base.DoCollectStats(ghost.PlayerIndex);
            switch (this.orbType)
            {
            case OrbTypes.Dark:
                Sounds.pu_darkOrbCollect.Play(base.X, 1f);
                base.Level.OrbLogic.DoDarkOrb();
                base.Level.Particles.Emit(Particles.DarkOrbCollect, 12, base.Position, Vector2.One * 4f);
                break;

            case OrbTypes.Time:
                Sounds.pu_darkOrbCollect.Play(base.X, 1f);
                base.Level.OrbLogic.DoTimeOrb(false);
                base.Level.Particles.Emit(Particles.TimeOrbCollect, 12, base.Position, Vector2.One * 4f);
                break;

            case OrbTypes.Lava:
                Sounds.pu_lava.Play(base.X, 1f);
                base.Level.OrbLogic.DoLavaOrb(ghost.PlayerIndex);
                base.Level.Particles.Emit(Particles.LavaOrbCollect, 12, base.Position, Vector2.One * 4f);
                break;

            case OrbTypes.Space:
                Sounds.pu_spaceOrb.Stop(true);
                Sounds.pu_spaceOrb.Play(210f, 1f);
                base.Level.OrbLogic.DoSpaceOrb();
                base.Level.Particles.Emit(Particles.SpaceOrbCollect, 12, base.Position, Vector2.One * 4f);
                break;
            }
            base.RemoveSelf();
        }
예제 #10
0
        public Actor getGhostTarget(float maxDistSq)
        {
            PlayerGhost result = null;
            float       num    = maxDistSq;

            using (List <Entity> .Enumerator enumerator = base.Level [GameTags.PlayerGhost].GetEnumerator()) {
                while (enumerator.MoveNext())
                {
                    PlayerGhost ghost = (PlayerGhost)enumerator.Current;
                    if (this.CanAttackGhost(ghost))
                    {
                        float num2 = WrapMath.WrapDistanceSquared(this.Position, ghost.Position);
                        if (num2 < num)
                        {
                            num    = num2;
                            result = ghost;
                        }
                    }
                }
            }
            if (result != null)
            {
                targetIsGhost = true;
                ghostTarget   = result;
            }
            return(result);
        }
예제 #11
0
 void Start()
 {
     rb2d       = GetComponent <Rigidbody2D>();
     animator   = GetComponent <Animator>();
     sr         = GetComponent <SpriteRenderer>();
     ghost      = GetComponent <PlayerGhost>();
     levelTimer = FindObjectOfType <LevelTimer>();
 }
예제 #12
0
        public override bool TeamCheckForRoundOver(out Allegiance surviving)
        {
            if (this.Session.CurrentLevel.LivingPlayers == 0)
            {
                surviving = Allegiance.Neutral;
                return(true);
            }
            bool[]        array           = new bool[2];
            bool          gottaBustGhosts = ((MyMatchVariants)(this.Session.MatchSettings.Variants)).GottaBustGhosts;
            List <Entity> players         = this.Session.CurrentLevel[GameTags.Player];

            for (int i = 0; i < players.Count; i++)
            {
                MyPlayer player = (MyPlayer)players[i];
                if (!player.Dead || (gottaBustGhosts && player.spawningGhost))
                {
                    array[(int)player.Allegiance] = true;
                }
            }

            List <Entity> playerCorpses = this.Session.CurrentLevel[GameTags.Corpse];

            for (int i = 0; i < playerCorpses.Count; i++)
            {
                MyPlayerCorpse playerCorpse = (MyPlayerCorpse)playerCorpses[i];
                if (playerCorpse.Revived || (gottaBustGhosts && playerCorpse.spawningGhost))
                {
                    array[(int)playerCorpse.Allegiance] = true;
                }
            }

            if (gottaBustGhosts && players.Count >= 1)
            {
                List <Entity> playerGhosts = this.Session.CurrentLevel[GameTags.PlayerGhost];
                for (int i = 0; i < playerGhosts.Count; i++)
                {
                    PlayerGhost playerGhost = (PlayerGhost)playerGhosts[i];
                    if (playerGhost.State != 3)
                    {                     // Ghost not dead
                        array[(int)playerGhost.Allegiance] = true;
                    }
                }
            }

            if (array[0] == array[1])
            {
                surviving = Allegiance.Neutral;
            }
            else if (array[0])
            {
                surviving = Allegiance.Blue;
            }
            else
            {
                surviving = Allegiance.Red;
            }
            return(!array[0] || !array[1]);
        }
예제 #13
0
    private void SpawnPlayerGhosts()
    {
        Leaderboard leaderboard = LeaderboardManager.instance.GetLeaderboardForCurrentMode();

        int playerScore = GlobalState.instance.playerScore;

        List <LeaderboardEntry> entries =
            leaderboard.LeaderboardEntries
            .Where(x => x.playerDeathSceneName == SceneManager.GetActiveScene().name&&
                   (x.playerScore > playerScore && x.playerScore - playerScore < maximumScoreTolerance))
            .OrderByDescending(x => x.playerScore)
            .ToList();

        int index        = 0;
        int skipCount    = 0;
        int ghostSpawned = 0;

        foreach (LeaderboardEntry entry in entries)
        {
            if (index > 0)
            {
                /// Don't spawn ghosts if they are too close to each other,
                /// Just the player with the highest score.
                if (entries[index - 1].playerDeathPosition.z - entry.playerDeathPosition.z < minimumDistanceBetweenGhosts)
                {
                    skipCount++;
                    continue;
                }
            }

            GameObject  ghost       = Instantiate(playerGhostPrefab, entry.playerDeathPosition, Quaternion.identity);
            PlayerGhost playerGhost = ghost.GetComponent <PlayerGhost>();

            if (playerGhost == null)
            {
                continue;
            }

            playerGhost.playerGhostText.text = entry.playerName + "\n" + entry.playerScore;

            if (skipCount > 0)
            {
                index += skipCount;
            }
            else
            {
                index++;
            }

            skipCount = 0;
            ghostSpawned++;

            if (ghostSpawned >= maximumGhostsPerScene)
            {
                break;
            }
        }
    }
예제 #14
0
파일: Player.cs 프로젝트: lukebandy/Reloop
    // Update is called once per frame
    private void Update()
    {
        if (GameController.main.gameState == GameController.GameState.Play)
        {
            // Change animation
            if (grounded)
            {
                if (Mathf.Abs(inputMove) > 0.1f)
                {
                    ChangeAnimation("Player_Run");
                }
                else
                {
                    ChangeAnimation("Player_Idle");
                }
            }
            else
            {
                if (rb.velocity.y > 0)
                {
                    ChangeAnimation("Player_Jump");
                }
                else
                {
                    ChangeAnimation("Player_Land");
                }
            }

            if (inputMove != 0.0f)
            {
                spriteRenderer.flipX = inputMove < 0.0f;
            }
        }
        else if (GameController.main.gameState == GameController.GameState.Rewind)
        {
            // Spawn ghost
            GameObject  ghost       = Instantiate(prefabGhost, transform.position, Quaternion.identity);
            PlayerGhost ghostScript = ghost.GetComponent <PlayerGhost>();

            ghostScript.movementXSpeed    = movementXSpeed;
            ghostScript.movementJumpForce = movementJumpForce;
            ghostScript.movementJumpTime  = movementJumpTime;
            ghostScript.movementGround    = movementGround;

            ghostScript.movementJumpFeetPos    = movementJumpFeetPos;
            ghostScript.movementJumpFeetRadius = movementJumpFeetRadius;

            ghostScript.historyInputTimestamp    = historyTimestamps;
            ghostScript.historyInputX            = historyInputX;
            ghostScript.historyInputJump         = historyInputJump;
            ghostScript.historyPlaybackTimestamp = historyTimestamps;
            ghostScript.historyPlaybackPosition  = historyPosition;
            ghostScript.historyPlaybackAnimation = historyAnimation;
            ghostScript.historyPlaybackFlip      = historyFlip;

            gameObject.SetActive(false);
        }
    }
예제 #15
0
    void drawSideboards()
    {
        foreach (uint playerID in teams.Keys)
        {
            PlayerGhost p = NetworkIdentity.spawned[playerID].GetComponent <PlayerGhost>();

            p.createStructureSideboard();
        }
    }
예제 #16
0
        //public Player(int id, int spawn, int t)
        //{
        //    conID = id;
        //    spawnInd = spawn;
        //    team = t;

        //}
        public Player(int id, int t, PlayerGhost g)
        {
            conID    = id;
            spawnInd = -1;
            team     = t;
            ghost    = g;
            ready    = false;
            lob      = null;
        }
예제 #17
0
 void drawOpeningHand()
 {
     foreach (uint playerID in teams.Keys)
     {
         PlayerGhost p = NetworkIdentity.spawned[playerID].GetComponent <PlayerGhost>();
         p.initDeck();
         //Debug.Log(team);
         p.drawCards(cardCountOpeningHand);
     }
 }
예제 #18
0
 public void OnPlayerGhostDeath(PlayerGhost ghost, PlayerCorpse corpse)
 {
     if (
         this.miasma &&
         this.FFACheckForAllButOneDead()
         )
     {
         this.miasma.Dissipate();
     }
 }
예제 #19
0
    public void UploadPlayerGhost(PlayerGhost PlayerGhost, Action <bool> callback)
    {
        string URL  = GetURL() + "/requests/upload_player_ghost.php";
        string json = JsonUtility.ToJson(PlayerGhost, true);

        StartCoroutine(SendPOSTRequest(URL, json, (string Result) =>
        {
            UploadPlayerGhostResponse Response = JsonUtility.FromJson <UploadPlayerGhostResponse>(Result);
            callback(Response != null ? Response.success : false);
        }));
    }
예제 #20
0
        public override void Update()
        {
            base.Update();

            if (((MyMatchVariants)this.session.MatchSettings.Variants).GottaBustGhosts)
            {
                if (this.session.MatchSettings.TeamMode)
                {
                    bool[] allegiances = new bool[2];
                    // Check if there are players from one team and ghosts from another
                    List <Entity> players = this.session.CurrentLevel[GameTags.Player];
                    for (int i = 0; i < players.Count; i++)
                    {
                        MyPlayer player = (MyPlayer)players[i];
                        if (!player.Dead)
                        {
                            allegiances [(int)player.Allegiance] = true;
                        }
                    }
                    List <Entity> playerCorpses = this.session.CurrentLevel[GameTags.Corpse];
                    for (int i = 0; i < playerCorpses.Count; i++)
                    {
                        MyPlayerCorpse playerCorpse = (MyPlayerCorpse)playerCorpses[i];
                        if (playerCorpse.Revived)
                        {
                            allegiances [(int)playerCorpse.Allegiance] = true;
                        }
                    }
                    if (allegiances[0] && allegiances[1] || (!allegiances[0] && !allegiances[1]))
                    {
                        // Either both teams still have players, or both teams have no players
                        return;
                    }
                    else
                    {
                        List <Entity> playerGhosts = this.session.CurrentLevel[GameTags.PlayerGhost];
                        for (int i = 0; i < playerGhosts.Count; i++)
                        {
                            PlayerGhost playerGhost = (PlayerGhost)playerGhosts[i];
                            if (playerGhost.State != 3) // Ghost not dead
                            {
                                allegiances [(int)playerGhost.Allegiance] = true;
                            }
                        }
                        if (allegiances[0] && allegiances[1])
                        {
                            // There are ghosts from the opposing team
                            this.ghostWaitCounter = 90f;
                        }
                    }
                }
            }
        }
예제 #21
0
        public IEnumerator ReviveSequence()
        {
            using (List <Entity> .Enumerator enumerator = base.Level [GameTags.PlayerGhost].GetEnumerator()) {
                while (enumerator.MoveNext())
                {
                    PlayerGhost playerGhost = (PlayerGhost)enumerator.Current;
                    if (playerGhost.PlayerIndex == this.Corpse.PlayerIndex)
                    {
                        playerGhost.Despawn(this.Corpse);
                        break;
                    }
                }
            }
            yield return(5);

            Player player = this.FinishReviving();

            if (player == null)
            {
                this.levitateCorpse  = false;
                this.Finished        = false;
                this.reviving        = false;
                this.Corpse.Reviving = false;
                this.Corpse.Revived  = false;
                if (base.Level.Session.MatchSettings.Mode == TowerFall.Modes.DarkWorld)
                {
                    (base.Level.Session.RoundLogic as DarkWorldRoundLogic).CheckForGameOver();
                }
                else if (base.Level.Session.MatchSettings.Mode == TowerFall.Modes.TeamDeathmatch)
                {
                    (base.Level.Session.RoundLogic as TeamDeathmatchRoundLogic).CheckForWin();
                }
            }
            else
            {
                yield return(1);

                base.Level.Remove <PlayerCorpse> (this.Corpse);
                this.targetLightAlpha = 0f;
                yield return(15);

                player.ArcherData.SFX.Revive.Play(base.X, 1f);
                yield return(15);

                if (player != null)
                {
                    player.Unfreeze();
                }
                base.RemoveSelf();
            }
            yield break;
        }
예제 #22
0
 public override void OnPlayerGhostCollide(PlayerGhost ghost)
 {
     if (((MyMatchVariants)Level.Session.MatchSettings.Variants).GhostItems)
     {
         MyPlayerGhost g = (MyPlayerGhost)ghost;
         if (!g.Invisible)
         {
             base.Level.Layers[g.LayerIndex].Add(new LightFade().Init(this, null));
             g.Invisible = true;
             Sounds.pu_invisible.Play(base.X, 1f);
             base.RemoveSelf();
         }
     }
 }
예제 #23
0
    public void UploadPlayerData()
    {
        PlayerGhost PlayerData = new PlayerGhost();

        PlayerData.PlayerName = PlayerName.text;
        PlayerData.LevelName  = SceneManager.GetActiveScene().name;
        PlayerData.Score      = Score;
        PlayerData.Color      = orange.isOn ? "Red" : "Blue";
        PlayerData.Positions  = PlayerPath.Path;

        Backend.UploadPlayerGhost(PlayerData, (bool Success) => {
            //Stuff
        });
    }
예제 #24
0
 public override void OnPlayerGhostCollide(PlayerGhost ghost)
 {
     if (((MyMatchVariants)Level.Session.MatchSettings.Variants).GhostItems)
     {
         MyPlayerGhost g = (MyPlayerGhost)ghost;
         if (!g.HasShield)
         {
             base.Level.Layers[g.LayerIndex].Add(new LightFade().Init(this, null));
             base.DoCollectStats(g.PlayerIndex);
             g.HasShield = true;
             base.RemoveSelf();
         }
     }
 }
예제 #25
0
        public bool CanAttackGhost(PlayerGhost ghost)
        {
            bool result;

            if (this.team != Allegiance.Neutral)
            {
                result = (ghost.Allegiance != this.team);
            }
            else
            {
                result = (ghost.PlayerIndex != this.ownerIndex);
            }
            return(result);
        }
예제 #26
0
    void  OnTriggerExit2D(Collider2D coll)
    {
        if (coll.gameObject.tag == "DisturbingZone")
        {
            var item = coll.gameObject.GetComponentInParent <ItemScript>();

            if (item == null)
            {
                ghost = null;
            }
            else
            {
                itemsCollided.Remove(item);
            }
        }
    }
예제 #27
0
    void OnTriggerEnter2D(Collider2D coll)
    {
        if (coll.gameObject.tag == "DisturbingZone")
        {
            var item = coll.gameObject.GetComponentInParent <ItemScript>();

            if (item == null)
            {
                ghost = coll.gameObject.GetComponentInParent <PlayerGhost>();
            }
            else
            {
                itemsCollided.Add(item);
            }
        }
    }
예제 #28
0
    public void ReceiveColors()
    {
        //Debug.Log("COLORS Received");
        PlayerGhost PG = GetComponent <PlayerGhost>();

        PG.Mats = PG.Model.materials;

        PG.Mats[0].SetColor("_albedo", _skinColor);         //SKIN
        PG.Mats[3].SetColor("_albedo", _skinColor);
        PG.Mats[1].SetColor("_albedo", _pantsColor);        //PANTS
        PG.Mats[2].SetColor("_albedo", _shirtColor);        //SHIRT



        PG.RagdollMats = PG.Ragdoll.materials;

        PG.RagdollMats[0].SetColor("_albedo", _skinColor);         //SKIN
        PG.RagdollMats[3].SetColor("_albedo", _skinColor);
        PG.RagdollMats[1].SetColor("_albedo", _pantsColor);        //PANTS
        PG.RagdollMats[2].SetColor("_albedo", _shirtColor);        //SHIRT


        if (_faceIndex != 4)
        {
            PG.Mats[3].SetTexture("_face", GameServer.GS.GetFace(_faceIndex));        //FACE
            PG.RagdollMats[3].SetTexture("_face", GameServer.GS.GetFace(_faceIndex)); //FACE
        }
        else
        {
            Texture2D customFace          = new Texture2D(32, 32, TextureFormat.Alpha8, false);
            byte[]    CustomFaceDataArray = new byte[_customFaceData.Count];

            for (int i = 0; i < _customFaceData.Count; i++)
            {
                CustomFaceDataArray[i] = _customFaceData[i];
            }

            customFace.LoadImage(CustomFaceDataArray);
            customFace.filterMode = FilterMode.Point;
            customFace.Apply();


            PG.Mats[3].SetTexture("_face", customFace);        //FACE
            PG.RagdollMats[3].SetTexture("_face", customFace); //FACE
        }
    }
예제 #29
0
 void firstTurn()
 {
     currentTurn  = 0;
     roundCounter = 1;
     foreach (uint playerID in teams.Keys)
     {
         PlayerGhost p = NetworkIdentity.spawned[playerID].GetComponent <PlayerGhost>();
         //p.TargetSetTurn(p.netIdentity.connectionToClient, teams[playerID]==currentTurn);
         if (teams[playerID] == currentTurn)
         {
             pipe.TargetAddViewEvent(p.netIdentity.connectionToClient, new ViewEvent(ViewType.beginTurn, 0, 0, Time.time));
         }
         else
         {
             pipe.TargetAddViewEvent(p.netIdentity.connectionToClient, new ViewEvent(ViewType.endTurn, 0, 0, Time.time));
         }
     }
 }
예제 #30
0
    void playerRoundEnd(int team)
    {
        if (team == -1)
        {
            return;
        }

        foreach (uint playerID in teams.Keys)
        {
            //Debug.Log(playerID);
            if (teams[playerID] == team)
            {
                PlayerGhost p = NetworkIdentity.spawned[playerID].GetComponent <PlayerGhost>();
                //Debug.Log(team);
                roundEndActions(p);
            }
        }
    }
예제 #31
0
        public override void OnPlayerDeath(Player player, PlayerCorpse corpse, int playerIndex, DeathCause cause, Vector2 position, int killerIndex)
        {
            base.OnPlayerDeath(player, corpse, playerIndex, cause, position, killerIndex);
            this.Session.CurrentLevel.Add(activeGhosts[playerIndex] = new PlayerGhost(corpse));

            if (killerIndex == playerIndex || killerIndex == -1) {
                if (this.Session.CurrentLevel.LivingPlayers == 0) {
                    var otherPlayers = TFGame.Players.Select((playing, idx) => playing && idx != playerIndex ? (int?)idx : null).Where(idx => idx != null).ToList();
                    var randomPlayer = new Random().Choose(otherPlayers).Value;
                    RemoveGhostAndRespawn(randomPlayer);
                }
            } else {
                RemoveGhostAndRespawn(killerIndex, position);
            }
        }