IEnumerator Pause(float time) { canSpawnCoin = true; curTime = 0 - time; SpawnState = SpawnSequence.Obstacle; darkFogScript.SetPlayerReach(false); darkFogScript.SetSpeedGrowth(0); modifier = 0; startSpeed += 0.5f; SpawnObject(coin, 10, 1.5f); //Start new Voiceover here //VOTime = Voiceover.length while (time > 0) { speed = Mathf.Lerp(speed, startSpeed, 0.1f); // darkFogScript.AdjustSpeed(-0.1f); yield return(new WaitForEndOfFrame()); time -= Time.deltaTime; } if (VOCounter < VOs.Length - 1) { VOCounter++; PlayVO(); } else { Debug.LogWarning("No more sounds files! DO SOMETHING!"); } canSpawn = true; darkFogScript.SetSpeedGrowth(0.05f); spawnTime = 1f; StopCoroutine(Pause(time)); }
public SpawnSequence Clone() { //SpawnSequence newSpawnSequence = new SpawnSequence(); SpawnSequence newSpawnSequence = CreateInstance <SpawnSequence>(); newSpawnSequence.playerSpawnLocation = this.playerSpawnLocation; newSpawnSequence.hazardSpawnSteps = new SpawnStep[this.hazardSpawnSteps.Length]; for (int i = 0; i < this.hazardSpawnSteps.Length; i++) { newSpawnSequence.hazardSpawnSteps[i] = this.hazardSpawnSteps[i]; } return(newSpawnSequence); }
//private void RegisterStartSequence() //{ //} public void RegisterEndSequence(SpawnSequence sequence) { m_currentSequenceIndex++; if (m_currentSequenceIndex >= m_sequnces.m_sequences.Count) { if (m_repeatSequences) { m_currentSequenceIndex = 0; } else { m_isActive = false; return; } } m_sequnces.m_sequences[m_currentSequenceIndex].InitializeSequence(); }
// /// <summary> /// Reads an XML that contains the spawning scenarios and places them into the database. /// </summary> private void Load_SpawnScenarios() { string textData = ((TextAsset)Resources.Load("SpawnScenarios")).text; // XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(new StringReader(textData)); string xmlPathPattern = "//SpawnScenarios/scenario"; XmlNodeList nodeList = xmlDoc.SelectNodes(xmlPathPattern); // everySpawnScenario = new Dictionary <string, SpawnScenario>(); // SpawnScenario ssN; foreach (XmlNode node in nodeList) { ssN = new SpawnScenario(); // ssN.name = node.FirstChild.InnerXml; foreach (XmlNode entry in node.SelectNodes("entry")) { XmlNode o = entry.FirstChild; // Debug.Log("Node is: " + o.Name + " (" + o.InnerXml + ")"); SpawnSequence sequence = QuerySpawnSequence(o.InnerXml); o = o.NextSibling; float xx = float.Parse(o.InnerXml); o = o.NextSibling; float yy = float.Parse(o.InnerXml); o = o.NextSibling; float timing = float.Parse(o.InnerXml); // Debug.Log(timing + " timing"); ssN.Add(new SpawnSequenceRunner(sequence, new Vector2(xx, yy)), timing); } // everySpawnScenario.Add(ssN.name, ssN); } foreach (SpawnScenario Q in everySpawnScenario.Values) { Debug.Log("Entry: " + Q.name); } }
/// <summary> /// Reads an XML that contains spawn sequences and places them into the database. /// </summary> private void Load_SpawnSequences() { string textData = ((TextAsset)Resources.Load("SpawnSequences")).text; // XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(new StringReader(textData)); string xmlPathPattern = "//SpawnSequences/sequence"; XmlNodeList nodeList = xmlDoc.SelectNodes(xmlPathPattern); // everySpawnSequence = new Dictionary <string, SpawnSequence>(); // SpawnSequence ss; foreach (XmlNode node in nodeList) { ss = new SpawnSequence(); // ss.name = node.FirstChild.InnerXml; foreach (XmlNode entry in node.SelectNodes("entry")) { XmlNode o = entry.FirstChild; // Debug.Log("Node is: " + o.Name + " (" + o.InnerXml + ")"); Creep.CreepTypes creepType = (Creep.CreepTypes)Enum.Parse(typeof(Creep.CreepTypes), o.InnerXml); o = o.NextSibling; float timing = float.Parse(o.InnerXml); // ss.Add(new SpawnSequenceData(creepType, timing)); } // everySpawnSequence.Add(ss.name, ss); } foreach (SpawnSequence Q in everySpawnSequence.Values) { Debug.Log("Entry: " + Q.name); } }
public SpawnSequenceRunner(SpawnSequence ss, Vector2 spot) { sequence = ss; location = spot; }
void Load(XmlNode node) { if (node.Attributes == null) { return; } XmlAttributeCollection map = node.Attributes; int i = 0; if (node.Name == "Podstavi") { if (XmlNodeType.Element == node.NodeType) { foreach (XmlNode attrnode in map) { if (attrnode.Name == "count") { int count = int.Parse(attrnode.Value); spSeq = new SpawnSequence[count]; spSeqId = -1; } } } } if (node.Name == "LesoPodstavi") { inTheForest = true; if (XmlNodeType.Element == node.NodeType) { foreach (XmlNode attrnode in map) { if (attrnode.Name == "count") { int count = int.Parse(attrnode.Value); forestSeq = new SpawnSequence[count]; spSeqId = -1; } } } } if (node.Name == "SpawnSequence") { spSeqId++; id = -1; if (XmlNodeType.Element == node.NodeType) { foreach (XmlNode attrnode in map) { if (attrnode.Name == "count") { int count = int.Parse(attrnode.Value); spSeq[spSeqId] = new SpawnSequence(count); for (; i < count; i++) { spSeq[spSeqId].spawnData[i] = new SpawnData(); } } else if (attrnode.Name == "free") { spSeq[spSeqId].free = bool.Parse(attrnode.Value); } } } } if (node.Name == "ForestSequence") { spSeqId++; id = -1; if (XmlNodeType.Element == node.NodeType) { foreach (XmlNode attrnode in map) { if (attrnode.Name == "count") { int count = int.Parse(attrnode.Value); forestSeq[spSeqId] = new SpawnSequence(count); for (; i < count; i++) { forestSeq[spSeqId].spawnData[i] = new SpawnData(); } } else if (attrnode.Name == "free") { forestSeq[spSeqId].free = bool.Parse(attrnode.Value); } } } } else if (node.Name == "SpawnData") { id++; if (XmlNodeType.Element == node.NodeType) { foreach (XmlNode attrnode in map) { if (attrnode.Name == "time") { if (inTheForest) { forestSeq[spSeqId].spawnData[id].time = float.Parse(attrnode.Value); } else { spSeq[spSeqId].spawnData[id].time = float.Parse(attrnode.Value); } } } } } else if (node.Name == "EntityData") { carId = 0; if (XmlNodeType.Element == node.NodeType) { foreach (XmlNode attrnode in map) { if (attrnode.Name == "line") { line = int.Parse(attrnode.Value); } else if (attrnode.Name == "count") { int count = int.Parse(attrnode.Value); forestSeq[spSeqId].spawnData[id].lineData[line] = new LineData(count); for (; i < count; i++) { forestSeq[spSeqId].spawnData[id].lineData[line].carData[i] = new CarData(); } } } } } else if (node.Name == "CarData") { carId = 0; if (XmlNodeType.Element == node.NodeType) { foreach (XmlNode attrnode in map) { if (attrnode.Name == "line") { line = int.Parse(attrnode.Value); } else if (attrnode.Name == "count") { int count = int.Parse(attrnode.Value); spSeq[spSeqId].spawnData[id].lineData[line] = new LineData(count); for (; i < count; i++) { spSeq[spSeqId].spawnData[id].lineData[line].carData[i] = new CarData(); } } } } } else if (node.Name == "Car") { if (XmlNodeType.Element == node.NodeType) { foreach (XmlNode attrnode in map) { if (attrnode.Name == "speed") { float speed = float.Parse(attrnode.Value); spSeq[spSeqId].spawnData[id].lineData[line].carData[carId].carspeed = speed; } else if (attrnode.Name == "dist") { float dist = float.Parse(attrnode.Value); spSeq[spSeqId].spawnData[id].lineData[line].carData[carId].dist = dist; } else if (attrnode.Name == "type") { Type type = parseType(attrnode.Value); spSeq[spSeqId].spawnData[id].lineData[line].carData[carId].type = type; } else if (attrnode.Name == "bonusId") { int bonusId = int.Parse(attrnode.Value); spSeq[spSeqId].spawnData[id].lineData[line].carData[carId].bonusId = bonusId; } } } carId++; } else if (node.Name == "Entity") { if (XmlNodeType.Element == node.NodeType) { foreach (XmlNode attrnode in map) { if (attrnode.Name == "speed") { float speed = float.Parse(attrnode.Value); forestSeq[spSeqId].spawnData[id].lineData[line].carData[carId].carspeed = speed; } else if (attrnode.Name == "dist") { float dist = float.Parse(attrnode.Value); forestSeq[spSeqId].spawnData[id].lineData[line].carData[carId].dist = dist; } else if (attrnode.Name == "type") { Type type = parseType(attrnode.Value); forestSeq[spSeqId].spawnData[id].lineData[line].carData[carId].type = type; } else if (attrnode.Name == "bonusId") { int bonusId = int.Parse(attrnode.Value); forestSeq[spSeqId].spawnData[id].lineData[line].carData[carId].bonusId = bonusId; } } } carId++; } }