示例#1
0
 void Start()
 {
     if (!isLocalPlayer)
     {
         GetComponent<PlayerMovement>().enabled = false;
         GetComponent<PlayerWeapon>().enabled = false;
     }
     targetPlayer = gameObject.GetComponent<PlayerBase>();
 }
示例#2
0
 IEnumerator SpawnPlayer(PlayerBase player, float time, DeathReason type)
 {
     yield return new WaitForSeconds(time);
     var availablePositions = player.Team == Team.Suicidials ? SuicidialSpawnPoints : RescuerSpawnPoints;
     var length = availablePositions.Count;
     var newPosition = availablePositions[Random.Range(0, length)].position;
     if (type == DeathReason.Net)
     {
         var weapon = GameObject.FindObjectOfType<PlayerWeapon>();
         weapon.CmdSpawnBullet(player.transform.position, new Vector2());
     }
     player.transform.position = newPosition;
     player.GetComponent<PlayerMovement>().alive = true;
 }
示例#3
0
 private void OnPlayerDeath(PlayerBase player, DeathReason type)
 {
     player.GetComponent<PlayerMovement>().alive = false;
     StartCoroutine(SpawnPlayer(player, SpawnTimeInSeconds, type));
 }
示例#4
0
 public void Register(PlayerBase player)
 {
     player.OnDeath += OnPlayerDeath;
 }
示例#5
0
 public void SubscribePlayer(PlayerBase player)
 {
     if (targetPlayer == null)
         targetPlayer = player;
 }
示例#6
0
 private void PlayerOnOnDeath(PlayerBase player, DeathReason type)
 {
     switch (type)
     {
         case DeathReason.TrapSpike:
             PlayDieAnimation(AnimationDeathType.DieSpike);
             break;
         case DeathReason.Net:
             break;
         default:
             throw new ArgumentOutOfRangeException("type");
     }
 }