Пример #1
0
 private void ChargeReleased()
 {
     if (stateManager.IsInState(State.ChargeDash))
     {
         stateManager.AttemptDash(() => StartDash(chargeAmount), StopDash);
     }
 }
Пример #2
0
    private void StartTimer()
    {
        bool shootTimerRunning   = shootTimer != null;
        bool alreadyChargingShot = chargeShot != null;

        if (shootTimerRunning || alreadyChargingShot ||
            !stateManager.IsInState(State.Posession))
        {
            return;
        }
        shootTimer = StartCoroutine(ShootTimer());
    }
Пример #3
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (stateManager != null && stateManager.IsInState(State.Dash))
     {
         HandleCollision(other.gameObject);
     }
 }
Пример #4
0
 private void WallEnd()
 {
     if (stateManager.IsInState(State.LayTronWall))
     {
         if (layWallCoroutine != null)
         {
             StopCoroutine(layWallCoroutine);
         }
         layWallCoroutine = null;
         PlaceCurrentWall();
         stateManager.CurrentStateHasFinished();
     }
 }
    private void OnCollisionStay2D(Collision2D collision)
    {
        Player player = collision.gameObject.GetComponent <Player>();

        if (player != null && team != null && player.team != team)
        {
            PlayerStateManager stateManager = player.GetComponent <PlayerStateManager>();
            if (stateManager != null)
            {
                if (mustDashToSwitch && !stateManager.IsInState(State.Dash))
                {
                    // Only switch if dashing
                    return;
                }
            }
            if (player.team != team && team.teamMembers.Count < maxOnTeam)
            {
                player.SetTeam(team);
                AudioManager.instance.Ching.Play();
                SpawnHitEffect(player.transform.position);
            }
        }
    }