示例#1
0
        /// <summary>
        /// Sets the physics state for a launched projectile
        /// </summary>
        public void SetProjectilePhysicsState(WorldObject target, bool useGravity)
        {
            if (useGravity)
            {
                GravityStatus = true;
            }

            CurrentMotionState = null;
            Placement          = null;

            // TODO: Physics description timestamps (sequence numbers) don't seem to be getting updated

            //Console.WriteLine("SpellProjectile PhysicsState: " + PhysicsObj.State);

            var pos      = Location.Pos;
            var rotation = Location.Rotation;

            PhysicsObj.Position.Frame.Origin      = pos;
            PhysicsObj.Position.Frame.Orientation = rotation;

            var velocity = Velocity.Get();

            //velocity = Vector3.Transform(velocity, Matrix4x4.Transpose(Matrix4x4.CreateFromQuaternion(rotation)));
            PhysicsObj.Velocity = velocity;
            if (target != null)
            {
                PhysicsObj.ProjectileTarget = target.PhysicsObj;
            }

            PhysicsObj.set_active(true);
        }
示例#2
0
 void Update()
 {
     timer += Time.deltaTime * Mathf.Pow(Velocity.Get(), 1f / 4f);
     if (timer >= timeOffset)
     {
         InstantiateObstacle();
         timer = 0;
     }
 }
示例#3
0
 public void Update()
 {
     if (Velocity.Get() > maxSpeed)
     {
         PlayAudio();
     }
     else
     {
         warning.SetActive(false);
         UpdateIndicatorsPosition(Velocity.Get());
     }
 }
示例#4
0
    private void Update()
    {
        var velocity = Velocity.Get();
        var visible = velocity <max && velocity> min;

        if (rend)
        {
            rend.enabled = visible;
        }

        if (text)
        {
            text.enabled = visible;
        }
    }
示例#5
0
 private void Update()
 {
     if (last == null || transform.position.y - last.transform.position.y >= offset / Mathf.Log(Velocity.Get(), logBase))
     {
         InstantiateNewObject(0);
     }
 }