public void OnPointerClick(PointerEventData data) { // Der Name des Objektes selected = data.pointerEnter.gameObject; string element = data.pointerEnter.name; //Debug.Log("Clicked on Action: " + element); tree = FindObjectOfType <Skilltree>(); blurEffect.SetActive(true); darkenEffect.SetActive(true); actions = Game.play.GetActions(); foreach (Action action in actions) { if (action.GetId().ToString() == element) { active = action; //Debug.Log("Name: " + action.GetName() + " State: " + action.GetState()); switch (action.GetState()) { case State.Deactivated: ShowDeactivated(action); break; case State.Activated: ShowNormal(action); break; case State.InDevelopement: ShowInDevelopment(action); break; case State.Developed: ShowDeveloped(action); break; } headerText.text = action.GetName(); descrText.text = action.GetDescr(); costs.text = action.PrintCosts(); string eff = action.PrintEffects(); //Debug.Log("Back: " + eff); effects.text = eff; //Debug.Log("After: " + effects.text); status.text = "<b>Status: " + action.GetState().ToString() + "</b>"; requirements.text = action.PrintRequirements(actions); infoBox.SetActive(true); } } }
void Reset() { id = Skilltree.GetIndex(); anim = null; spellName = ""; sprite = null; description = ""; cooldown = 0; range = 0; requiresTarget = false; canCastOnSelf = false; startSpellEditing = false; startSpellCreation = false; }
public Node(Vector2 position, float width, float height, GUIStyle nodestyle, GUIStyle selectedStyle, GUIStyle inPointStyle, GUIStyle outPointStyle, Action <ConnectionPoint> OnClickInPoint, Action <ConnectionPoint> OnClickOutPoint, Action <Node> OnClickRemoveNode, Skilltree _skilltree) { skilltree = _skilltree; if (skilltree == null) { return; } rect = new Rect(position.x, position.y, width, height); style = nodestyle; defaultNodeStyle = nodestyle; selectedNodeStyle = selectedStyle; inPoint = new ConnectionPoint(this, ConnectionPointType.In, inPointStyle, OnClickInPoint); outPoint = new ConnectionPoint(this, ConnectionPointType.Out, outPointStyle, OnClickOutPoint); OnRemoveNode = OnClickRemoveNode; }
private void SkilltreeSelection() { EditorGUILayout.LabelField("Select a skilltree"); prevSkilltree = currentSkilltree; currentSkilltree = (Skilltree)EditorGUILayout.ObjectField(currentSkilltree, typeof(Skilltree), allowSceneObjects: true, GUILayout.Width(300)); if (currentSkilltree == null) { EditorGUILayout.HelpBox("No skilltree selected", MessageType.Info); } if (prevSkilltree != currentSkilltree) { Reset(); LoadSkilltree(); GUI.changed = true; } }
public Play(LinkedList <Country> countries, LinkedList <RandomEvent> events, Newsticker news) { this.countries = countries; this.events = events; this.news = news; this.actions = new LinkedList <Action>(); this.capital = new Capital(30000000, 2500000); this.lobby = new Lobby(10, 1); this.panel = FindObjectOfType <InfoPanel>(); this.tree = FindObjectOfType <Skilltree>(); this.display = FindObjectOfType <CountryDisplay>(); this.population = 0; this.prog = FindObjectOfType <progresstest>(); this.random = new System.Random(); this.extra = 0; }
protected Character(int id, string name, Hangar hangar, Faction factionId, Vector position, Spacemap spacemap, Reward rewards, Clan clan = null) : base(id) { Name = name; Hangar = hangar; FactionId = factionId; Position = position; Spacemap = spacemap; Reward = rewards; Clan = clan; //Default initialization Moving = false; OldPosition = new Vector(0, 0); Destination = position; Direction = new Vector(0, 0); MovementStartTime = new DateTime(); MovementTime = 0; RenderRange = 2000; Range = new Range { Character = this }; Skills = new Skilltree(this); Updaters = new Updaters(this); Cooldowns = new CooldownsAssembly(this); LastCombatTime = DateTime.Now; if (clan == null) { Clan = Global.StorageManager.Clans[0]; } Ticked += AssembleTick; }
private void SkilltreeSelection() { // select a skill tree from existing ones skilltree = (Skilltree)EditorGUILayout.ObjectField(skilltree, typeof(Skilltree), allowSceneObjects: true); // create a new empty skilltree if (GUILayout.Button("create new Skilltree")) { startSkilltreeCreation = !startSkilltreeCreation; } // expand an area for skilltree name selection if (startSkilltreeCreation) { EditorGUILayout.BeginHorizontal(); spellAssetName = EditorGUILayout.TextField("Name", spellAssetName); if (GUILayout.Button("Create")) { skilltree = ScriptableObject.CreateInstance <Skilltree>(); AssetDatabase.CreateAsset(skilltree, "Assets/Spell/SpellAsset/" + spellAssetName + ".asset"); AssetDatabase.SaveAssets(); spellAssetName = ""; startSkilltreeCreation = false; } if (GUILayout.Button("Undo")) { spellAssetName = ""; startSkilltreeCreation = false; } EditorGUILayout.EndHorizontal(); } /* * if (GUILayout.Button("Update Asset")) * { * FindAllSpells(); * } */ // Add a spell in the selected skilltree if (GUILayout.Button("New Spell")) { if (skilltree == null) { EditorGUILayout.HelpBox("Please select a Skilltree first", MessageType.Error); } else { Reset(); startSpellCreation = true; startSpellEditing = false; } } // Displaying all current spells in skilltree with the option to either edit or remove a spell if (skilltree != null) { foreach (Spell _spell in skilltree.allSpells) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.ObjectField(_spell.SpellSprite, typeof(Sprite), allowSceneObjects: false, GUILayout.Height(50), GUILayout.Width(50)); EditorGUILayout.LabelField(_spell.SpellName); if (GUILayout.Button("Edit")) { SelectSpell(_spell); startSpellCreation = false; startSpellEditing = true; } if (GUILayout.Button("Remove")) { skilltree.allSpells.Remove(_spell); } EditorGUILayout.EndHorizontal(); } } // Show spell registered for debug purpose ? /* * foreach (SpellAsset asset in allSpellAssets) * { * GUILayout.Label(asset.name); * foreach (Spell spell in asset.allSpells) * { * EditorGUILayout.BeginHorizontal(); * EditorGUILayout.ObjectField(spell.sprite, typeof(Sprite), allowSceneObjects: true); * EditorGUILayout.TextField(spell.name); * EditorGUILayout.EndHorizontal(); * * } * * } */ // select a spell to add in that skilltree if (GUILayout.Button("Add existing spell")) { addExistingSpell = true; // boolean to hide and show that area } if (addExistingSpell && skilltree != null) { EditorGUILayout.LabelField("Select Spell"); skilltreeSpell = (GameObject)EditorGUILayout.ObjectField("Spell", skilltreeSpell, typeof(GameObject), allowSceneObjects: true); Spell _s = skilltreeSpell.GetComponent <Spell>(); skilltree.AddSpell(_s); } if (skilltreeSpell != null) { addExistingSpell = false; skilltreeSpell = null; } }
static List<Trait> GetSkillTree(Skilltree treeType) { List<Trait> resultList=new List<Trait>(); switch (treeType) { case Skilltree.Fighter: { resultList.Add(new Avoidance()); resultList.Add(new Technique()); resultList.Add(new Deadeye()); //resultList.Add(new HitAndRun()); break; } case Skilltree.Carrier: { resultList.Add(new Carrier()); resultList.Add(new Fit()); resultList.Add(new Tough()); break; } case Skilltree.Scout: { //resultList.Add(new Quick()); resultList.Add(new Medic()); resultList.Add(new Quiet()); resultList.Add(new Scout()); //resultList.Add(new Agile()); break; } } return resultList; }