public static Rune generateRandom(Entity entity) { string triggerName = new List <string>(RuneGenerator.AllTriggers().Keys).GetRandom(); string actionName = new List <string>(RuneGenerator.AllActions().Keys).GetRandom(); return(RuneGenerator.generate(triggerName, actionName, entity)); }
public Enemy(Vector2Int coords, int HitPoints) : base(coords, HitPoints) { if (Random.value < 0.12f) { RuneList[0] = RuneGenerator.generateRandom(this); } }
IEnumerator ChangeFloors(int newDepth) { PlayerManager.inputEnabled = false; // let player movement animation finish // yield return new WaitForSeconds(0.25f); // disable player input var pManager = GameObject.Find("Player").GetComponent <PlayerManager>(); // pManager.enabled = false; // shrink player var initialScale = pManager.transform.localScale; yield return(AnimUtils.Animate(0.5f, (t) => { var s = 1 - t; var newScale = new Vector3(s, s, 1); newScale.Scale(initialScale); pManager.transform.localScale = newScale; })); yield return(new WaitForSeconds(0.5f)); bool runePieceAcquired = false; if (newDepth % 4 == 1) { var trigger = RuneGenerator.randomTrigger(player.shards); player.AddRuneShard(trigger); runePieceAcquired = true; } else if (newDepth % 4 == 3) { var action = RuneGenerator.randomAction(player.shards); player.AddRuneShard(action); runePieceAcquired = true; } depthPanel.GetComponentInChildren <TMPro.TMP_Text>().text = "Depth " + newDepth; depthPanel.transform.Find("RunePieceAcquired").gameObject.SetActive(runePieceAcquired); depthPanel.SetActive(true); yield return(null); Destroy(currentGrid); NewGrid(newDepth); yield return(new WaitForSeconds(2)); depthPanel.SetActive(false); yield return(AnimUtils.Animate(0.5f, (t) => { var newScale = new Vector3(t, t, 1); newScale.Scale(initialScale); pManager.transform.localScale = newScale; })); PlayerManager.inputEnabled = true; // pManager.enabled = true; }
void Update() { if (Input.GetKeyDown("f")) { RuneGenerator.CreateRuneXML(PathToXML("Rune_Instructions/SampleRune"), gameObject.transform, transform.position); } else if (Input.GetKeyDown("g")) { RuneGenerator.CreateRuneXML(PathToXML("Rune_Instructions/SampleRune2"), gameObject.transform, transform.position); } }
void Start() { Application.targetFrameRate = 30; // default platform switch direction is going up rGen = RuneGenerator.instance; /* * direction = 0; * points = 0; * timerReached = true; * lift = false; * drop = false; * breakables = platformParent.GetComponentsInChildren<Breakable>(); */ //heroes = charactersParent.GetComponentInChildren<Character>(); character = charactersParent.GetComponentInChildren <PlayerStats>(); //currentFloorPos.y = floor.transform.position.y; }
public static Rune generate(string triggerName, string actionName, Entity entity) { RuneTrigger trigger; RuneAction action; if (!RuneGenerator.AllTriggers().TryGetValue(triggerName, out trigger)) { Debug.LogError("COULD NOT GET TRIGGER GIVEN NAME \"" + triggerName + "\""); return(new Rune(entity)); } if (!RuneGenerator.AllActions().TryGetValue(actionName, out action)) { Debug.LogError("COULD NOT GET TRIGGER GIVEN NAME \"" + actionName + "\""); return(new Rune(entity)); } trigger = trigger.Clone(); trigger.OwningEntity = entity; action = action.Clone(entity); return(new Rune(trigger, action)); }