Beispiel #1
0
 void Start()
 {
     if (!isLocalPlayer)
     {
         GetComponent<PlayerMovement>().enabled = false;
         GetComponent<PlayerWeapon>().enabled = false;
     }
     targetPlayer = gameObject.GetComponent<PlayerBase>();
 }
Beispiel #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;
 }
Beispiel #3
0
 private void OnPlayerDeath(PlayerBase player, DeathReason type)
 {
     player.GetComponent<PlayerMovement>().alive = false;
     StartCoroutine(SpawnPlayer(player, SpawnTimeInSeconds, type));
 }
Beispiel #4
0
 public void Register(PlayerBase player)
 {
     player.OnDeath += OnPlayerDeath;
 }
Beispiel #5
0
 public void SubscribePlayer(PlayerBase player)
 {
     if (targetPlayer == null)
         targetPlayer = player;
 }
 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");
     }
 }