Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (moving)
        {
            switch (sweepState)
            {
            case SweepState.normal:
                if (PlayerDistance() <= sweepDistance && !CheckForWalls())
                {
                    // Change state and initialize going the correct angle if close enough
                    sweepState = SweepState.isSweeping;
                    moveAngle  = PlayerAngle();
                }
                MoveTowards();
                break;

            case SweepState.isSweeping:
                if (PlayerDistance() > sweepDistance || CheckForWalls())
                {
                    sweepState = SweepState.normal;
                }
                // Move in the direction of moveAngle, then try to make the angle go more towards the player
                myBase.myRigid.velocity = moveAngle * myBase.myStats.movementSpeed;

                if (PlayerAngle() != Vector3.zero)
                {
                    moveAngle = Vector3.RotateTowards(moveAngle, PlayerAngle(), angleChange * Time.deltaTime, 0.0f);
                    moveAngle.Normalize();
                }
                break;
            }
        }
    }
Example #2
0
 public override void SetSpecial(CharacterState _character)
 {
     m_state = SweepState.Startup;
     _character.Hitboxes.Add(_character.CreateHitbox(GameplayEnums.HitboxType.Hurtbox_Limb, HURTBOX_STARTUP));
     _character.SetCharacterHurtboxStanding(_character.Hitboxes);
     _character.DisableThrowBreak = true;
     _character.AttackConnected   = false;
 }
Example #3
0
    public override MatchOutcome UpdateSpecial(CharacterState _character, ref int _positionOffset)
    {
        switch (State)
        {
        case SweepState.Active:
            if (_character.StateFrames > ACTIVE)
            {
                m_state = SweepState.Recovery;
                _character.StateFrames = 0;
                _character.Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hitbox_Attack);
                _character.ModifyHitbox(_character.Hitboxes, HURTBOX_WHIFF_EARLY);

                _character.DisableThrowBreak = false;
            }
            break;

        case SweepState.Recovery:
            if (_character.StateFrames > RECOVERY)
            {
                m_state                = SweepState.Inactive;
                _character.State       = GameplayEnums.CharacterState.Idle;
                _character.StateFrames = 0;
                _character.Hitboxes.RemoveAll(o => o.HitboxType == GameplayEnums.HitboxType.Hurtbox_Limb);
            }
            if (_character.StateFrames == ATTACK_RECOVERY_SHORTEN)
            {
                _character.ModifyHitbox(_character.Hitboxes, HURTBOX_WHIFF_LATE);
            }
            break;

        case SweepState.Startup:
            if (_character.StateFrames > STARTUP)
            {
                m_state = SweepState.Active;
                _character.StateFrames = 0;
                Hitbox_Gameplay hbox = _character.CreateHitbox(GameplayEnums.HitboxType.Hitbox_Attack, HITBOX_ACTIVE);
                hbox.AttackAttribute = GameplayEnums.AttackAttribute.Low;
                _character.Hitboxes.Add(hbox);
                _character.ModifyHitbox(_character.Hitboxes, HURTBOX_ACTIVE);
            }
            break;
        }

        return(new MatchOutcome());
    }
Example #4
0
 /// <summary>
 /// Stops the sweep loop
 /// </summary>
 public void StopSweepLoop()
 {
     lock (_sweepLoopLock)
     {
         if (SweepState == SweepState.Started)
         {
             if (_sweepTimer != null)
             {
                 //Shutdown background thread
                 _sweepTimer.Dispose();
             }
             SweepState = SweepState.Stopped;
         }
         AdminMessage("Sweep loop " + SweepState.ToString().ToLower());
     }
 }
Example #5
0
 /// <summary>
 /// Starts the sweep loop
 /// </summary>
 public void StartSweepLoop()
 {
     lock (_sweepLoopLock)
     {
         if (SweepState != SweepState.Started)
         {
             //Spin up a new background thread with game loop
             _sweepTimer = new Timer(UpdateSweepLoop, null, TimeSpan.FromMilliseconds(_engine.SweepLoopInterval), TimeSpan.FromMilliseconds(_engine.SweepLoopInterval));
             SweepState = SweepState.Started;
         }
         AdminMessage("Sweep loop " + SweepState.ToString().ToLower());
     }
 }
Example #6
0
 public override void SetState(int newState)
 {
     this.sweepState = (SweepState)newState;
 }
Example #7
0
 public override void Initialize()
 {
     m_state = SweepState.Inactive;
 }