private static void SetFixedBlock(CompilerState state, DocumentElement content, FixedPosition position) { var block = new FixedBlock(content) { Position = position }; if (position.HasFlag(FixedPosition.Bottom)) { block.Classes.Add("footer"); } else if (position.HasFlag(FixedPosition.Top)) { block.Classes.Add("header"); } for (int i = 0; i < state.Document.PageItems.Count; i++) { var item = state.Document.PageItems[i]; if (item is FixedBlock fix && fix.Position == position) { state.Document.PageItems.RemoveAt(i); break; } } state.Document.PageItems.Add(block); }
// Start is called before the first frame update void Start() { playerNumber = GameObject.Find("GetPlayerNumber"); getPlayerNumber = playerNumber.GetComponent <RacePlayerNumber>(); root = transform.root.gameObject; audioSource = GetComponent <AudioSource>(); if (root == getPlayerNumber.getNumber[0]) { FixedObj = GameObject.Find("FixedObj (1)"); } else if (root == getPlayerNumber.getNumber[1]) { FixedObj = GameObject.Find("FixedObj (2)"); } else if (root == getPlayerNumber.getNumber[2]) { FixedObj = GameObject.Find("FixedObj (3)"); } else if (root == getPlayerNumber.getNumber[3]) { FixedObj = GameObject.Find("FixedObj (4)"); } darumaItem = FixedObj.GetComponent <FixedBlock>(); destroyMove = false; }
public LevelManager(FixedBlock fixedBlockPrefab, WeakBlock weakBlockPrefab, EnemyManager enemyManager, PlayerManager playerManager) { this.playerManager = playerManager; this.playerManager.SetLevelManager(this); levelController = new LevelController(fixedBlockPrefab, weakBlockPrefab, enemyManager, playerManager, this); }
public LevelController(FixedBlock fixedBlockPrefab, WeakBlock weakBlockPrefab, EnemyManager enemyManager, PlayerManager playerManager, LevelManager levelManager) { this.playerManager = playerManager; this.enemyManager = enemyManager; this.levelManager = levelManager; this.fixedBlockPref = fixedBlockPrefab; this.weakBlockPref = weakBlockPrefab; gridWidth = (int)GameManager.Instance.gridSize.x; gridHeight = (int)GameManager.Instance.gridSize.y; enemyCount = GameManager.Instance.enemyCount; GameManager.Instance.restartGame += RestartGame; }
// Use this for initialization void Start() { if (!this.transform.CompareTag("MovableMulti")) { Debug.LogError("Not MultipleCube has this component"); } else { foreach (Transform form in this.transform) { FixedBlock temp = form.gameObject.AddComponent <FixedBlock>(); temp.enabled = false; } } }
private static void SetFixedBlock(CompilerState state, Paragraph content, FixedPosition position) { var block = new FixedBlock(content) { Position = position }; for (int i = 0; i < state.Document.PageItems.Count; i++) { var item = state.Document.PageItems[i]; if (item is FixedBlock fix && fix.Position == position) { state.Document.PageItems.RemoveAt(i); break; } } state.Document.PageItems.Add(block); }
public static Block[] StageLoad(string stagename) { string path = Application.dataPath + "/Resources/StageFiles/" + stagename + ".csv"; FileInfo fileInfo = new FileInfo(path); FileStream fileStream = fileInfo.OpenRead(); StreamReader streamReader = new StreamReader(fileStream); string data = streamReader.ReadToEnd(); #if UNITY_EDITOR Debug.Log(data); #endif // 改行で分割(各ブロックごとに string[] enter = { "\n" }; string[] arr = data.Split(enter, StringSplitOptions.None); // 1行目のLength情報を取得 string[] comma = { "," }; string[] temp = arr[0].Split(comma, StringSplitOptions.None); Block[] stage = new Block[int.Parse(temp[1])]; // 最後の改行を除くので-1 for (int i = 1; i < arr.Length - 1; i++) { Block block = null; // それぞれ型名で書き出しているので型名で検索かければOK if (arr[i].IndexOf(nameof(GoalBlock)) >= 0) { block = GoalBlock.Instantiate(); } else if (arr[i].IndexOf(nameof(NormalBlock)) >= 0) { block = NormalBlock.Instantiate(); } else if (arr[i].IndexOf(nameof(CannotBlock)) >= 0) { block = CannotBlock.Instantiate(); } else if (arr[i].IndexOf(nameof(AcidBlock)) >= 0) { block = AcidBlock.Instantiate(); } else if (arr[i].IndexOf(nameof(FixedBlock)) >= 0) { block = FixedBlock.Instantiate(); } // 矢印は方向プロパティも読み込む else if (arr[i].IndexOf(nameof(ArrowBlock)) >= 0) { string[] direction = arr[i].Split(comma, StringSplitOptions.None); block = ArrowBlock.Instantiate((ArrowBlock.Direction) int.Parse(direction[1])); } // 中間ブロックはレベルプロパティも読み込む else if (arr[i].IndexOf(nameof(FriendBlock)) >= 0) { string[] level = arr[i].Split(comma, StringSplitOptions.None); block = FriendBlock.Instantiate(int.Parse(level[1])); } // どれにも一致しなければファイル破損として扱う else { Debug.Log(stagename + " is corrupted!"); Debug.Log(arr[i]); return(null); } stage[i - 1] = block; } return(stage); }
// Start is called before the first frame update void Start() { GrandchildObj1 = transform.Find("RotationCenter/sourceBlock").gameObject; GrandchildObj2 = transform.Find("RotationCenter/sourceBlock (1)").gameObject; GrandchildObj3 = transform.Find("RotationCenter/sourceBlock (2)").gameObject; GrandchildObj4 = transform.Find("RotationCenter/sourceBlock (3)").gameObject; spriteRenderer1 = GrandchildObj1.GetComponent <SpriteRenderer>(); spriteRenderer2 = GrandchildObj2.GetComponent <SpriteRenderer>(); spriteRenderer3 = GrandchildObj3.GetComponent <SpriteRenderer>(); spriteRenderer4 = GrandchildObj4.GetComponent <SpriteRenderer>(); audioSource = GetComponent <AudioSource>(); rb2 = GetComponent <Rigidbody2D>(); collider = gameObject.GetComponentsInChildren <BoxCollider2D>(); for (int i = 0; i < 4; i++) { collider[i].enabled = false; } timerObject = GameObject.Find("TimeObject"); timerScript = timerObject.GetComponent <Timer>(); timerCheck = timerScript.TimerCount; playerNumber = GameObject.Find("GetPlayerNumber"); getPlayerNumber = playerNumber.GetComponent <RacePlayerNumber>(); root = transform.root.gameObject; if (root == getPlayerNumber.getNumber[0]) { raceCreateObject = GameObject.Find("BlockCreate (1)"); FixedObj = GameObject.Find("FixedObj (1)"); } else if (root == getPlayerNumber.getNumber[1]) { raceCreateObject = GameObject.Find("BlockCreate (2)"); FixedObj = GameObject.Find("FixedObj (2)"); } else if (root == getPlayerNumber.getNumber[2]) { raceCreateObject = GameObject.Find("BlockCreate (3)"); FixedObj = GameObject.Find("FixedObj (3)"); } else if (root == getPlayerNumber.getNumber[3]) { raceCreateObject = GameObject.Find("BlockCreate (4)"); FixedObj = GameObject.Find("FixedObj (4)"); } raceCreateScript = raceCreateObject.GetComponent <RaceCreate>(); fixedPermit = FixedObj.GetComponent <FixedBlock>(); blockWaiver = false; fixedBlock = false; if (timerCheck >= 0) { start = true; } else { if (root == getPlayerNumber.getNumber[0]) { fallBlock = GameObject.Find("FallBlock1"); goalLineObject = GameObject.Find("GoalLineObject (1)"); } else if (root == getPlayerNumber.getNumber[1]) { fallBlock = GameObject.Find("FallBlock2"); goalLineObject = GameObject.Find("GoalLineObject (2)"); } else if (root == getPlayerNumber.getNumber[2]) { fallBlock = GameObject.Find("FallBlock3"); goalLineObject = GameObject.Find("GoalLineObject (3)"); } else if (root == getPlayerNumber.getNumber[3]) { fallBlock = GameObject.Find("FallBlock4"); goalLineObject = GameObject.Find("GoalLineObject (4)"); } raceBlockMgr = fallBlock.GetComponent <RaceBlockMgr>(); myBlockMgr = gameObject.GetComponent <RaceBlockMgr>(); goalLine = goalLineObject.GetComponent <GoalLine>(); standBy = true; start = false; } }