public static TempEffect GetPrefab(EffectPrefab id) { if (!IsLoaded(id)) { return(null); } return(loaded[id]); }
public static TempEffect Spawn(EffectPrefab id, Vector2 position, float angle) { var prefab = GetPrefab(id); if (prefab == null) { Debug.LogWarning("Failed to find effect prefab for Id {0}, no effect spawned.".Form(id)); return(null); } return(Pool.Get(prefab.PoolableObject, position, Quaternion.Euler(0f, 0f, angle)).GetComponent <TempEffect>()); }
public override int GetHashCode() { int hash = 1; if (Id.Length != 0) { hash ^= Id.GetHashCode(); } if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (Icon.Length != 0) { hash ^= Icon.GetHashCode(); } if (Description.Length != 0) { hash ^= Description.GetHashCode(); } if (EffectSprite.Length != 0) { hash ^= EffectSprite.GetHashCode(); } if (StatusIcon.Length != 0) { hash ^= StatusIcon.GetHashCode(); } if (Slot != 0) { hash ^= Slot.GetHashCode(); } if (EffectPrefab.Length != 0) { hash ^= EffectPrefab.GetHashCode(); } if (Rule != 0) { hash ^= Rule.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
bool CheckTriggerEffect(out EffectPrefab prefab) { prefab = null; var effects = _holdSkills.FindAll(s => s.ID.Contains("Attack")); if (effects != null && effects.Count > 0) { foreach (var e in effects) { if (RandomUtility.Random0To100() < e.TriggerProb) { prefab = BattleScene.Instance.AttackEffects.Find(a => a.SkillID == e.ID); return(true); } } } return(false); }
public static EffectPrefab EffectPrefabSettings(EffectPrefab pref) { if(pref.prefabInstance == null && "" != pref.prefabName) { pref.prefabInstance = (GameObject)Resources.Load(pref.prefabPath+pref.prefabName, typeof(GameObject)); } pref.prefabInstance = (GameObject)EditorGUILayout.ObjectField("Prefab", pref.prefabInstance, typeof(GameObject), false, GUILayout.Width(mWidth*2)); if(pref.prefabInstance) pref.prefabName = pref.prefabInstance.name; else pref.prefabName = ""; GUILayout.Label("Path/to/child", EditorStyles.boldLabel); pref.childName = EditorGUILayout.TextField("Target child", pref.childName, GUILayout.Width(mWidth*2)); pref.localSpace = EditorGUILayout.Toggle("Local space", pref.localSpace, GUILayout.Width(mWidth)); pref.offset = EditorGUILayout.Vector3Field("Offset", pref.offset, GUILayout.Width(mWidth)); pref.targetRotation = EditorGUILayout.Toggle("Use target rotation", pref.targetRotation, GUILayout.Width(mWidth)); if(pref.targetRotation) { pref.rotationOffset = EditorGUILayout.Vector3Field("Rotation offset", pref.rotationOffset, GUILayout.Width(mWidth)); } EditorGUILayout.Separator(); return pref; }
public static bool IsLoaded(EffectPrefab id) { return(loaded.ContainsKey(id)); }
public static EffectPrefab[] Add(EffectPrefab n, EffectPrefab[] list) { ArrayList tmp = new ArrayList(); foreach(EffectPrefab str in list) tmp.Add(str); tmp.Add(n); return tmp.ToArray(typeof(EffectPrefab)) as EffectPrefab[]; }
public static EffectPrefab[] Remove(int index, EffectPrefab[] list) { ArrayList tmp = new ArrayList(); foreach(EffectPrefab str in list) tmp.Add(str); tmp.RemoveAt(index); return tmp.ToArray(typeof(EffectPrefab)) as EffectPrefab[]; }