예제 #1
0
    private void AttackPlayer(PlayerUnitController player)
    {
        PlayerVulnerability vulnerability = player.di.vulnerability;
        Vector2             lookVector    = new Vector2(physics.flip.Direction.ToFloat(), 1);

        if (vulnerability.IsGuardingInOpposingDirection(physics.flip.Direction))
        {
            float recoilTileForce;
            if (IsFullAssembly(player))
            {
                stateMachine.attack.StartStagger();
                recoilTileForce = data.guardFullAssemblyRecoilTileForce;
                // TODO: short stagger?
            }
            else
            {
                recoilTileForce = data.guardPartialAssemblyRecoilTileForce;
                Vector2 playerRecoil = RecoilHelpers.GetRecoilFromTo(player.transform, controller.transform, recoilTileForce);
                player.di.stateMachine.SetRecoilState(playerRecoil);
            }
        }
        else if (vulnerability.IsVulnerable())
        {
            PlayerDamageModule damage          = player.di.damage;
            Vector2            collisionRecoil = RecoilHelpers.GetRecoilNormalFromTo(player.transform, controller.transform);
            if (IsFullAssembly(player))
            {
                damage.TakeDamage(data.attackDamage, TileHelpers.TileToWorld(data.attackFullAssemblyRecoilTileForce) * collisionRecoil);
            }
            else
            {
                damage.TakeDamage(data.attackDamage, TileHelpers.TileToWorld(data.attackPartialAssemblyRecoilTileForce) * collisionRecoil);
            }
        }
    }
예제 #2
0
 protected override void OnGuarded(PlayerUnitController player)
 {
     controller.fsm.hit.Direction = RecoilHelpers.GetRecoilNormalFromTo(controller.transform, player.transform);
     controller.fsm.PlayHit();
 }