public JediumSitMessage(Guid _clientId, Guid _localId, bool isOccupied) { ClientId = _clientId; LocalId = _localId; IsOccupied = isOccupied; _behType = TYPEBEHAVIOUR.GetTypeIndex("Sit"); }
public JediumCharacterControllerMessage(float v, float h, bool jump) { V = v; H = h; Jump = jump; _behType = TYPEBEHAVIOUR.GetTypeIndex("CharacterController"); }
public void SetBehaviourFromSnapshot(JediumBehaviourSnapshot snap) { var type = snap.BehaviourType; int index = TYPEBEHAVIOUR.GetTypeIndex(type); if (index == -1) //todo - log error { return; } if (_behaviours.ContainsKey(index)) { _behaviours[index].FromSnapshot(snap); } else { //adding new behaviour Type behType = BehaviourTypeRegistry.BehaviourTypes[snap.BehaviourType]; JediumBehaviour plugin_beh = (JediumBehaviour)Activator.CreateInstance(behType, this); plugin_beh.FromSnapshot(snap); _behaviours.Add(index, plugin_beh); } }
public JediumTakeMessage(Guid clientId, Guid localId, bool IsTaken) { ClientId = clientId; LocalId = localId; _behType = TYPEBEHAVIOUR.GetTypeIndex("Take"); this.IsTaken = IsTaken; }
public JediumTouchMessage(Guid clientId, float u, float v) { ClientId = clientId; U = u; V = v; _behType = TYPEBEHAVIOUR.GetTypeIndex("Touch"); }
public JediumUIMessage(string dllName, Guid bundleId, string xamlName, string archiveName) { this.dllName = dllName; this.bundleId = bundleId; this.xamlName = xamlName; this.archiveName = archiveName; _behType = TYPEBEHAVIOUR.GetTypeIndex("UI"); }
/// <summary> /// </summary> /// <param name="type"></param> /// <param name="nameParametr"></param> /// <param name="value"></param> /// <param name="isDirect">Setting the value directly, not tracking animator</param> /// <param name="dampTime"></param> /// <param name="deltaTime"></param> public JediumAnimatorMessage(JEDIUM_TYPE_ANIMATOR type, string nameParametr, object value, bool isDirect, float dampTime, float deltaTime) { Type = type; NameParameter = nameParametr; Value = value; IsDirectUpdate = isDirect; DampTime = dampTime; DeltaTime = deltaTime; _behType = TYPEBEHAVIOUR.GetTypeIndex("Animation"); }
public JediumTransformMessage(float x, float y, float z, float rotx, float roty, float rotz, float rotw, float scalex, float scaley, float scalez) { X = x; Y = y; Z = z; RotX = rotx; RotY = roty; RotZ = rotz; RotW = rotw; ScaleX = scalex; ScaleY = scaley; ScaleZ = scalez; _behType = TYPEBEHAVIOUR.GetTypeIndex("Transform"); }
public override bool ProcessUpdate(JediumBehaviourMessage message) { if (message == null) //empty update { return(false); } if (message.GetBehaviourType() != TYPEBEHAVIOUR.GetTypeIndex(GetComponentType())) { Debug.Log("WRONG MESSAGE TYPE:" + message.GetBehaviourType() + ";" + message.GetType()); return(false); } JediumTestBehaviourMessage tmsg = (JediumTestBehaviourMessage)message; Debug.Log("__GOT TEST MESSAGE:" + tmsg.SomeTestMessage); return(true); }
//Мы предполагаем, что компонент Transform есть всегда public JediumGameObject(IGameObjectSelfAccessor actor, List <JediumBehaviourSnapshot> behaviours, Dictionary <string, JediumBehaviourDBSnapshot> db_snaps, Guid ownerId, Guid localId) { Actor = actor; OwnerId = ownerId; LocalId = localId; _behaviours = new Dictionary <int, JediumBehaviour>(); foreach (var new_beh in db_snaps) { JediumBehaviour toAdd = null; if (BehaviourTypeRegistry.BehaviourTypes.ContainsKey(new_beh.Key)) { Type behType = BehaviourTypeRegistry.BehaviourTypes[new_beh.Key]; if (behType != null) { JediumBehaviour plugin_beh = (JediumBehaviour)Activator.CreateInstance(behType, this); plugin_beh.FromDBSnapshot(new_beh.Value); toAdd = plugin_beh; } } if (toAdd != null) { _behaviours.Add(TYPEBEHAVIOUR.GetTypeIndex(new_beh.Key), toAdd); } } //OLD DB if (behaviours != null) { foreach (var beh in behaviours) { if (BehaviourTypeRegistry.BehaviourTypes.ContainsKey(beh.GetBehaviourType())) { //loaded behaviour string bname = beh.GetBehaviourType(); Type behType = BehaviourTypeRegistry.BehaviourTypes[bname]; if (behType != null) { JediumBehaviour plugin_beh = (JediumBehaviour)Activator.CreateInstance(behType, this); plugin_beh.FromSnapshot(beh); _behaviours.Add(TYPEBEHAVIOUR.GetTypeIndex(bname), plugin_beh); } } } } //special - transform if (!_behaviours.ContainsKey(TYPEBEHAVIOUR.GetTypeIndex("Transform"))) { _behaviours.Add(TYPEBEHAVIOUR.GetTypeIndex("Transform"), new JediumTransform(this, JediumTransformSnapshot.Identity)); } }
public override int GetBehaviourIndex() { return(TYPEBEHAVIOUR.GetTypeIndex("Take")); }
public int GetBehaviourType() { return(TYPEBEHAVIOUR.GetTypeIndex("TestBehaviour")); }
public override int GetBehaviourIndex() { return(TYPEBEHAVIOUR.GetTypeIndex("CharacterController")); }
//TODO - optimize it!! public virtual int GetComponentTypeIndex() { return(TYPEBEHAVIOUR.GetTypeIndex(GetComponentType())); }