Beispiel #1
0
        /// <summary>
        /// Creates particles when deleted
        /// </summary>
        private void Death()
        {
            if (splash)
            {
                int maxParts = 8;
                int minParts = 4;

                if (shotType == 3)
                {
                    maxParts = 2; minParts = 1;
                }

                for (int i = 0; i <= GM.r.FloatBetween(minParts, maxParts); i++)
                {
                    float          spawnRot = RotationAngle + GM.r.FloatBetween(-15, 15);
                    Vector3        spawnVel = RotationHelper.Direction3DFromAngle(spawnRot, 0) * 200;
                    FadingParticle splash   = new FadingParticle(Position2D, spawnVel, spawnRot, 0.25f);
                    splash.Wash = Color.Aqua;
                    splash.SX   = 1f;
                    splash.SY   = 5f;
                }

                for (int i = 0; i <= GM.r.FloatBetween(0, 5); i++)
                {
                    float          spawnRot = -RotationAngle + GM.r.FloatBetween(-20, 20);
                    Vector3        spawnVel = RotationHelper.Direction3DFromAngle(spawnRot, 0) * -10;
                    FadingParticle splash   = new FadingParticle(Position2D, spawnVel, spawnRot, 0.1f);
                    splash.Wash = Color.Aqua;
                    splash.SX   = 1f;
                    splash.SY   = 2.5f;
                }
            }
        }
Beispiel #2
0
        private void UpdateWallCaps()
        {
            if (wallCapPrefab == null)
            {
                return;
            }

            // Go through each direction and ensure the wallcap is present.
            for (Direction direction = Direction.North; direction < Direction.NorthWest; direction += 2)
            {
                int i = (int)direction / 2;

                // Get the direction this applies to for the external world
                Direction outsideDirection = DirectionHelper.Apply(RotationHelper.ToPerpendicularDirection(TileState.rotation), direction);
                bool      isPresent        = adjacents.Adjacent(outsideDirection) == 1;

                if (isPresent && wallCaps[i] == null)
                {
                    wallCaps[i]      = SpawnWallCap(direction);
                    wallCaps[i].name = $"WallCap{i}";
                }
                else if (!isPresent && wallCaps[i] != null)
                {
                    EditorAndRuntime.Destroy(wallCaps[i]);
                    wallCaps[i] = null;
                }
            }
        }
Beispiel #3
0
        public void Write(IPacketWriter writer)
        {
            writer.WriteVarInt(Entity.Id);
            writer.WriteGuid(Entity.Guid);
            writer.WriteVarInt(Entity.TypeId);
            writer.WriteDouble(Entity.Position.X);
            writer.WriteDouble(Entity.Position.Y);
            writer.WriteDouble(Entity.Position.Z);

            var rotation = RotationHelper.FromLookAt(Entity.LookDir);
            var pitch    = rotation.X;
            var yaw      = rotation.Y;

            writer.WriteUInt8(RotationHelper.RadiansTo256Angle(pitch));
            writer.WriteUInt8(RotationHelper.RadiansTo256Angle(yaw));

            writer.WriteInt32(1);
            writer.WriteInt16(0);
            writer.WriteInt16(0);
            writer.WriteInt16(0);

            /*writer.WriteInt16((short)MathF.Round(Entity.Velocity.X / 8000));
            *  writer.WriteInt16((short)MathF.Round(Entity.Velocity.Y / 8000));
            *  writer.WriteInt16((short)MathF.Round(Entity.Velocity.Z / 8000));*/
        }
        public void RotateCounterClockwise()
        {
            var expectedValue = CompassDirection.East;
            var result        = RotationHelper.Rotate(CompassDirection.South, RotationDirection.CounterClockwise);

            Assert.Equal(expectedValue, result);
        }
Beispiel #5
0
        public override void Draw()
        {
            Location = theObjectGame.Location;
//            Orientation = Quaternion.FromRotationMatrix(Matrix4.CreateFromAxisAngle(Vector3.Up,
//                    -theObjectTurret.Orientation.Angle));
            Orientation = RotationHelper.ReverseQuaternion(RotationHelper.GetQuaternionFromDiretion(theObjectTurret.Orientation));
//
//            Orientation = Quaternion.FromRotationMatrix(Matrix4.CreateFromAxisAngle(Vector3.Up,
//                theObjectTurret.Orientation.CalculateAngle(Vector3.Forward)));

            if (modelMatrixOld)
            {
                UpdateModelMatrix();
            }
            defaultProgram["model_matrix"].SetValue(modelMatrix);
            objTurretBase.Draw();
//            Matrix4 towerModelMatrix = (RotationHelper.ReverseQuaternion(RotationHelper.GetQuaternionFromDiretion(-theObjectTurret.OrientationTower))).Matrix4 * modelMatrix;
//            Matrix4 towerModelMatrix = theObjectTurret.OrientQuaternion.Matrix4 * modelMatrix;
//            Matrix4 towerModelMatrix = Matrix4.CreateFromAxisAngle(Vector3.Up, theObjectTurret.OrientationTower.CalculateAngle(Vector3.Forward)) * modelMatrix;
//            Matrix4 towerModelMatrix = Matrix4.CreateFromAxisAngle(Vector3.Up, theObjectTurret.OrientationTower.CalculateAngle(Vector3.Forward)) * modelMatrix;
//            Matrix4 towerModelMatrix = Matrix4.CreateRotationY(theObjectTurret.OrientationTower) * modelMatrix;
            Matrix4 towerModelMatrix = Matrix4.CreateRotationY(theObjectTurret.OrientationTower) * modelMatrix;

            defaultProgram["model_matrix"].SetValue(towerModelMatrix);
            objTurretTower.Draw();
        }
Beispiel #6
0
        /// <summary>
        /// Constructor for missile
        /// </summary>
        /// <param name="spawnPos">Start position</param>
        /// <param name="initialAim">Position missile is initally aimed at</param>
        /// <param name="ownerSprite">Sprite that fired this missile</param>
        /// <param name="targetSprite">Target for missile</param>
        /// <param name="missileSpeed">Velocity of missile</param>
        /// <param name="maxTurn">Maximum turning angle for missile</param>
        /// <param name="lifetime">How many seconds this missile lives for</param>
        /// <param name="missileDamage">Damage on impact</param>
        public Missile(Vector2 spawnPos, Vector2 initialAim, Sprite ownerSprite, Sprite targetSprite, float missileSpeed, float maxTurn, float lifetime, int missileDamage)
        {
            //Assigning variables
            owner      = ownerSprite;
            target     = targetSprite;
            damage     = missileDamage;
            turnAmount = maxTurn;
            speed      = missileSpeed;

            //Events
            GM.eventM.AddTimer(tiLifetimeCounter = new Event(lifetime, "Lifetime Counter"));
            GM.eventM.AddTimer(tiSmokeCounter    = new Event(0.5f, "Smoke Counter"));

            //Graphics
            GM.engineM.AddSprite(this);
            Frame.Define(Tex.SingleWhitePixel);
            Wash = Color.OrangeRed;
            SX   = 8;
            SY   = 32;

            //Sound effect


            Moving           = true;
            CollisionActive  = true;
            CollisionPrimary = true;

            UpdateCallBack   += Move;
            PrologueCallBack += Hit;

            RotationHelper.FacePosition(this, new Vector3(initialAim, 0), DirectionAccuracy.free, 0, false);

            Position2D = spawnPos;
        }
Beispiel #7
0
        /// <summary>
        /// Code to run each tick
        /// </summary>
        private void Tick()
        {
            offsetVector  = RotationHelper.Direction2DFromAngle(offsetAngle, owner.RotationAngle);
            offsetVector  = offsetVector * offsetMagnitude;
            Position2D    = owner.Position2D + offsetVector;
            RotationAngle = owner.RotationAngle;

            if (IsParent)
            {
                if (health < 0)
                {
                    health = 0;
                }
            }

            //Burn damage
            if (isParent && isBurning && GM.eventM.Elapsed(tiBurnTick))
            {
                health--;
                for (int i = 0; i < GM.r.FloatBetween(1, 2); i++)
                {
                    FadingParticle smokeParticle = new FadingParticle(new Vector2(Centre2D.X + GM.r.FloatBetween(-2, 2), Centre2D.Y + GM.r.FloatBetween(-2, 2)),
                                                                      new Vector3(GM.r.FloatBetween(-4, 4), GM.r.FloatBetween(-4, 4), 0),
                                                                      GM.r.FloatBetween(0, 360), GM.r.FloatBetween(5, 10));
                    smokeParticle.Wash = Color.DarkSlateGray;
                }
                if (GM.r.FloatBetween(0, 1) > 0.90)
                {
                    Ship ship = (Ship)owner;
                    ship.CrewNum -= 1;
                }
            }
        }
Beispiel #8
0
        /// <summary>
        /// Initializes mouse behaviour.
        /// </summary>
        private void InitializeMouseEvents()
        {
            // Initialize mouse down behaviour.
            MouseDown += (sender, e) => {
                _mouseIsDown = true;
            };

            // Initialize mouse up behaviour.
            MouseUp += (sender, e) => {
                _mouseIsDown = false;
            };

            // Initialize mouse move behaviour.
            MouseMove += (sender, e) => {
                int dx = e.X - _mouseLocation.X;
                int dy = e.Y - _mouseLocation.Y;
                _mouseLocation = e.Location;

                if (_mouseIsDown)
                {
                    RotationHelper.MouseDrag(_world.Rotate, dx, dy);
                }
            };

            // Initialize mouse wheel behaviour.
            MouseWheel += (sender, e) => {
                _world.MoveCamera(e.Delta);;
            };
        }
Beispiel #9
0
        public void TrackballTrack(double trackX, double trackY)
        {
            if (!IsTrackBallMode)
            {
                return;
            }

            var xDegrees = trackX * TRACKBALL_SPEED;
            var yDegrees = trackY * TRACKBALL_SPEED;

            var tempRightDirection = Vector3D.CrossProduct(LookDirection, UpDirection).Normalized();
            var tempUpDirection    = UpDirection;
            var tempPosition       = (Vector3D)Position;

            // perform rotation of xDegrees around "up" axis
            tempPosition       = RotationHelper.RotateVector(tempPosition, tempUpDirection, xDegrees);
            tempRightDirection = RotationHelper.RotateVector(tempRightDirection, tempUpDirection, xDegrees);

            // perform rotation of yDegrees around left/right axis
            tempPosition    = RotationHelper.RotateVector(tempPosition, tempRightDirection, yDegrees);
            tempUpDirection = RotationHelper.RotateVector(tempUpDirection, tempRightDirection, yDegrees);

            UpDirection   = tempUpDirection;
            Position      = (Point3D)tempPosition;
            LookDirection = -tempPosition.Normalized();
        }
 public static void RandomlyRotateTiles(List <Tile> tiles)
 {
     foreach (var tile in tiles)
     {
         tile.rotation = RotationHelper.GetRandom90DegreeRotation();
     }
 }
Beispiel #11
0
        /// <summary>
        /// Initializes mouse behaviour.
        /// </summary>
        private void InitializeMouseEvents()
        {
            // Initialize mouse down behaviour.
            MouseDown += (sender, e) => {
                _previousMouseLocation = e.Location;
                _drag = true;

                _model.StopCamera();
            };

            // Initialize mouse up behaviour.
            MouseUp += (sender, e) => {
                _drag = false;
            };

            // Initialize mouse move behaviour.
            MouseMove += (sender, e) => {
                int dx = e.X - _previousMouseLocation.X;
                int dy = e.Y - _previousMouseLocation.Y;

                if (_drag)
                {
                    RotationHelper.MouseDrag(_model.Rotate, dx, dy);
                }

                _previousMouseLocation = e.Location;
            };

            // Initialize mouse wheel behaviour.
            MouseWheel += (sender, e) => {
                _model.MoveCamera(e.Delta);;
            };
        }
Beispiel #12
0
        private void Move()
        {
            //Trailing smoke particles
            if (tiLifetimeCounter.ElapsedSoFar > 0.5 - GM.r.FloatBetween(0.1f, 0.3f))
            {
                Vector2 offset = new Vector2(20 * RotationHelper.MyDirection(this, 180).X, 20 * RotationHelper.MyDirection(this, 180).Y);
                new SmokeParticle(Position2D + offset, Vector3.Zero, Vector2.Zero, 0.2f);
                GM.eventM.AddTimer(tiSmokeCounter = new Event(0.5f, "Smoke Counter"));
            }

            if (target.Dead)
            {
                RotationHelper.VelocityInCurrentDirection(this, speed, 0);
            }
            else
            {
                //turnDir = -1, anticlockwise; 0, none; 1, clockwise
                int turnDir = (int)RotationHelper.AngularDirectionTo(this, target.Position, 0, false);

                //Direction to add velocity to, additional angle is 90 * turnDir so -90 for anticlockwise, 90 for clockwise, straight ahead for none
                Vector3 velDir = RotationHelper.MyDirection(this, 90 * turnDir);

                Velocity  = RotationHelper.MyDirection(this, 0) * speed;
                Velocity += velDir * (turnAmount / 5);
                RotationHelper.FaceVelocity(this, DirectionAccuracy.free, false, 0);
            }
        }
        public void Tick(TickContext context)
        {
            if (!_playerShip.GetNodes().Any())
            {
                return;
            }
            var displacement = (_playerShip.GetNodes().First().GloalLocation - _transform.Location);
            var rotation     = -RotationHelper.GetAngle(displacement.X, displacement.Z) - (float)Math.PI / 2 + aimOffset;
            var rotVel       = 0f;

            if (_flightShip.Rotation > rotation + RotationRate)
            {
                rotVel -= 0.01f;
            }
            else if (_flightShip.Rotation < rotation - 0.01f)
            {
                rotVel = 0.01f;
            }
            _flightShip.Update(() =>
            {
                _flightShip.RotationalSpeed = rotVel;
                if (rotVel == 0)
                {
                    _flightShip.Rotation = rotation;
                }
            });
        }
Beispiel #14
0
    void Update()
    {
        if (player == null)
        {
            Transform playerObject = GameObject.FindGameObjectWithTag("Player").transform;
            if (playerObject == null)
            {
                return;
            }

            player = playerObject.GetComponent <Player>();
        }

        transform.position = player.GetPosition();
        var enemyLocator = serviceLocator.GetEnemyLocator();
        var nearestEnemy = enemyLocator.GetNearestEnemyFromTheEntity(player);

        if (nearestEnemy == null)
        {
            return;
        }

        var angleToNearestEnemy = RotationHelper.GetAngleFromToTarget(player.GetPosition(), nearestEnemy.GetPosition());
        var newAngle            = Mathf.Lerp(transform.rotation.eulerAngles.z, angleToNearestEnemy, 0.5f);

        transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, newAngle);
    }
Beispiel #15
0
 public override void Move(float deltaTime)
 {
     if (TheUserInputPlayer.Forward)
     {
         Location += Orientation * moveSpeed;
     }
     else if (TheUserInputPlayer.Backward)
     {
         Location -= Orientation * moveSpeed;
     }
     if (TheUserInputPlayer.Right)
     {
         Location += RotationHelper.PerpendicularInXZ(Orientation) * moveSpeed;
     }
     else if (TheUserInputPlayer.Left)
     {
         Location -= RotationHelper.PerpendicularInXZ(Orientation) * moveSpeed;
     }
     if (!TheUserInputPlayer.MousePosition.IsEmpty)
     {
         Vector3 gameMousePos   = new Vector3(TheUserInputPlayer.MousePosition.X, 0.0f, TheUserInputPlayer.MousePosition.Y);
         Vector3 playerMouseVec = gameMousePos - Location;
         playerMouseVec.Normalize();
         Orientation = playerMouseVec;
     }
 }
Beispiel #16
0
    // Token: 0x06000A91 RID: 2705 RVA: 0x0002D700 File Offset: 0x0002BB00
    public static float getFaceToRotation(Vector2 StartDir, Vector2 EndDir)
    {
        float degreeFromZero  = RotationHelper.getDegreeFromZero(StartDir);
        float degreeFromZero2 = RotationHelper.getDegreeFromZero(EndDir);

        return(degreeFromZero2 - degreeFromZero);
    }
        public override void Execute()
        {
            CardinalDirections direction = Direction.GetCardinalDirection(this.Unit.GetPosition(), this.Target);
            Vector3            point     = PointConverter.ToVector(Direction.GetDirection(direction));

            Destroy(Instantiate(lasserVFX, this.transform.position, RotationHelper.GetRotation(direction)), delay);
            StartCoroutine(Attack(direction, point));
        }
Beispiel #18
0
        private void Move()
        {
            //Do this for first 0.5 seconds of life
            if (tiBirth.ElapsedSoFar < 0.5)
            {
                RotationHelper.VelocityInThisDirection(this, direction, 500);
            }
            //Then do this
            else
            {
                RotationVelocity = 45f;
            }

            //For shooting
            //Every 5 seconds
            if (tiBirth.ElapsedSoFar > 2.5)
            {
                if (GM.eventM.Elapsed(tiShootCooldown))
                {
                    Vector3 front3d  = Position + RotationHelper.MyDirection(this, 0);
                    Vector3 bottom3d = Position + RotationHelper.MyDirection(this, 180);
                    Vector2 front    = new Vector2(front3d.X, front3d.Y);
                    Vector2 bottom   = new Vector2(bottom3d.X, bottom3d.Y);


                    new Missile(Position2D, front, this, GameSetup.PlayerChar, 500, 500, 20, 20);
                    new Missile(Position2D, bottom, this, GameSetup.PlayerChar, 500, 500, 20, 20);
                    new Bullet(this, bottom, 1500f, 2);
                }
            }

            //Every 10 seconds
            if (tiBirth.ElapsedSoFar >= 10)
            {
                GM.eventM.AddEventRaiseOnce(tiBirth = new Event(10f, "Birth timer"));

                direction = Vector3.Zero;

                if (Position.X <= GM.screenSize.Center.X)
                {
                    direction.X += 1;
                }
                else
                {
                    direction.X -= 1;
                }
                if (Position.Y <= GM.screenSize.Center.Y)
                {
                    direction.Y += 1;
                }
                else
                {
                    direction.Y -= 1;
                }
                direction.Normalize();
            }
        }
Beispiel #19
0
        public override void CancelAction(SpriteObject spriteObject, PlayerActions playerAction)
        {
            base.CancelAction(spriteObject, playerAction);
            var dynamicSpriteObject = (DynamicSpriteObject)spriteObject;

            var dir = RotationHelper.PlayerActionToDirection(playerAction);

            dynamicSpriteObject.StartBump(dir.ToVector2());
        }
Beispiel #20
0
        private void PlayParticles(Point target)
        {
            Quaternion direction = RotationHelper.GetRotation(cardinalDirectionToRotate);

            Unit.FlipUnit(cardinalDirection);
            SkillActionFX?.Play(this.Unit.transform.position);
            SkillActionFX.UpdateParticlesRotation(direction);
            pukeSFx?.Play(this.transform.position);
        }
Beispiel #21
0
        private void SpawnSplit(CardinalDirections direction, Vector3 otherPosition)
        {
            Vector3 position = otherPosition + PointConverter.ToVector(Direction.GetDirection(direction));

            Quaternion     rotation = RotationHelper.GetRotation(direction);
            HoloBlastSplit bullet   = Instantiate(this.blast, position, rotation);

            Logcat.I($"Other position {otherPosition} Splitted bullet {position} rotation {rotation}");
            bullet.SetUp(boardController, unitsMap, this.secondAttackDamage, secondKnockback, new Point((int)otherPosition.x, 0, (int)otherPosition.z));
        }
Beispiel #22
0
 /// <summary>
 /// Code to run each tick.
 /// </summary>
 private void Tick()
 {
     SY            = Vector2.Distance(origin.Position2D, target.Position2D);
     RotationAngle = RotationHelper.AngleFromDirection(Vector2.Normalize(target.Position2D - origin.Position2D));
     Position2D    = origin.Position2D - ((origin.Position2D - target.Position2D) * 0.5f);
     if (!(GameSetup.Player.isBoarded || GameSetup.Player.isBoarding))
     {
         Kill();
     }
 }
Beispiel #23
0
        public override void Draw()
        {
            Location = theObjectGame.Location;
//            Orientation = RotationHelper.GetQuaternionFromDiretion(theObjectPlayer.Orientation);
            Orientation = RotationHelper.ReverseQuaternion(RotationHelper.GetQuaternionFromDiretion(theObjectPlayer.Orientation));
//            Orientation = Quaternion.FromAxis(theObjectPlayer.Orientation, Vector3.Zero, Vector3.Zero);
//            Orientation = Quaternion.FromRotationMatrix(Matrix4.CreateFromAxisAngle(Vector3.Up,
//                theObjectPlayer.Orientation.CalculateAngle(Vector3.Forward)));

            base.Draw();
        }
Beispiel #24
0
        void Rotate(IRover rover, char command)
        {
            RotationDirection rotationDirection    = Utility.GetRotationDirectionByChar(command);
            CompassDirection  nextCompassDirection = RotationHelper.Rotate(rover.Position.CompassDirection, rotationDirection);

            rover.Position = new Position
            {
                Coordinate       = rover.Position.Coordinate,
                CompassDirection = nextCompassDirection
            };
        }
Beispiel #25
0
    public void RunAwayFrom(Vector3 point)
    {
        var rotation = RotationHelper.GetOppositeLookRotation(transform.position, point);

        if (rotation == null)
        {
            return;
        }

        TargetRotation = (Quaternion)rotation;
    }
Beispiel #26
0
    public void MoveTowards(Vector3 point)
    {
        var rotation = RotationHelper.GetTowardsLookRotation(transform.position, point);

        if (rotation == null)
        {
            return;
        }

        TargetRotation = (Quaternion)rotation;
    }
Beispiel #27
0
 /// <summary>
 /// Add a sprite to the queue
 /// </summary>
 /// <param name="next"></param>
 public void Enqueue(Vector2 next)
 {
     if (count < queue.Length)
     {
         count++;
         queue[e]            = new Arrow(queue[e - 1].Target, next);
         endArrow.Position2D = next;
         RotationHelper.FaceDirection(endArrow, Vector2.Normalize(next - queue[e - 1].Target), DirectionAccuracy.free, 0);
         e = (e + 1) % queue.Length;
     }
 }
Beispiel #28
0
    // Component Appliers
    private void ControlStart()
    {
        // Instantiate
        GameObject aTT = controlRoomModel;


        aTT.name = "AllTheThings";

        // Set the transform of the parent object
        aTT.transform.position    = new Vector3(250, 25, 250);
        aTT.transform.eulerAngles = new Vector3(90, 0, 0);
        aTT.transform.localScale  = Vector3.one * controlRoomScaleFactor;


        // Set parent components:

        // Text file reader component
        aTT.AddComponent <ReactorCompProps>();

        // Rotation component
        RotationHelper rotHelper = aTT.AddComponent <RotationHelper>();

        rotHelper.aClipRotate = (AudioClip)Resources.Load("Audio/WooshRotateSound(1)"); // add proper sound to rotation component

        // Animator
        Animator aTTAnim = aTT.AddComponent <Animator>();

        aTTAnim.runtimeAnimatorController = (RuntimeAnimatorController)Resources.Load("Animations/ControlScene/ControlModelAnimator");


        for (int i = 0; i < aTT.transform.GetChildCount(); i++)
        {
            // Set child components:
            GameObject child = aTT.transform.GetChild(i).gameObject;



            child.tag   = "ReactorComponent";
            child.layer = 10;                                                                                   // Holographic component layer

            child.GetComponent <Renderer>().material = (Material)Resources.Load("Materials/GeneralReactorMat"); // blank material

            // necessary mesh collider for raycasting
            child.AddComponent <MeshCollider>();

            // properties component
            child.AddComponent <CompProps>();

            // set animator and assign proper runtime animator controller
            Animator childAnim = child.AddComponent <Animator>();
            childAnim.runtimeAnimatorController = (RuntimeAnimatorController)Resources.Load("Animations/ControlScene/ComponentAnimator");
        }
    }
Beispiel #29
0
        private void FireMissile(Sprite lockedSprite)
        {
            Sprite target = lockedSprite;

            Vector2 dir = new Vector2(RotationHelper.MyDirection(this, 0).X, RotationHelper.MyDirection(this, 0).Y);

            new Missile(Position2D + (24 * dir), dir, this, target, 750, 500, 20, 50);

            if (tiAltFireCooldown == null)
            {
                GM.eventM.AddTimer(tiAltFireCooldown = new Event(1, "Alternate Fire Cooldown"));
            }
        }
        public void Instanciate(Point position, CardinalDirections direction)
        {
            if (direction == CardinalDirections.Center)
            {
                return;
            }

            GameObject instance       = Instanciate(position);
            Vector3    vectorPosition = instance.transform.position + GetPositionOffset(direction, 1.05f);

            instance.transform.position = vectorPosition;
            instance.transform.rotation = RotationHelper.GetRotation(direction, 90f, 0f);
        }