コード例 #1
0
        private void OnFirePressed()
        {
            var character = GetCharacter();
            var result    = new FHitResult();

            GetWorld().DebugDrawTraceTag = "drag&drop";

            GetWorld().LineTraceSingleByChannel(
                result,
                character.GetCapsuleComponent().GetWorldLocation(),
                character.GetCapsuleComponent().GetWorldLocation() + GetControlRotation().Vector() * DragDropDistance,
                ECollisionChannel.ECC_Visibility,
                new FCollisionQueryParams(GetWorld().DebugDrawTraceTag, true, null),
                new FCollisionResponseParams(ECollisionResponse.ECR_Block)
                );

            _pickUpObject = result.GetActor();
            _dragDistance = result.Distance;

            if (_pickUpObject?.IsRootComponentMovable() == false)
            {
                _pickUpObject = null;
            }

            Ue.ScreenDebugMessage(result.GetActor()?.GetName());
        }
コード例 #2
0
ファイル: MyActor.cs プロジェクト: Xambey/UnrealDotNet
        protected override void BeginPlay()
        {
            try
            {
                PrimaryActorTick.bCanEverTick = 1;

                _box = new UBoxComponent(this, "Simple Child");
                _box.RegisterComponent();

                var root   = GetRootComponent();
                var rootSm = root as UStaticMeshComponent;

                Ue.ScreenDebugMessage(rootSm?.GetFullName() ?? "null");

                _box.AttachToComponent(root, FAttachmentTransformRules.SnapToTargetIncludingScale, "");

                _box.SetCollisionProfileName("OverlapAll");
                _box.SetBoxExtent(new FVector(100, 100, 100), false);

                _box.OnComponentEndOverlap += Box_OnComponentEndOverlap;
            }
            catch (Exception e)
            {
                Ue.LogError(e.ToString());
            }
        }
コード例 #3
0
 public static string MyTestMethod(string arguments)
 {
     try
     {
         Ue.ScreenDebugMessage($"epepeep");
         return($"The string have {arguments.Length} symbols!");
     }
     catch (Exception e)
     {
         return(e.ToString());
     }
 }
コード例 #4
0
        private void OnFire()
        {
            var character = GetCharacter();
            var result    = new FHitResult();

            GetWorld().DebugDrawTraceTag = "test";

            GetWorld().LineTraceSingleByChannel(
                result,
                character.GetCapsuleComponent().GetWorldLocation(),
                character.GetCapsuleComponent().GetWorldLocation() + GetControlRotation().Vector() * 800,
                ECollisionChannel.ECC_Visibility,
                new FCollisionQueryParams("test", true, null),
                new FCollisionResponseParams(ECollisionResponse.ECR_Block)
                );


            Ue.ScreenDebugMessage(result.GetActor()?.GetName(), 20);
            Ue.ScreenDebugMessage(character.GetCapsuleComponent().GetWorldLocation().ToString(), 5, System.Drawing.Color.Red);
        }
コード例 #5
0
        public override void Tick(float deltaSeconds)
        {
            Ue.ScreenDebugMessage(_bodyCount.ToString(), 0, Color.DodgerBlue);
            Ue.ScreenDebugMessage(_time.ToString(), 0, Color.Green);

            if (_isMove)
            {
                AddActorLocalOffset(new FVector(0, 0, deltaSeconds * 100), true, new FHitResult(), ETeleportType.None);
            }
            else
            {
                if (_bodyCount != 0)
                {
                    _time += deltaSeconds;

                    if (_time >= ActivateTime)
                    {
                        _isMove = true;
                    }
                }
            }
        }
コード例 #6
0
 private void Box_OnComponentEndOverlap(UPrimitiveComponent overComp, AActor otherActor, UPrimitiveComponent otherComp, int otherBodyIndex)
 {
     Ue.ScreenDebugMessage($"{otherActor} don't overlap {overComp} now");
 }
コード例 #7
0
ファイル: MyActor.cs プロジェクト: ly774508966/UnrealDotNet
 private void BoxOnOnComponentBeginOverlap(UPrimitiveComponent overComp, AActor otherActor, UPrimitiveComponent otherComp, int otherbodyindex, bool bfromsweep, FHitResult sweepresult)
 {
     Ue.ScreenDebugMessage($"BeginOverlap {otherActor} don't overlap {overComp} now");
 }
コード例 #8
0
 public override void Tick(float deltaSeconds)
 {
     Ue.ScreenDebugMessage(GetCharacter().GetActorLocation().ToString(), 0);
 }