Пример #1
0
 private void CheckDistanceToPlayers(Collider2D other)
 {
     foreach (var participant in _allParticipants.GetParticipants().ToList())
     {
         float distance = Vector2.Distance(transform.position, participant.gameObject.transform.position);
         distance *= _damageDistance;
         if (distance < _doneDistanceDamage)
         {
             participant.GiveDamage(_damage / (int)(distance + 1));
             ThrowPlayer(participant.gameObject, distance);
         }
     }
 }
Пример #2
0
 public void StartRound()
 {
     _startPanel.SetActive(false);
     _roundState     = RoundState.Start;
     _roundText.text = _roundTime.ToString();
     onChangeState?.Invoke(false);
     if (_roundNumber == _allParticipants.GetParticipants().Count)
     {
         _roundNumber = 0;
     }
     _roundNumber++;
     onRoundStart.Invoke(_roundNumber);
 }
 private void ShowText(int roundNumber)
 {
     foreach (var participant in _allParticipants.GetParticipants())
     {
         if (participant.GetWalkNumber() == roundNumber)
         {
             _activePlayername = participant.gameObject.GetComponentInChildren <Text>().text;
             break;
         }
     }
     _startRoundText.text = "Сейчас ходит : " + _activePlayername;
     StartCoroutine(ShowStartRoundText());
 }
Пример #4
0
    private void Awake()
    {
        _allParticipants = GameObject.FindObjectOfType <AllParticipants>();

        foreach (var participant in _allParticipants.GetParticipants())
        {
            Movement _tempMovement = participant.GetComponent <Movement>();
            if (_tempMovement.IsMyTurn())
            {
                _activeParticipant = participant.gameObject;
                _movement          = _tempMovement;
            }
        }
        _animator = GetComponent <Animator>();
    }