Exemple #1
0
        /// <summary>
        ///     Coloca el objeto a la altura correspondiente segun su posicion en el terreno.
        ///     Retorna false si esta fuera del terreno.
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        public bool setObjectPosition(ITransformObject o)
        {
            float y;

            if (!interpoledHeight(o.Position.X, o.Position.Z, out y))
            {
                return(false);
            }
            o.Position = new TGCVector3(o.Position.X, y, o.Position.Z);
            return(true);
        }
Exemple #2
0
 public PlataformaGiratoriaBullet(float radio, ITransformObject mesh, RigidBody body, TGCVector3 pos, float period)
 {
     Mesh   = mesh;
     Radio  = radio;
     Pos    = pos;
     Period = period;
     Body   = body;
     Body.ActivationState = ActivationState.DisableDeactivation;
     Body.Flags           = RigidBodyFlags.DisableWorldGravity;
     Body.Gravity         = new Vector3(0, 0, 0);
 }
    /// <summary>
    /// returns the value of an object, unless its an ITransformObject. Then
    /// the getTransformedValue will get called and returned.
    /// </summary>
    /// <param name="source"></param>
    /// <returns></returns>
    private static object getValue(object source)
    {
        object result = source;

        if (result is ITransformObject)
        {
            ITransformObject transformObject = (ITransformObject)result;
            result = transformObject.getTransformedValue();
        }
        //else
        //{
        //    Type t = source.GetType();
        //    if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(IList<>))
        //    {
        //        IList a = source as IList;
        //        Type itemType = t.GetGenericArguments()[0];
        //        if (itemType == typeof(IRestoreObject))
        //        {
        //            return source as
        //        }
        //    }
        //    //    else if (value is IEnumerable<KeyValuePair<object, object>>)
        //    //    {
        //    //        //foreach (object o in (value as IEnumerable<K>)
        //    //    }
        //    //    else
        //    //    {
        //    //        field.SetValue(target, value);
        //    //    }
        //    //}
        //    //else
        //    //{
        //    //    field.SetValue(target, value);
        //    //}
        //}

        return(result);
    }
Exemple #4
0
 public bool isOutOfBounds(ITransformObject tankOrMissile)
 {
     return tankOrMissile.Position.X > this.heightmapSizeScaled / 2 || tankOrMissile.Position.X < -this.heightmapSizeScaled / 2 ||
            tankOrMissile.Position.Z > this.heightmapSizeScaled / 2 || tankOrMissile.Position.Z < -this.heightmapSizeScaled / 2;
 }
 /// <summary>
 /// Coloca el objeto a la altura correspondiente segun su posicion en el terreno. 
 /// Retorna false si esta fuera del terreno.
 /// </summary>
 /// <param name="o"></param>
 /// <returns></returns>
 public bool setObjectPosition(ITransformObject o)
 {
     float y;
     if (!interpoledHeight(o.Position.X, o.Position.Z, out y)) return false;
     o.Position = new Vector3(o.Position.X, y, o.Position.Z);
     return true;
 }