// Functions // -Publics public static GameObject CreateGameObject(TsCreationDef def) { string fullName = GetFullName(def); GameObject obj = GetFactory(def.Type).Create(fullName); if (null != obj){ obj.name = def.Obj; obj.transform.parent = GetParentTransform(def.Parent); if(def.Type != TYPE.ENEMY && def.Type!= TYPE.HERO){ obj.transform.localScale = new Vector3(def.Scale, def.Scale, 1f); } } else{ Debug.LogError(string.Format("{0} can not Create.\nCall in CreateGameObject", fullName)); } return obj; }
private static string GetFullName(TsCreationDef def) { bool noPrefix = string.IsNullOrEmpty(def.Prefix); bool hasSlash = (!noPrefix && '/' == def.Prefix[def.Prefix.Length-1]); return (def.Prefix + (hasSlash || noPrefix? "": "/") + def.Obj); }
public TsCreation tsInit(TsCreationDef def) { this.taskName = def.ToString(); this.def = def; return this; }