// Use this for initialization void Awake() { //다른컴포넌트 받아오기위한 선언 _vector = GameObject.Find("Initial").GetComponent <Initial>(); move = GameObject.Find("Character").GetComponent <Move>(); ifpop = GameObject.Find("ColorField").GetComponent <IfPopUp>(); ft = GameObject.Find("Map").GetComponent <FindTile>(); if (GameObject.FindWithTag("BlinkingObstacle")) { bo = GameObject.FindWithTag("BlinkingObstacle").GetComponent <BlinkingObstacle>(); } if (GameObject.FindWithTag("MovingObstacle")) { mo = GameObject.FindWithTag("MovingObstacle").GetComponent <MovingObstacle>(); } startPos = GameObject.Find("Character").transform.position; //처음위치를 기억한다. flow = GameObject.Find("Flow").GetComponent <RawImage>(); if (GameObject.Find("StepText")) { StepText = GameObject.Find("StepText").GetComponent <Text>(); } #pragma warning disable CS0618 // 형식 또는 멤버는 사용되지 않습니다. stagename = Application.loadedLevelName; #pragma warning restore CS0618 // 형식 또는 멤버는 사용되지 않습니다. }
void IObstacleModifier.Send(MovingObstacle obstacle) { var subject = obstacle.gameObject.AddComponent <DoActionOnTriggerEnter2D>(); subject.onStay = damageType == DamageType.continuous; subject.onEnter = damageType == DamageType.single; subject.action = OnPlayerEnter; }
/// <summary> /// Initializes this <see cref="T:GuiMovingObstacle"/>. /// </summary> /// <param name="guiGarden">The surrounding <see cref="T:GuiGarden"/>.</param> /// <param name="movingObstacle">The <see cref="T:MovingObstacle/> that is represented by this object.</param> public void Init(GuiGarden guiGarden, MovingObstacle movingObstacle) { this.GuiGarden = guiGarden; this.MovingObstacle = movingObstacle; //set initial position this.MoveToPosition(MovingObstacle.Position); MovingObstacle.AddObserver(this); }
private void OnEnable() { m_Target = target as MovingObstacle; m_MinMovePositionVector = serializedObject.FindProperty("m_MinMovePosition"); m_MaxMovePositionVector = serializedObject.FindProperty("m_MaxMovePosition"); m_AlignHorizontal = serializedObject.FindProperty("m_AlignHorizontally"); m_AlignVertical = serializedObject.FindProperty("m_AlignVertically"); m_PreviousTool = Tools.current; }
private void UpdateObstacleTraits(MovingObstacle obstacle) { var spawn = groundGenerator.GetSpawnLocation(); var movingObstacle = obstacle.GetComponent <MovingObstacle>(); var pos = spawn.transform.position; //movingObstacle.transform.SetPositionAndRotation(spawn.transform.position, Quaternion.identity); //movingObstacle.gameObject.transform.position = spawn.transform.position; //movingObstacle.transform.position = new Vector3(0,0,0); movingObstacle.transform.position = pos; movingObstacle.Direction = spawn.DestinationDirection; //Debug.Log($"{movingObstacle.Direction} {movingObstacle.transform.position}"); movingObstacle.UpdateTraits(); }
void Awake() { #pragma warning disable CS0618 // 형식 또는 멤버는 사용되지 않습니다. stagename = Application.loadedLevelName; #pragma warning restore CS0618 // 형식 또는 멤버는 사용되지 않습니다. rigid = GetComponent <Rigidbody>(); //다른컴포넌트 받아오기위한 선언 pl = GameObject.Find("Play").GetComponent <Play>(); _vector = GameObject.Find("Initial").GetComponent <Initial>(); if (GameObject.Find("Score")) { sc = GameObject.Find("Score").GetComponent <Score>(); } ft = GameObject.Find("Map").GetComponent <FindTile>(); if (GameObject.FindWithTag("BlinkingObstacle")) { bo = GameObject.FindWithTag("BlinkingObstacle").GetComponent <BlinkingObstacle>(); } if (GameObject.FindWithTag("MovingObstacle")) { mo = GameObject.FindWithTag("MovingObstacle").GetComponent <MovingObstacle>(); } Blinkingobject = new List <GameObject>(); Movingobject = new List <GameObject>(); color_list = new List <Color>(); tile = new List <GameObject[]>(); itemPos = new Vector3[10]; // 텍스트 설정 if (!(stagename.Substring(0, 5) == "Guide")) { PlayText = GameObject.Find("PlayCount").GetComponent <Text>(); LineText = GameObject.Find("LineCount").GetComponent <Text>(); ForText = GameObject.Find("ForCount").GetComponent <Text>(); FuncText = GameObject.Find("FuncCount").GetComponent <Text>(); IfText = GameObject.Find("IfCount").GetComponent <Text>(); CodeText = GameObject.Find("Code").GetComponent <Text>(); bestCode = GameObject.Find("BestCode").GetComponent <Text>(); frequencyCode = GameObject.Find("FrequencyCode").GetComponent <Text>(); } popCanvas = GameObject.Find("ClearPopUp").GetComponent <Canvas>(); }
void Generate(int chunkX, int chunkY) { var hash = GenerateHash(chunkX, chunkY, seed); Random.InitState(hash); var fuzzRand = new System.Random(); var startX = chunkX * chunkSize; var startY = chunkY * chunkSize; for (float i = startX; i < startX + chunkSize; i += minDist) { for (float j = startY; j < startY + chunkSize; j += minDist) { var val = Random.value; var f = (float)fuzzRand.NextDouble() * fuzz; var pos = new Vector3(i + f, j + f, 0); var size = (float)fuzzRand.NextDouble(); var sAdd = size * maxSizeAdd; if (val < percentMovingObstacle) { MovingObstacle mo = Instantiate(movingPrefabs[Random.Range((int)0, (int)movingPrefabs.Length)], pos, Quaternion.identity); mo.Initialize(ship, size, game); var inScale = mo.transform.localScale.x; var fSize = inScale + sAdd; mo.transform.localScale = new Vector3(fSize, fSize, fSize); } else if (val < percentFuel) { var go = Instantiate(fuelPrefab, pos, Quaternion.identity); } else if (val < percentObstacle) { Obstacle go = Instantiate(obstaclePrefabs[Random.Range((int)0, (int)obstaclePrefabs.Length)], pos, Quaternion.identity); go.Initialize(size, game); var inScale = go.transform.localScale.x; var fSize = inScale + sAdd; go.transform.localScale = new Vector3(fSize, fSize, fSize); } } } }
void Update() { scoreText.GetComponent <Text>().text = "Score: " + score; highScoreText.GetComponent <Text>().text = "High Score: " + highScore; if (didCount == false && GetComponent <PlayerDeath>().dead == true) { StartCoroutine(scoreCounter()); didCount = true; } if (score >= 10 && score < 30) { player.GetComponent <PlayerMovement>().maxSpeed = 21; Debug.Log("increased max speed to 21"); } if (score >= 20 && score < 40) { foreach (GameObject MovingObstacle in movingObstacles) { MovingObstacle.GetComponent <ObstacleMovement>().moveSpeed = 4; } } if (score >= 30 && score < 50) { player.GetComponent <PlayerMovement>().maxSpeed = 22; } if (score >= 40 && score < 50) { foreach (GameObject MovingObstacle in movingObstacles) { MovingObstacle.GetComponent <ObstacleMovement>().moveSpeed = 6; } } if (score >= 50 && score < 70) { foreach (GameObject MovingObstacle in movingObstacles) { MovingObstacle.GetComponent <ObstacleMovement>().moveSpeed = 8; } } if (score >= 70) { player.GetComponent <PlayerMovement>().maxSpeed = 23; } }
/// <summary> /// Notification that the obstacle moved from one position to another. /// Implementation of the <see cref="MovingObstacle.IMovingObstacleObserver"/>. /// </summary> /// <param name="obstacle">The moving obstacle.</param> /// <param name="oldPosition">Its old position.</param> /// <param name="newPosition">Its new position.</param> public void MovingObstacleMoved(MovingObstacle obstacle, GridPosition oldPosition, GridPosition newPosition) { if (!episodeIsEnding) { Tile oldPositionTile = GetTile(oldPosition); Tile newPositionTile = GetTile(newPosition); if (oldPositionTile != null && newPositionTile != null) { oldPositionTile.Occupied = false; newPositionTile.Occupied = true; //Debug.Log(string.Format("Obstacle moved to {0}", newPosition)); } else { //TODO: Throw error or write to an error log. Debug.Log(string.Format("MovingObstacle moved illegally: {0} -> {1}", oldPosition, newPosition)); } } }
private void InitilizeMovingObstacles() { var movingObstaclesCount = random.Next(BaseConstants.MinMovingObstaclesCount, BaseConstants.MaxMovingObstaclesCount); List <MovingObstacle> movingObstacles = new List <MovingObstacle>(); for (int i = 0; i < movingObstaclesCount; i++) { var size = BaseConstants.SquareSize; var x = random.Next(BaseConstants.MaxX - size); var y = random.Next(BaseConstants.MaxY - size); Position position = new Position(x, y); var newObstacle = new MovingObstacle(position, size, random.Next(BaseConstants.MinMovingObstaclesSpeed, BaseConstants.MaxMovingObstaclesSpeed)); movingObstacles.Add(newObstacle); } this.MovingObstacles = movingObstacles; }
public void PlayAgain() { // reset player and obstacles Player.Reset(); ResetAllObstacles(); //create new obastakels obstacles = new Obstacles(amountTree, amountBomb, amountMoving, amountCoin, randomLevel); PlaceAllObstacles(); foreach (Obstacle o in Obstacles.obstacles) { if (o.GetType().ToString() == "KBSGame.Model.MovingObstacle") { MovingObstacle mo = (MovingObstacle)o; mo.deadByMovingObstacle += OnDeadByMovingObstacle; } } //allow player to move again, restart timer FreezePlayer = false; GameTimer.Restart(); playing = true; GameWon = false; GameLost = false; //check if explosion is on so it can be deleted from screen if (explosion) { ExplosionEnded(); } //set collected coins 0 CollectedCoins = 0; mainWindow.CoinCounter.Content = CollectedCoins; //disable endpoint if (EndPointIsShown) { RemoveEndPoint(EndPoint, GameCanvas); EndPoint = null; Player.endPointReached -= OnEndPointReached; EndPointIsShown = false; } }
public Game(MainWindow mw, Canvas canvas, int aantalBoom, int aantalBom, int aantalMoving, int aantalCoin, int s, bool rl) { mainWindow = mw; GameCanvas = canvas; this.amountTree = aantalBoom; this.amountBomb = aantalBom; this.amountMoving = aantalMoving; this.amountCoin = aantalCoin; Seconde = s; randomLevel = rl; playing = true; StartPoint = new StartPoint(); AddStartPoint(StartPoint, GameCanvas); obstacles = new Obstacles(aantalBoom, aantalBom, aantalMoving, aantalCoin, randomLevel); PlaceAllObstacles(); Player = new Player(); AddPlayer(); Player.walkedOverBomb += OnPlayerWalkedOverBomb; Player.collectCoin += OnPlayerCollectCoin; Player.walkedOnMovingObstacle += OnDeadByMovingObstacle; GameTimer = new Model.Timer(Seconde, this); GameTimer.timeIsUp += OnPlayerTimeIsUp; mw.escKeyIsPressed += OnEscKeyIsPressed; mw.enterKeyIsPressed += OnEnterKeyIsPressed; activeEndPoint += OnActivateEndpoint; foreach (Obstacle o in Obstacles.obstacles) { if (o.GetType().ToString() == "KBSGame.Model.MovingObstacle") { MovingObstacle mo = (MovingObstacle)o; mo.deadByMovingObstacle += OnDeadByMovingObstacle; } } CollectedCoins = 0; }
private void Update() { // shoot bullet if (m_isShooting && Time.time >= m_lastShootTime + m_shootPeriod) { // instantiate bullet MovingObstacle bullet = Instantiate(m_ammo); bullet.transform.parent = transform; bullet.transform.position = transform.position; bullet.SetVelocity(m_ammoVelocity); // update last shoot time m_lastShootTime = Time.time; // if shoot once if (!m_shootLoop) { m_isShooting = false; } } }
public void ResetAllObstacles() { for (int i = 0; i < Obstacles.obstacles.Count; i++) { //remove obstacles from canvas GameCanvas.Children.Remove(Obstacles.obstacles[i].image); } //remove eventhandler from ghosts foreach (Obstacle o in Obstacles.obstacles) { if (o.GetType().ToString() == "KBSGame.Model.MovingObstacle") { MovingObstacle mo = (MovingObstacle)o; mo.timer.Tick -= mo.MoveObstakelRandom; mo.deadByMovingObstacle -= OnDeadByMovingObstacle; } } //remove all of the data in waardes and obstacles so it is empty Obstacles.obstacles.Clear(); Obstacles.waardes.Clear(); }
public Obstacles(int aantalBoom, int aantalBom, int aantalMoving, int aantalCoin, bool randomLevel = false) { if (!randomLevel) // is XML level { Serializer ser = new Serializer(); string path = string.Empty; string xmlInputData = string.Empty; string xmlOutputData = string.Empty; // Load Data from XML path = Directory.GetCurrentDirectory() + @"..\..\..\Resources\level.xml"; xmlInputData = File.ReadAllText(path); // Deserialize nodes XMLItem obj = ser.Deserialize <XMLItem>(xmlInputData); //Loop through nodes and match type foreach (XMLObstakel obs in obj.XMLItems) { switch (obs.ObstakelType) { case "Tree": //add the amount of trees to canvas Tree t = new Tree(obs.ObstakelX, obs.ObstakelY); obstacles.Add(t); Thread.Sleep(25); break; case "Bomb": //generate amount of bombs but don't put them on the screen because it is a land mine Bomb b = new Bomb(obs.ObstakelX, obs.ObstakelY); obstacles.Add(b); Thread.Sleep(25); break; case "Moving": //add the amount of moving obstacles to canvas MovingObstacle mo = new MovingObstacle(true, obs.ObstakelX, obs.ObstakelY); obstacles.Add(mo); Thread.Sleep(25); break; case "Coin": //add the amount of coins to canvas Coin c = new Coin(obs.ObstakelX, obs.ObstakelY); obstacles.Add(c); Thread.Sleep(25); break; } } } else { //add the amount of trees to canvas for (int i = 0; i < aantalBoom; i++) { Tree t = new Tree(); obstacles.Add(t); Thread.Sleep(25); } //generate amount of bombs but don't put it on the screen because it is a land mine for (int i = 0; i < aantalBom; i++) { Bomb b = new Bomb(); Thread.Sleep(25); } //add the amount of moving obstacles to canvas for (int i = 0; i < aantalMoving; i++) { mo = new MovingObstacle(); obstacles.Add(mo); Thread.Sleep(25); } //add the amount of coins to canvas for (int i = 0; i < aantalCoin; i++) { Coin c = new Coin(); obstacles.Add(c); Thread.Sleep(25); } } }
public void handlePause(bool isPaused) { MovingObstacle.handlePauseAll(isPaused); CharacterObstacle.hanlePause(isPaused); }
/// <summary> /// Notification that the obstacle moved from one position to another. /// </summary> /// <param name="obstacle">The moving obstacle.</param> /// <param name="oldPosition">Its old position.</param> /// <param name="newPosition">Its new position.</param> public void MovingObstacleMoved(MovingObstacle obstacle, Garden.GridPosition oldPosition, Garden.GridPosition newPosition) { MoveToPosition(newPosition); }
/// <summary> /// Creates a Garden object using a xml-based representation. /// </summary> /// <returns>The garden from the xml file.</returns> /// <param name="filename">The filename of the xml-file defining the garden.</param> /// <param name="paramSet">The set of parameters for this project.</param> public static Garden CreateGardenFromFile(string filename, ParamSet paramSet) { // Init the xml document XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(filename); // Init containers for the extracted information uint gardenWidth, gardenHeight; Garden.GridPosition mowerStartPosition; List <Tile> tiles; List <MovingObstacle> movingObstacles; List <StaticObstacle> staticObstacles = new List <StaticObstacle>(); bool parseResult = true; XmlNode gardenNode = xmlDoc.SelectSingleNode("/" + gardenNodeName); // Parse the garden if (gardenNode == null) { throw new InvalidGardenXMLException(MissingNodeErrorMessage(gardenNodeName)); } XmlNode widthAttribute = gardenNode.SelectSingleNode("@" + widthAttributeName); if (widthAttribute == null) { throw new InvalidGardenXMLException(MissingAttributeInNodeErrorMessage(gardenNodeName, widthAttributeName)); } parseResult = uint.TryParse(widthAttribute.InnerText, out gardenWidth); XmlNode heightAttribute = gardenNode.SelectSingleNode("@" + heightAttributeName); if (heightAttribute == null) { throw new InvalidGardenXMLException(MissingAttributeInNodeErrorMessage(gardenNodeName, heightAttributeName)); } parseResult = uint.TryParse(heightAttribute.InnerText, out gardenHeight); // Parse the mower starting position XmlNode startPosNode = gardenNode.SelectSingleNode(startPosNodeName); if (startPosNode == null) { throw new InvalidGardenXMLException(MissingNodeErrorMessage(startPosNodeName)); } XmlNode xAttribute = startPosNode.SelectSingleNode("@" + xPosAttributeName); if (xAttribute == null) { throw new InvalidGardenXMLException(MissingAttributeInNodeErrorMessage(startPosNodeName, xPosAttributeName)); } uint x, y; parseResult = uint.TryParse(xAttribute.InnerText, out x); XmlNode yAttribute = startPosNode.SelectSingleNode("@" + yPosAttributeName); if (yAttribute == null) { throw new InvalidGardenXMLException(MissingAttributeInNodeErrorMessage(startPosNodeName, yPosAttributeName)); } parseResult = uint.TryParse(yAttribute.InnerText, out y); mowerStartPosition = new Garden.GridPosition((int)x, (int)y); // Parse the tiles XmlNodeList tileNodes = gardenNode.SelectNodes(tilesNodeName + "/" + tileNodeName); if (tileNodes.Count != (gardenWidth * gardenHeight)) { throw new InvalidGardenXMLException(string.Format("Only found {0} <" + tileNodeName + "> nodes. Expecting {1}.", tileNodes.Count, gardenWidth * gardenHeight)); } tiles = new List <Tile>(tileNodes.Count); foreach (XmlNode tileNode in tileNodes) { xAttribute = tileNode.SelectSingleNode("@" + xPosAttributeName); if (xAttribute == null) { throw new InvalidGardenXMLException(MissingAttributeInNodeErrorMessage(tileNodeName, xPosAttributeName)); } parseResult = uint.TryParse(xAttribute.InnerText, out x); yAttribute = tileNode.SelectSingleNode("@" + yPosAttributeName); if (yAttribute == null) { throw new InvalidGardenXMLException(MissingAttributeInNodeErrorMessage(tileNodeName, yPosAttributeName)); } parseResult = uint.TryParse(yAttribute.InnerText, out y); XmlNode typeAttribute = tileNode.SelectSingleNode("@" + typeAttributeName); if (typeAttribute == null) { throw new InvalidGardenXMLException(MissingAttributeInNodeErrorMessage(tileNodeName, typeAttributeName)); } Garden.GridPosition position = new Garden.GridPosition((int)x, (int)y); Tile.MowStatus tileStatus = Tile.MowStatus.LongGrass; switch (typeAttribute.InnerText) { case tileTypeLongGrass: tileStatus = Tile.MowStatus.LongGrass; break; case tileTypeShortGrass: tileStatus = Tile.MowStatus.ShortGrass; break; case tileTypeRock: tileStatus = Tile.MowStatus.Obstacle; staticObstacles.Add(new StaticObstacle(position, StaticObstacle.StaticObstacleType.Rock)); break; case tileTypeWater: tileStatus = Tile.MowStatus.Obstacle; staticObstacles.Add(new StaticObstacle(position, StaticObstacle.StaticObstacleType.Water)); break; case tileTypeChargingStation: tileStatus = Tile.MowStatus.ChargingStation; break; default: throw new InvalidGardenXMLException( InvalidAttributeValueInNodeErrorMessage(tileNodeName, new KeyValuePair <string, string>(typeAttributeName, typeAttribute.InnerText)) ); } bool occupiedByMower = position.Equals(mowerStartPosition); tiles.Add(new Tile(position, tileStatus, occupiedByMower)); } // Parse the moving obstacles XmlNodeList obstacleNodes = gardenNode.SelectNodes(movingObstaclesNodeName + "/" + movingObstacleNodeName); movingObstacles = new List <MovingObstacle>(obstacleNodes.Count); foreach (XmlNode obstacleNode in obstacleNodes) { xAttribute = obstacleNode.SelectSingleNode("@" + xPosAttributeName); if (xAttribute == null) { throw new InvalidGardenXMLException(MissingAttributeInNodeErrorMessage(movingObstacleNodeName, xPosAttributeName)); } parseResult = uint.TryParse(xAttribute.InnerText, out x); yAttribute = obstacleNode.SelectSingleNode("@" + yPosAttributeName); if (yAttribute == null) { throw new InvalidGardenXMLException(MissingAttributeInNodeErrorMessage(movingObstacleNodeName, yPosAttributeName)); } parseResult = uint.TryParse(yAttribute.InnerText, out y); XmlNode typeAttribute = obstacleNode.SelectSingleNode("@" + typeAttributeName); if (typeAttribute == null) { throw new InvalidGardenXMLException(MissingAttributeInNodeErrorMessage(movingObstacleNodeName, typeAttributeName)); } Garden.GridPosition position = new Garden.GridPosition((int)x, (int)y); MovingObstacle.MovingObstacleType obstacleType = MovingObstacle.MovingObstacleType.Animal; switch (typeAttribute.InnerText) { case movingObstacleTypeAnimal: obstacleType = MovingObstacle.MovingObstacleType.Animal; break; case movingObstacleTypePerson: obstacleType = MovingObstacle.MovingObstacleType.Person; break; default: throw new InvalidGardenXMLException( InvalidAttributeValueInNodeErrorMessage(movingObstacleNodeName, new KeyValuePair <string, string>(typeAttributeName, typeAttribute.InnerText)) ); } MovingObstacle obstacle = new MovingObstacle(position, obstacleType); // Register the tile as occupied foreach (var tile in tiles) { if (tile.Position.Equals(position)) { if (tile.Occupied == true) { throw new InvalidGardenXMLException(string.Format("Multiple objects positioned at {0}.", position)); } else { tile.Occupied = true; } break; } } movingObstacles.Add(obstacle); // Save the initial state of all tiles foreach (var tile in tiles) { tile.SetCurrentStateAsInitialState(); } } // Create the garden (finally...) return(new Garden(gardenWidth, gardenHeight, tiles, mowerStartPosition, movingObstacles, staticObstacles, paramSet)); }
public void disableMovingObstacles() { MovingObstacle.ActivateResumeMotion(); MovingCoin.ActivateResumeMotion(); }
public void populateTrackObjects(Transform trackObjectsRoot) { if (trackObjectsRoot == null) { Debug.Log("trackObjectsRoot yok"); } foreach (Transform trackItem in trackObjectsRoot.transform) { TrackObject currentTrackObject = trackItem.GetComponent <TrackObject>(); if (currentTrackObject != null) { if (currentTrackObject.placeHolder == true) { if (currentTrackObject.objectGroup == TrackObject.ObjectGroup.None) { GameObject selectedObject = getRandomTrackObjectByType(currentTrackObject.objectType); if (selectedObject != null) { // Positioning New Object selectedObject.transform.parent = trackItem.transform.parent; selectedObject.transform.position = trackItem.transform.position; // Handle Selected switch (currentTrackObject.objectType) { case TrackObject.ObjectType.PointsLine: CoinLine CurrencyLine_placeHolder = currentTrackObject.GetComponent <CoinLine>(); CoinLine CurrencyLine_selected = selectedObject.GetComponent <CoinLine>(); if (CurrencyLine_placeHolder != null && CurrencyLine_selected != null) { CurrencyLine_selected.coinSpacing = CurrencyLine_placeHolder.coinSpacing; CurrencyLine_selected.length = CurrencyLine_placeHolder.length; CurrencyLine_selected.coinLineRefraction = CurrencyLine_placeHolder.coinLineRefraction; CurrencyLine_selected.doActive(); } break; case TrackObject.ObjectType.PointsCurve: CoinCurve CurrencyCurve_placeHolder = currentTrackObject.GetComponent <CoinCurve>(); CoinCurve CurrencyCurve_selected = selectedObject.GetComponent <CoinCurve>(); if (CurrencyCurve_placeHolder != null && CurrencyCurve_selected != null) { CurrencyCurve_selected.offsetObject = null; CurrencyCurve_selected.offsetObject = CurrencyCurve_placeHolder.offsetObject; CurrencyCurve_selected.doActive(); } break; case TrackObject.ObjectType.PointsMovingLine: MovingCoin MovingCoin_placeHolder = currentTrackObject.GetComponent <MovingCoin>(); MovingCoin MovingCoin_selected = selectedObject.GetComponent <MovingCoin>(); if (MovingCoin_placeHolder != null && MovingCoin_selected != null) { MovingCoin_selected.speed = MovingCoin_placeHolder.speed; } CoinLine SubCoinLine_placeHolder = currentTrackObject.GetComponent <CoinLine>(); CoinLine SubCoinLine_selected = selectedObject.transform.Find("movingMesh").gameObject.AddComponent <CoinLine>(); if (SubCoinLine_placeHolder != null && SubCoinLine_selected != null) { SubCoinLine_selected.coinSpacing = SubCoinLine_placeHolder.coinSpacing; SubCoinLine_selected.length = SubCoinLine_placeHolder.length; SubCoinLine_selected.coinLineRefraction = SubCoinLine_placeHolder.coinLineRefraction; SubCoinLine_selected.doActive(); } // Moving Coin if (MovingCoin_selected != null) { MovingCoin_selected.doActive(); } break; } } else { Debug.Log("Regular Item not found" + currentTrackObject.name); } } else { GameObject selectedObject = null; if (currentTrackObject.disableShuffle == false) { selectedObject = getRandomTrackObjectByGroup(currentTrackObject.objectGroup); } else { selectedObject = getRandomTrackObjectByType(currentTrackObject.objectType); } // Power-up handle codes places here if (currentTrackObject.objectGroup == TrackObject.ObjectGroup.PowerUps) { if (checkPowerUpSpawning(selectedObject) == false) { continue; } } // Pickables handle codes places here if (currentTrackObject.objectGroup == TrackObject.ObjectGroup.Pickables) { if (checkPowerUpSpawning(selectedObject) == false) { continue; } } if (selectedObject != null) { // Handle Selected switch (currentTrackObject.objectGroup) { case TrackObject.ObjectGroup.None: break; case TrackObject.ObjectGroup.CharacterObstacles: // Character Obstacles CharacterObstacle CharacterObstacle_placeHolder = currentTrackObject.GetComponent <CharacterObstacle>(); CharacterObstacle CharacterObstacle_selected = selectedObject.GetComponent <CharacterObstacle>(); if (CharacterObstacle_placeHolder != null && CharacterObstacle_selected != null) { CharacterObstacle_selected.lastWarrior = CharacterObstacle_placeHolder.lastWarrior; CharacterObstacle_selected.singleWarrior = CharacterObstacle_placeHolder.singleWarrior; CharacterObstacle_selected.doActive(); } break; case TrackObject.ObjectGroup.Bales1: break; case TrackObject.ObjectGroup.Bales3: break; case TrackObject.ObjectGroup.Bales5: break; case TrackObject.ObjectGroup.Barriers: break; case TrackObject.ObjectGroup.MovingObstaclesSingle: // Moving Obstacles Single MovingObstacle MovingObstaclesSingle_placeHolder = currentTrackObject.GetComponent <MovingObstacle>(); MovingObstacle MovingObstaclesSingle_selected = selectedObject.GetComponent <MovingObstacle>(); if (MovingObstaclesSingle_placeHolder != null && MovingObstaclesSingle_selected != null) { MovingObstaclesSingle_selected.trainCount = MovingObstaclesSingle_placeHolder.trainCount; MovingObstaclesSingle_selected.speed = MovingObstaclesSingle_placeHolder.speed; MovingObstaclesSingle_selected.doActive(); } break; case TrackObject.ObjectGroup.MovingObstaclesTrail3: // Moving Obstacles Trail MovingObstacle MovingObstaclesTrail_placeHolder3 = currentTrackObject.GetComponent <MovingObstacle>(); MovingObstacle MovingObstaclesTrail_selected3 = selectedObject.GetComponent <MovingObstacle>(); if (MovingObstaclesTrail_placeHolder3 != null && MovingObstaclesTrail_selected3 != null) { MovingObstaclesTrail_selected3.trainCount = MovingObstaclesTrail_placeHolder3.trainCount; MovingObstaclesTrail_selected3.speed = MovingObstaclesTrail_placeHolder3.speed; MovingObstaclesTrail_selected3.doActive(); } break; case TrackObject.ObjectGroup.MovingObstaclesTrail5: // Moving Obstacles Trail MovingObstacle MovingObstaclesTrail_placeHolder5 = currentTrackObject.GetComponent <MovingObstacle>(); MovingObstacle MovingObstaclesTrail_selected5 = selectedObject.GetComponent <MovingObstacle>(); if (MovingObstaclesTrail_placeHolder5 != null && MovingObstaclesTrail_selected5 != null) { MovingObstaclesTrail_selected5.trainCount = MovingObstaclesTrail_placeHolder5.trainCount; MovingObstaclesTrail_selected5.speed = MovingObstaclesTrail_placeHolder5.speed; MovingObstaclesTrail_selected5.doActive(); } break; } // Positioning New Object selectedObject.transform.parent = trackItem.transform.parent; selectedObject.transform.position = trackItem.transform.position; } else { Debug.Log("Shuffled Item not found" + currentTrackObject.name); } } } } } }
public static void LoadObj(string path, GameObject obj) { if (string.IsNullOrEmpty(path)) { return; } //Debug.Log(path); if (path.Contains("(#Interal)")) { path = path.Replace("(#Interal)", ""); switch (path) { case "Water": Vector3 scalew = obj.transform.localScale; obj = Object.Instantiate(GameData.InteralObjects[0].obj, obj.transform.position, obj.transform.rotation, obj.transform.parent); obj.transform.localScale = scalew; obj.isStatic = true; //Debug.Log("Water"); break; case "ShooterPlant": Vector3 scalesp = obj.transform.localScale; var obja = Object.Instantiate(GameData.InteralObjects[1].obj, obj.transform.position, obj.transform.rotation, obj.transform.parent); obja.transform.localScale = scalesp; obja.name = obj.name; Object.Destroy(obj); obj = obja; AI aisp = obj.GetComponent <AI>(); //aisp.anim["idle"].speed = 2.25f; //aisp.anim.speed = aisp.anim["shoot"].length / (1f / aisp.rateOfFire + aisp.relaxTime); AnimationClip ac = null; for (int i = 0; i < aisp.anim.runtimeAnimatorController.animationClips.Length; i++) { if (aisp.anim.runtimeAnimatorController.animationClips[i].name == "shoot") { ac = aisp.anim.runtimeAnimatorController.animationClips[i]; break; } } if (ac != null) { aisp.anim.SetFloat("ShootAnimSpeed", ac.length / (1f / aisp.rateOfFire + aisp.relaxTime)); } //aisp.firingStartDelay = aisp.anim["shoot"].length / aisp.anim["shoot"].speed * 0.6f; /*if (aisp.anim["shoot"].clip.events.Length == 0) * { * AnimationEvent ae = new AnimationEvent(); * ae.functionName = "shootAmmo"; * ae.time = aisp.anim["shoot"].length * 0.6f; * ae.messageOptions = SendMessageOptions.DontRequireReceiver; * aisp.anim["shoot"].clip.AddEvent(ae); * }*/ break; case "AnkPatrol": Vector3 scalespap = obj.transform.localScale; var objak = Object.Instantiate(GameData.InteralObjects[2].obj, obj.transform.position, obj.transform.rotation, obj.transform.parent); objak.transform.localScale = scalespap; objak.name = obj.name; Object.Destroy(obj); obj = objak; //aisp.anim["idle"].speed = 2.25f; //aisp.anim.speed = aisp.anim["shoot"].length / (1f / aisp.rateOfFire + aisp.relaxTime); break; case "AnkAttack": Vector3 scalespapa = obj.transform.localScale; var objaka = Object.Instantiate(GameData.InteralObjects[3].obj, obj.transform.position, obj.transform.rotation, obj.transform.parent); objaka.transform.localScale = scalespapa; objaka.name = obj.name; Object.Destroy(obj); obj = objaka; break; case "LVL1Base": Vector3 scalel1 = obj.transform.localScale; obj = Object.Instantiate(GameData.InteralObjects[4].obj, obj.transform.position, obj.transform.rotation, obj.transform.parent); obj.transform.localScale = scalel1; obj.isStatic = true; break; case "IntroMesh": Vector3 scalel2 = obj.transform.localScale; obj = Object.Instantiate(GameData.InteralObjects[5].obj, obj.transform.position, obj.transform.rotation, obj.transform.parent); obj.transform.localScale = scalel2; obj.isStatic = true; break; case "LargeCliff": Vector3 scalel3 = obj.transform.localScale; obj = Object.Instantiate(GameData.InteralObjects[6].obj, obj.transform.position, obj.transform.rotation, obj.transform.parent); obj.transform.localScale = scalel3; obj.isStatic = true; break; case "SniperPlant": Vector3 scalessp = obj.transform.localScale; var objas = Object.Instantiate(GameData.InteralObjects[7].obj, obj.transform.position, obj.transform.rotation, obj.transform.parent); objas.transform.localScale = scalessp; objas.name = obj.name; Object.Destroy(obj); obj = objas; AI aisps = obj.GetComponent <AI>(); //aisp.anim["idle"].speed = 2.25f; //aisp.anim.speed = aisp.anim["shoot"].length / (1f / aisp.rateOfFire + aisp.relaxTime); AnimationClip acs = null; for (int i = 0; i < aisps.anim.runtimeAnimatorController.animationClips.Length; i++) { if (aisps.anim.runtimeAnimatorController.animationClips[i].name == "shoot") { acs = aisps.anim.runtimeAnimatorController.animationClips[i]; break; } } if (acs != null) { aisps.anim.SetFloat("ShootAnimSpeed", acs.length / (1f / aisps.rateOfFire + aisps.relaxTime)); } break; case "LVL4Base": Vector3 scalel4 = obj.transform.localScale; obj = Object.Instantiate(GameData.InteralObjects[8].obj, obj.transform.position, obj.transform.rotation, obj.transform.parent); obj.transform.localScale = scalel4; obj.isStatic = true; break; case "LVL5Base": Vector3 scalel5 = obj.transform.localScale; obj = Object.Instantiate(GameData.InteralObjects[9].obj, obj.transform.position, obj.transform.rotation, obj.transform.parent); obj.transform.localScale = scalel5; obj.isStatic = true; break; } return; } if (!File.Exists(path)) { path = System.IO.Directory.GetCurrentDirectory() + path; } XmlDocument doc = new XmlDocument(); doc.Load(path); XmlNode objData = doc.ChildNodes[0]; switch (objData.Attributes["Type"].Value) { case "Obstacle": if (objData.Attributes["CustomTag"] != null) { obj.tag = objData.Attributes["CustomTag"].Value; } else { obj.tag = "Obstacle"; } obj.isStatic = true; obj.AddComponent <MeshFilter>().mesh = LoadMesh(objData.ChildNodes[0].ChildNodes[0].InnerText); MeshRenderer renderer = obj.AddComponent <MeshRenderer>(); renderer.sharedMaterial = LoadMaterial(objData.ChildNodes[0].ChildNodes[1].InnerText); renderer.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off; renderer.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off; LoadCollider(objData.ChildNodes[0].ChildNodes[2].InnerText, obj, objData.ChildNodes[0].ChildNodes[2].Attributes.Count != 0 ? bool.Parse(objData.ChildNodes[0].ChildNodes[2].Attributes[0].Value) : false); break; case "MovingObstacle": if (objData.Attributes["CustomTag"] != null) { obj.tag = objData.Attributes["CustomTag"].Value; } else { obj.tag = "MovingObstacle"; } obj.AddComponent <MeshFilter>().mesh = LoadMesh(objData.ChildNodes[1].ChildNodes[0].InnerText); MeshRenderer rend = obj.AddComponent <MeshRenderer>(); rend.sharedMaterial = LoadMaterial(objData.ChildNodes[1].ChildNodes[1].InnerText); rend.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off; rend.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off; LoadCollider(objData.ChildNodes[1].ChildNodes[2].InnerText, obj, objData.ChildNodes[1].ChildNodes[2].Attributes.Count != 0 ? bool.Parse(objData.ChildNodes[1].ChildNodes[2].Attributes[0].Value) : false); Rigidbody r = obj.AddComponent <Rigidbody>(); r.mass = float.Parse(objData.ChildNodes[0].ChildNodes[0].InnerText); r.useGravity = bool.Parse(objData.ChildNodes[0].ChildNodes[1].InnerText); r.interpolation = (RigidbodyInterpolation)System.Enum.Parse(typeof(RigidbodyInterpolation), objData.ChildNodes[0].ChildNodes[2].InnerText); r.collisionDetectionMode = (CollisionDetectionMode)System.Enum.Parse(typeof(CollisionDetectionMode), objData.ChildNodes[0].ChildNodes[3].InnerText); r.constraints = ParseType <RigidbodyConstraints>(objData.ChildNodes[0].ChildNodes[4].InnerText + objData.ChildNodes[0].ChildNodes[5].InnerText); MovingObstacle mo = obj.AddComponent <MovingObstacle>(); mo.type = (MovingObstacle.ObstacleType)System.Enum.Parse(typeof(MovingObstacle.ObstacleType), objData.ChildNodes[1].Attributes[0].Value); XmlNodeList l = objData.ChildNodes[1].ChildNodes[3].ChildNodes; mo.points = new MovingObstacle.Point[l.Count]; for (int j = 0; j < l.Count; j++) { mo.points[j] = new MovingObstacle.Point(float.Parse(l[j].ChildNodes[0].InnerText) < Time.fixedDeltaTime ? Time.fixedDeltaTime : float.Parse(l[j].ChildNodes[0].InnerText), ParseType <Vector3>(l[j].ChildNodes[1].InnerText)); } break; case "Decoration": if (objData.Attributes["CustomTag"] != null) { obj.tag = objData.Attributes["CustomTag"].Value; } else { obj.tag = "Decoration"; } obj.isStatic = true; obj.AddComponent <MeshFilter>().mesh = LoadMesh(objData.ChildNodes[0].ChildNodes[0].InnerText); MeshRenderer rend_ = obj.AddComponent <MeshRenderer>(); rend_.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off; rend_.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off; rend_.material = LoadMaterial(objData.ChildNodes[0].ChildNodes[1].InnerText); break; case "StartPos": Scene.player.transform.position = obj.transform.position; break; case "Trigger": if (objData.ChildNodes[0].ChildNodes[1].InnerText.Trim() == "MeshCollider") { obj.AddComponent <MeshFilter>().mesh = LoadMesh(objData.ChildNodes[0].ChildNodes[0].InnerText); LoadCollider(objData.ChildNodes[0].ChildNodes[1].InnerText, obj, true, true); } else { LoadCollider(objData.ChildNodes[0].ChildNodes[1].InnerText, obj, false, true); } Rigidbody tr = obj.AddComponent <Rigidbody>(); tr.constraints = RigidbodyConstraints.FreezeAll; tr.useGravity = false; Trigger trig = obj.AddComponent <Trigger>(); List <string> ls = new List <string>(objData.ChildNodes[0].ChildNodes[2].InnerText.Split(' ', '(', ')', '\n')); ls.RemoveAll(string.IsNullOrEmpty); if (ls.Count > 0) { switch (ls[0]) { case "PlayerLose": trig.OnPlayerEnter = Trigger.EventAction.PlayerLose; trig.arg1 = null; break; case "PlayerGainHp": trig.OnPlayerEnter = Trigger.EventAction.PlayerGainHp; trig.arg1 = float.Parse(ls[1]); break; case "PlayerWin": trig.OnPlayerEnter = Trigger.EventAction.PlayerWin; trig.arg1 = null; break; default: ///NOTHING break; } } ls = new List <string>(objData.ChildNodes[0].ChildNodes[3].InnerText.Split(' ', '(', ')', '\n')); ls.RemoveAll(string.IsNullOrEmpty); if (ls.Count > 0) { switch (ls[0]) { case "PlayerLose": trig.OnPlayerStay = Trigger.EventAction.PlayerLose; trig.arg2 = null; break; case "PlayerGainHp": trig.OnPlayerStay = Trigger.EventAction.PlayerGainHp; trig.arg2 = float.Parse(ls[1]); break; case "PlayerWin": trig.OnPlayerStay = Trigger.EventAction.PlayerWin; trig.arg2 = null; break; default: ///NOTHING break; } } ls = new List <string>(objData.ChildNodes[0].ChildNodes[4].InnerText.Split(' ', '(', ')', '\n')); ls.RemoveAll(string.IsNullOrEmpty); if (ls.Count > 0) { switch (ls[0]) { case "PlayerLose": trig.OnPlayerExit = Trigger.EventAction.PlayerLose; trig.arg3 = null; break; case "PlayerGainHp": trig.OnPlayerExit = Trigger.EventAction.PlayerGainHp; trig.arg3 = float.Parse(ls[1]); break; case "PlayerWin": trig.OnPlayerExit = Trigger.EventAction.PlayerWin; trig.arg3 = null; break; } } break; case "CollectableItem": obj.layer = 8; obj.AddComponent <MeshFilter>().mesh = LoadMesh(objData.ChildNodes[0].ChildNodes[0].InnerText); MeshRenderer rend__ = obj.AddComponent <MeshRenderer>(); rend__.material = LoadMaterial(objData.ChildNodes[0].ChildNodes[1].InnerText); rend__.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off; rend__.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off; LoadCollider(objData.ChildNodes[0].ChildNodes[2].InnerText, obj, objData.ChildNodes[0].ChildNodes[2].Attributes.Count != 0 ? bool.Parse(objData.ChildNodes[0].ChildNodes[2].Attributes[0].Value) : false, true); Rigidbody rig__ = obj.AddComponent <Rigidbody>(); rig__.interpolation = RigidbodyInterpolation.Interpolate; rig__.useGravity = false; CollectableItem ci = obj.AddComponent <CollectableItem>(); ci.action = (CollectableItem.CollectableItemGain)System.Enum.Parse(typeof(CollectableItem.CollectableItemGain), objData.ChildNodes[0].ChildNodes[3].InnerText); ci.dissapearEffect = UnityEngine.MonoBehaviour.Instantiate(GameData.ParticleEffects[int.Parse(objData.ChildNodes[0].ChildNodes[6].InnerText)], Scene.rootObject.transform); ci.dissapearEffect.transform.position = ci.transform.position; ci.dissapearEffect.SetActive(false); switch (ci.action) { case CollectableItem.CollectableItemGain.MaxHpIncrease: ci.arg1 = float.Parse(objData.ChildNodes[0].ChildNodes[4].InnerText); ci.arg2 = null; break; case CollectableItem.CollectableItemGain.HealPlayer: ci.arg1 = float.Parse(objData.ChildNodes[0].ChildNodes[4].InnerText); ci.arg2 = null; break; case CollectableItem.CollectableItemGain.BoostSpeed: ci.arg1 = float.Parse(objData.ChildNodes[0].ChildNodes[4].InnerText); ci.arg2 = float.Parse(objData.ChildNodes[0].ChildNodes[5].InnerText); break; default: break; } break; case "AI": obj.layer = 9; obj.tag = "AI"; Rigidbody airig = obj.AddComponent <Rigidbody>(); airig.mass = float.Parse(objData.ChildNodes[0].ChildNodes[0].InnerText); airig.useGravity = bool.Parse(objData.ChildNodes[0].ChildNodes[1].InnerText); airig.interpolation = (RigidbodyInterpolation)System.Enum.Parse(typeof(RigidbodyInterpolation), objData.ChildNodes[0].ChildNodes[2].InnerText); airig.collisionDetectionMode = (CollisionDetectionMode)System.Enum.Parse(typeof(CollisionDetectionMode), objData.ChildNodes[0].ChildNodes[3].InnerText); airig.constraints = ParseType <RigidbodyConstraints>(objData.ChildNodes[0].ChildNodes[4].InnerText + objData.ChildNodes[0].ChildNodes[5].InnerText); obj.AddComponent <MeshFilter>().mesh = LoadMesh(objData.ChildNodes[1].ChildNodes[0].InnerText); MeshRenderer rend___ = obj.AddComponent <MeshRenderer>(); rend___.material = LoadMaterial(objData.ChildNodes[1].ChildNodes[1].InnerText); rend___.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off; rend___.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off; LoadCollider(objData.ChildNodes[1].ChildNodes[2].InnerText, obj, false, false); BoxCollider boxcol = obj.AddComponent <BoxCollider>(); boxcol.isTrigger = true; boxcol.size = ParseType <Vector3>(objData.ChildNodes[1].ChildNodes[3].InnerText); boxcol.center = ParseType <Vector3>(objData.ChildNodes[1].ChildNodes[4].InnerText); AI ai = obj.AddComponent <AI>(); ai.hp = float.Parse(objData.ChildNodes[1].ChildNodes[5].InnerText); ai.hp_max = float.Parse(objData.ChildNodes[1].ChildNodes[6].InnerText); ai.type = (AI.AIType)System.Enum.Parse(typeof(AI.AIType), objData.ChildNodes[1].ChildNodes[7].InnerText); ai.speed = float.Parse(objData.ChildNodes[1].ChildNodes[8].InnerText); ai.rotateStop = bool.Parse(objData.ChildNodes[1].ChildNodes[9].InnerText); ai.rotSpeed = float.Parse(objData.ChildNodes[1].ChildNodes[10].InnerText); ai.patrolPoints = new Vector3[objData.ChildNodes[1].ChildNodes[11].ChildNodes.Count]; for (int i = 0; i < ai.patrolPoints.Length; i++) { ai.patrolPoints[i] = ParseType <Vector3>(objData.ChildNodes[1].ChildNodes[11].ChildNodes[i].InnerText); } ai.toleratedDistance = float.Parse(objData.ChildNodes[1].ChildNodes[12].InnerText); ai.activeDistance = float.Parse(objData.ChildNodes[1].ChildNodes[13].InnerText); ai.onGroundRaycastLenght = float.Parse(objData.ChildNodes[1].ChildNodes[14].InnerText); ai.checksBeforeItGoes = bool.Parse(objData.ChildNodes[1].ChildNodes[15].InnerText); ai.forwardRacastCheckLength = float.Parse(objData.ChildNodes[1].ChildNodes[16].InnerText); ai.downRaycastCheckLength = float.Parse(objData.ChildNodes[1].ChildNodes[17].InnerText); GameObject ammo = new GameObject(); ammo.transform.parent = Scene.rootObject.transform; LoadObj(System.IO.Directory.GetCurrentDirectory() + objData.ChildNodes[1].ChildNodes[18].InnerText, ammo); ai.ammo = ammo; ai.ammoLifeTime = float.Parse(objData.ChildNodes[1].ChildNodes[19].InnerText); ai.rateOfFire = float.Parse(objData.ChildNodes[1].ChildNodes[20].InnerText); ai.relaxTime = float.Parse(objData.ChildNodes[1].ChildNodes[21].InnerText); ai.shootPointOffset = ParseType <Vector3>(objData.ChildNodes[1].ChildNodes[22].InnerText); ai.shootHeight = float.Parse(objData.ChildNodes[1].ChildNodes[23].InnerText); ai.damageOnCollision = float.Parse(objData.ChildNodes[1].ChildNodes[24].InnerText); break; case "Ammo": obj.layer = 11; Rigidbody ammorig = obj.AddComponent <Rigidbody>(); ammorig.mass = float.Parse(objData.ChildNodes[0].ChildNodes[0].InnerText); ammorig.useGravity = bool.Parse(objData.ChildNodes[0].ChildNodes[1].InnerText); ammorig.interpolation = (RigidbodyInterpolation)System.Enum.Parse(typeof(RigidbodyInterpolation), objData.ChildNodes[0].ChildNodes[2].InnerText); ammorig.collisionDetectionMode = (CollisionDetectionMode)System.Enum.Parse(typeof(CollisionDetectionMode), objData.ChildNodes[0].ChildNodes[3].InnerText); ammorig.constraints = ParseType <RigidbodyConstraints>(objData.ChildNodes[0].ChildNodes[4].InnerText + objData.ChildNodes[0].ChildNodes[5].InnerText); obj.AddComponent <Ammo>(); GameObject effect = (MonoBehaviour.Instantiate(GameData.ParticleEffects[int.Parse(objData.ChildNodes[1].ChildNodes[0].InnerText)])); effect.transform.position = obj.transform.position; effect.transform.parent = obj.transform; LoadCollider(objData.ChildNodes[1].ChildNodes[1].InnerText, obj, false, true); obj.transform.localScale = ParseType <Vector3>(objData.ChildNodes[1].ChildNodes[2].InnerText); obj.SetActive(false); break; } }