EntityPrefabRoot CreatePrefab(EntityRef entityRef, EntityPrefab prefab, Transform2D *transform) { var asset = UnityDB.FindAsset <EntityPrefabAsset>(prefab.Id); if (asset) { EntityPrefabRoot instance; instance = transform == null?Instantiate(asset.Prefab) : Instantiate(asset.Prefab, transform->Position.ToUnityVector2(), transform->Rotation.ToUnityQuaternion()); instance.AssetGuid = prefab.Guid; instance.EntityRef = entityRef; if (transform != null) { instance.transform.position = transform->Position.ToUnityVector3(); instance.transform.rotation = transform->Rotation.ToUnityQuaternion(); } // add to lookup _activePrefabs.Add(entityRef, instance); // return instance return(instance); } return(null); }
void OnDamage(EventCharacterDamage e) { var c = QuantumGame.Frame.GetCharacter(e.Character); var spec = UnityDB.FindAsset <CharacterSpecAsset>(c->CharacterSpec) as MageSpecAsset; if (spec != null) { Debug.Log("Damage from mage: " + e.Damage); } else { Debug.Log("Damage otherwise: " + e.Damage); } Debug.Log("Hit for " + e.Damage + " to " + e.Character.ToString()); }
public void Animate(Quantum.Animator *a) { var asset = UnityDB.FindAsset <AnimatorGraphAsset>(a->id); if (asset) { // load clips LoadClips(asset.clips); // clear old blend data _blendData.Clear(); // calculate blend data asset.Settings.GenerateBlendList(a, _blendData); // update animation state SetAnimationData(asset.Settings, _blendData); // Debug.Log(Quantum.Animator.GetFixedPoint(a, "Forward") +" "+ Quantum.Animator.GetFixedPoint(a, "Turn")); // Debug.Log(Quantum.Animator.GetBoolean(a, "Dead") +" "+ Quantum.Animator.GetFixedPoint(a, "Speed")); // Debug.Log(a->current_state_id+" "+a->from_state_id+" "+a->to_state_id+" "+a->transition_time+" "+a->transition_index); } }