コード例 #1
0
    public void LaunchEndRound()
    {
        RoundEnd?.Invoke();
        Sequence sequence = DOTween.Sequence();

        sequence.AppendInterval(2);
        sequence.OnComplete(() => RoundStart?.Invoke());
    }
コード例 #2
0
        private IEnumerator GameRoutine()
        {
            _settledBlocks.Clear();
            yield return(null);

            while (true)
            {
                SwitchToNextFaller();
                RoundStart?.Invoke();
                _state = State.Default;
                while (true)
                {
                    var fallInterval = _state == State.Drop ? GameRules.DropFallInterval : GameRules.FallInterval;
                    yield return(new WaitForSeconds(fallInterval));

                    if (CheckFallerDirection(Vector2Int.down))
                    {
                        Faller.Shift(Vector2Int.down);
                    }
                    else
                    {
                        break;
                    }
                }

                _state = State.Fallen;
                foreach (var block in Faller.Blocks)
                {
                    _settledBlocks[block.Location] = block;
                }

                var delay = PerformLineOperations() ? AnimationTimings.ExplodeDelay : AnimationTimings.SettleDelay;

                if (IsGameOver())
                {
                    break;
                }

                yield return(new WaitForSeconds(delay));
            }

            GameOver?.Invoke();
        }
コード例 #3
0
        private void HandleCurrentEvents()
        {
            foreach (BaseEvent baseEvent in currentTick.Events)
            {
                switch (baseEvent.Type)
                {
                case EventType.MatchStarted:
                    MatchStarted?.Invoke(this, baseEvent);
                    break;

                case EventType.RoundAnnounceMatchStarted:

                    break;

                case EventType.RoundStart:
                    RoundStart?.Invoke(this, (RoundStartEvent)baseEvent);
                    break;

                case EventType.RoundEnd:
                    RoundEnd?.Invoke(this, (RoundEndEvent)baseEvent);
                    break;

                case EventType.WinPanelMatch:
                    WinPanelMatch?.Invoke(this, baseEvent);
                    break;

                case EventType.RoundFinal:
                    break;

                case EventType.LastRoundHalf:
                    break;

                case EventType.RoundOfficiallyEnd:
                    RoundOfficiallyEnd?.Invoke(this, baseEvent);
                    break;

                case EventType.RoundMVP:
                    RoundMVP?.Invoke(this, (RoundMVPEvent)baseEvent);
                    break;

                case EventType.FreezetimeEnded:
                    FreezetimeEnded?.Invoke(this, baseEvent);
                    break;

                case EventType.PlayerKilled:
                    PlayerKilled?.Invoke(this, (PlayerKilledEvent)baseEvent);
                    break;

                case EventType.PlayerTeam:
                    PlayerTeam?.Invoke(this, (PlayerTeamEvent)baseEvent);
                    break;

                case EventType.WeaponFired:
                    WeaponFired?.Invoke(this, (WeaponFiredEvent)baseEvent);
                    break;

                case EventType.SmokeNadeStarted:
                    SmokeNadeStarted?.Invoke(this, (SmokeNadeStartedEvent)baseEvent);
                    break;

                case EventType.SmokeNadeEnded:
                    SmokeNadeEnded?.Invoke(this, (SmokeNadeEndedEvent)baseEvent);
                    break;

                case EventType.DecoyNadeStarted:
                    DecoyNadeStarted?.Invoke(this, (DecoyNadeStartedEvent)baseEvent);
                    break;

                case EventType.DecoyNadeEnded:
                    DecoyNadeEnded?.Invoke(this, (DecoyNadeEndedEvent)baseEvent);
                    break;

                case EventType.FireNadeStarted:
                    FireNadeStarted?.Invoke(this, (FireNadeStartedEvent)baseEvent);
                    break;

                case EventType.FireNadeWithOwnerStarted:
                    FireNadeWithOwnerStarted?.Invoke(this, (FireNadeWithOwnerStartedEvent)baseEvent);
                    break;

                case EventType.FireNadeEnded:
                    FireNadeEnded?.Invoke(this, (FireNadeEndedEvent)baseEvent);
                    break;

                case EventType.FlashNadeExploded:
                    FlashNadeExploded?.Invoke(this, (FlashNadeExplodedEvent)baseEvent);
                    break;

                case EventType.ExplosiveNadeExploded:
                    ExplosiveNadeExploded?.Invoke(this, (ExplosiveNadeExplodedEvent)baseEvent);
                    break;

                case EventType.NadeReachedTarget:
                    NadeReachedTarget?.Invoke(this, (NadeReachedTargetEvent)baseEvent);
                    break;

                case EventType.BombBeginPlant:
                    BombBeginPlant?.Invoke(this, (BombBeginPlantEvent)baseEvent);
                    break;

                case EventType.BombAbortPlant:
                    BombAbortPlant?.Invoke(this, (BombAbortPlantEvent)baseEvent);
                    break;

                case EventType.BombPlanted:
                    BombPlanted?.Invoke(this, (BombPlantedEvent)baseEvent);
                    break;

                case EventType.BombDefused:
                    BombDefused?.Invoke(this, (BombDefusedEvent)baseEvent);
                    break;

                case EventType.BombExploded:
                    BombExploded?.Invoke(this, (BombExplodedEvent)baseEvent);
                    break;

                case EventType.BombBeginDefuse:
                    BombBeginDefuse?.Invoke(this, (BombBeginDefuseEvent)baseEvent);
                    break;

                case EventType.BombAbortDefuse:
                    BombAbortDefuse?.Invoke(this, (BombAbortDefuseEvent)baseEvent);
                    break;

                case EventType.PlayerHurt:
                    PlayerHurt?.Invoke(this, (PlayerHurtEvent)baseEvent);
                    break;

                case EventType.Blind:
                    Blind?.Invoke(this, (BlindEvent)baseEvent);
                    break;

                case EventType.PlayerBind:
                    PlayerBind?.Invoke(this, (PlayerBindEvent)baseEvent);
                    break;

                case EventType.PlayerDisconnect:
                    PlayerDisconnect?.Invoke(this, (PlayerDisconnectEvent)baseEvent);
                    break;

                case EventType.SayText:
                    SayText?.Invoke(this, (SayTextEvent)baseEvent);
                    break;

                case EventType.SayText2:
                    SayText2?.Invoke(this, (SayText2Event)baseEvent);
                    break;

                case EventType.PlayerJump:
                    PlayerJump?.Invoke(this, (PlayerJumpEvent)baseEvent);
                    break;

                case EventType.PlayerFootstep:
                    PlayerFootstep?.Invoke(this, (PlayerFootstepEvent)baseEvent);
                    break;

                case EventType.OtherDeath:
                    OtherDeath?.Invoke(this, (OtherDeathEvent)baseEvent);
                    break;

                case EventType.EntitySpawned:
                    EntitySpawned?.Invoke(this, (EntitySpawnedEvent)baseEvent);
                    break;

                case EventType.EntityRemoved:
                    EntityRemoved?.Invoke(this, (EntityRemovedEvent)baseEvent);
                    break;

                default:
                    break;
                }
            }
        }
コード例 #4
0
 public void StartRound()
 {
     RoundStart?.Invoke();
 }