コード例 #1
0
        public void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE, uint id = EventId.Charge, bool generatePath = false, Unit target = null, SpellEffectExtraData spellEffectExtraData = null)
        {
            if (Impl[(int)MovementSlot.Controlled] != null && Impl[(int)MovementSlot.Controlled].GetMovementGeneratorType() != MovementGeneratorType.Distract)
            {
                return;
            }

            if (_owner.IsTypeId(TypeId.Player))
            {
                StartMovement(new PointMovementGenerator <Player>(id, x, y, z, generatePath, speed, target, spellEffectExtraData), MovementSlot.Controlled);
            }
            else
            {
                StartMovement(new PointMovementGenerator <Creature>(id, x, y, z, generatePath, speed, target, spellEffectExtraData), MovementSlot.Controlled);
            }
        }
コード例 #2
0
        public void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ, SpellEffectExtraData spellEffectExtraData = null)
        {
            //this function may make players fall below map
            if (_owner.IsTypeId(TypeId.Player))
            {
                return;
            }

            float x, y, z;
            float moveTimeHalf = (float)(speedZ / gravity);
            float dist         = 2 * moveTimeHalf * speedXY;
            float max_height   = -MoveSpline.computeFallElevation(moveTimeHalf, false, -speedZ);

            _owner.GetNearPoint(_owner, out x, out y, out z, _owner.GetObjectSize(), dist, _owner.GetAngle(srcX, srcY) + MathFunctions.PI);

            MoveSplineInit init = new MoveSplineInit(_owner);

            init.MoveTo(x, y, z);
            init.SetParabolic(max_height, 0);
            init.SetOrientationFixed(true);
            init.SetVelocity(speedXY);
            if (spellEffectExtraData != null)
            {
                init.SetSpellEffectExtraData(spellEffectExtraData);
            }

            init.Launch();
            StartMovement(new EffectMovementGenerator(0), MovementSlot.Controlled);
        }
コード例 #3
0
 public void MoveJump(Position pos, float speedXY, float speedZ, uint id = EventId.Jump, bool hasOrientation = false, JumpArrivalCastArgs arrivalCast = null, SpellEffectExtraData spellEffectExtraData = null)
 {
     MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), speedXY, speedZ, id, hasOrientation, arrivalCast, spellEffectExtraData);
 }
コード例 #4
0
ファイル: PointMovement.cs プロジェクト: query-wow/CypherCore
 public PointMovementGenerator(ulong _id, float _x, float _y, float _z, bool _generatePath, float _speed = 0.0f, Unit faceTarget = null, SpellEffectExtraData spellEffectExtraData = null)
 {
     id                 = _id;
     i_x                = _x;
     i_y                = _y;
     i_z                = _z;
     speed              = _speed;
     i_faceTarget       = faceTarget;
     i_spellEffectExtra = spellEffectExtraData;
     m_generatePath     = _generatePath;
     i_recalculateSpeed = false;
 }
コード例 #5
0
 public void SetSpellEffectExtraData(SpellEffectExtraData spellEffectExtraData)
 {
     args.spellEffectExtra.Set(spellEffectExtraData);
 }
コード例 #6
0
        public void MoveCharge(PathGenerator path, float speed = SPEED_CHARGE, Unit target = null, SpellEffectExtraData spellEffectExtraData = null)
        {
            Vector3 dest = path.GetActualEndPosition();

            MoveCharge(dest.X, dest.Y, dest.Z, SPEED_CHARGE, EventId.ChargePrepath);

            // Charge movement is not started when using EVENT_CHARGE_PREPATH
            MoveSplineInit init = new MoveSplineInit(_owner);

            init.MovebyPath(path.GetPath());
            init.SetVelocity(speed);
            if (target != null)
            {
                init.SetFacing(target);
            }
            if (spellEffectExtraData != null)
            {
                init.SetSpellEffectExtraData(spellEffectExtraData);
            }
            init.Launch();
        }
コード例 #7
0
 public PointMovementGenerator(uint id, float x, float y, float z, bool generatePath, float speed = 0.0f, Unit faceTarget = null, SpellEffectExtraData spellEffectExtraData = null)
 {
     _movementId       = id;
     _destination      = new Position(x, y, z);
     _speed            = speed;
     _faceTarget       = faceTarget;
     _spellEffectExtra = spellEffectExtraData;
     _generatePath     = generatePath;
     _recalculateSpeed = false;
 }
コード例 #8
0
        public PointMovementGenerator(uint id, float x, float y, float z, bool generatePath, float speed = 0.0f, float?finalOrient = null, Unit faceTarget = null, SpellEffectExtraData spellEffectExtraData = null)
        {
            _movementId       = id;
            _destination      = new Position(x, y, z);
            _speed            = speed;
            _generatePath     = generatePath;
            _finalOrient      = finalOrient;
            _faceTarget       = faceTarget;
            _spellEffectExtra = spellEffectExtraData;

            Mode          = MovementGeneratorMode.Default;
            Priority      = MovementGeneratorPriority.Normal;
            Flags         = MovementGeneratorFlags.InitializationPending;
            BaseUnitState = UnitState.Roaming;
        }