Ejemplo n.º 1
0
        internal Actor CreateActor <T>(SlimMath.Vector3 position, SlimMath.Quaternion rotation) where T : ActorDefinition, new()
        {
            var nActor = new Actor(new T(), context);

            nActor.position = position;
            nActor.rotation = rotation;

            var fnull = actors.FindIndex(a => a == null);

            if (fnull != -1)
            {
                nActor.Id     = (ushort)fnull;
                actors[fnull] = nActor;
            }
            else
            {
                if (actors.Count > ushort.MaxValue)
                {
                    log.Error("Cannot have more than {0} actors at any given time", ushort.MaxValue);
                    return(null);
                }
                nActor.Id = (ushort)actors.Count;
                actors.Add(nActor);
            }


            return(nActor);
        }
Ejemplo n.º 2
0
        internal static GameObject CreateGameObject(SlimMath.Vector3 position, SlimMath.Quaternion rotation)
        {
            var gameObject = new GameObject {
                Position = position, Rotation = rotation
            };

            return(gameObject);
        }
Ejemplo n.º 3
0
 public static UnityEngine.Quaternion Convert(SlimMath.Quaternion q)
 {
     return(new UnityEngine.Quaternion(q.X, q.Y, q.Z, q.W));
 }