示例#1
0
    private ChangeTracker CreateJake(Vector3 mousePoint, StateFlux.Model.Color color, GameObject parent = null)
    {
        var change = new StateFlux.Model.Change2d
        {
            Event     = ChangeEvent.Created,
            ObjectID  = "jake" + ShortGuid.Generate(),
            TypeID    = "jake",
            ParentID  = parent?.name,
            Transform = new Transform2d
            {
                Pos = mousePoint.Convert2d(),
                Vel = new Vec2d {
                    X = 0, Y = 0
                },
                Rot   = 0, //UnityEngine.Random.value * 720.0f - 360.0f,
                RotV  = UnityEngine.Random.value * 100.0f - 50.0f,
                Scale = UnityEngine.Random.value
            },
            Attributes = new StateFlux.Model.Attributes
            {
                Color = color
            }
        };
        GameObject jake = gameObjectTracker.StateCreateGameObject(change, stateFluxClient.isHosting);

        return(new ChangeTracker {
            gameObject = jake, create = change
        });
    }