Ejemplo n.º 1
0
        void Tick(float time)
        {
            FVector rot = this.GetOwner().GetActorScale3D();

            rot.X += 5 * time;
            if (rot.X > 200)
            {
                rot.X = 10;
            }
            this.GetOwner().SetActorScale3D(rot);

            APlayerController pc = UGameplayStatics.GetPlayerController(GetWorld(), 0);

            if (pc != null)
            {
                if (pc.IsInputKeyDown(GetKey("I")))
                {
                    FLinearColor Color = new FLinearColor();
                    Color.A = 1.0f;
                    Color.R = 1.0f;

                    UKismetSystemLibrary.DrawDebugBox(GetWorld(), this.GetOwner().GetTransform().GetLocation(), new FVector(100), Color, this.GetOwner().GetTransform().Rotator(), 0.0f, 0.3f);
                }
            }
        }
Ejemplo n.º 2
0
    public Player(int id, APawn pawn = null, APlayerController playerController = null)
    {
        Id               = id;
        Pawn             = pawn;
        PlayerController = playerController;

        // set playerRefs
        if (Pawn != null)
        {
            Pawn.PlayerRef = this;
        }
        PlayerController.PlayerRef = this;
    }
Ejemplo n.º 3
0
 public static void OnMain()
 {
     if (Utils.IsGameOnDisplay())
     {
         int ss      = Engine.oUWorld;
         int uWorlds = Read <int>(Engine.oUWorld);
         uWorld           = Driver.Read <UWorld>(uWorlds);
         LocalPlayer      = uWorld.OwningGameInstance().LocalPlayer();
         playerController = LocalPlayer.PlayerController();
         cameraManager    = playerController.PlayerCameraManager();
         localPawn        = playerController.AknowledgedPawn();
         actors           = uWorld.CurrentLevel().AActors();
     }
 }
        public void Initialize(Vector2 pos, StructureOfWarrior str, int team, NeuralAI ai, APlayerController pla)
        {
            currentAction = new Actions.IdleAction();
            sprRend       = GetComponent <SpriteRenderer>();

            transform.position = pos;

            playerOwner = pla;

            this.ai       = ai;
            this.team     = team;
            bloodMax      = str.blood;
            speed         = HelperConstants.speedMultOfWa;
            rotationSpeed = HelperConstants.warriorRotationSpeed;
            isShooter     = true;

            positionsDuringSomeTime = new Helpers.Deque <Vector2>(3);//TODO: magic number

            stats = new Statistics();
            //TODO: add limbs

            rigidbody2d = GetComponent <Rigidbody2D>();

            angles = new List <int>();

            #region Calculate angles

            Debug.Assert(raycastSensors % 2 == 1, "amount of sensors is too even");
            var mul = 0;
            for (int i = 0; i < raycastSensors; i++)
            {
                if (i % 2 == 0)
                {
                    angles.Add(90 - diffBetwSensorsInDeg * mul);
                }
                if (i % 2 == 1)
                {
                    mul += 1;
                    angles.Add(90 + diffBetwSensorsInDeg * mul);
                }
            }

            #endregion Calculate angles

            Revive(pos);
        }
Ejemplo n.º 5
0
    /// <summary>
    /// Update Player information
    /// </summary>
    /// <param name="id">change the player Id</param>
    /// <param name="pawn">change the player Pawn</param>
    /// <param name="playerController">change the player PlayerController</param>
    public void UpdatePlayer(int?id, APawn pawn = null, APlayerController playerController = null)
    {
        if (id != null)
        {
            Id = (int)id;
        }

        if (pawn != null)
        {
            Pawn = (APawn)pawn;
        }

        if (playerController != null)
        {
            PlayerController = (APlayerController)playerController;
        }

        if (Pawn != null)
        {
            Pawn.PlayerRef = this;
        }

        PlayerController.PlayerRef = this;
    }
Ejemplo n.º 6
0
 void BeginPlay()
 {
     pc = Cast <APlayerController>(GetOwner());
 }