private ChangeTracker CreateJake(Vector3 mousePoint, StateFlux.Model.Color color, GameObject parent = null) { var change = new StateFlux.Model.Change2d { Event = ChangeEvent.Created, ObjectID = "liquid_jake" + ShortGuid.Generate(), TypeID = "liquid_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 / 10f }, Attributes = new StateFlux.Model.Attributes { Color = color } }; GameObject jake = DemoGame.gameObjectTracker.StateCreateGameObject(change, StateFluxClient.Instance.isHosting); return(new ChangeTracker { gameObject = jake, create = change }); }
static private void SetObjectColor(GameObject gameObject, StateFlux.Model.Color newColor) { UnityEngine.Color color = new UnityEngine.Color(newColor.Red, newColor.Green, newColor.Blue, newColor.Alpha); var spriteRenderer = gameObject.GetComponent <SpriteRenderer>(); //var textMesh = gameObject.GetComponentInChildren<TextMesh>(); if (spriteRenderer != null) { spriteRenderer.color = color; } //if (textMesh != null) textMesh.color = color; }
public static UnityEngine.Color Convert(this StateFlux.Model.Color sfColor) { return(new UnityEngine.Color(sfColor.Red, sfColor.Green, sfColor.Blue, sfColor.Alpha)); }