void SpawnBoss(Message message) { messageQueue.Dequeue(); scrGUI.Instance.AddToFeed(message.page_title, Color.red); scrBoss boss = ((GameObject)Instantiate(NodeBossPrefab, GetRandomFreePosition(true), Quaternion.identity)).GetComponent <scrBoss>(); boss.Init(message); scrResults.ReversionEdits.Add(message); }
public void Init(LinkedListNode <GameObject> node, Message data, int coreSize, bool infected, string[] words) { ready = false; Node = node; Data = data; Uploading = false; infectionPulseTimer = 0.0f; spawnTimer = 0.0f; wordIndex = 0; this.words = words; // Unlink all nodes. CurrentLinks = 0; for (int i = 0; i < LINKS_MAX; ++i) { linkedNodes[i] = null; links[i].enabled = false; linkExpandTimers[i] = 0.0f; } expandTimer = 0; // Get an enumerator to the list item containing the positions this node will use when being built. cubePositionEnumerator = CubePositions.GetEnumerator(); for (int i = 0; i < coreSize; ++i) { cubePositionEnumerator.MoveNext(); } cubePositionIndex = 0; Cubes = new LinkedListNode <GameObject> [cubePositionEnumerator.Current.Length]; ChildCore.transform.localScale = new Vector3(coreSize, coreSize, coreSize); ChildInfo.transform.rotation = Quaternion.identity; // Set the distance of the infos based on the core size. ChildData[0].transform.localPosition = new Vector3(0, coreSize * 4, 0); ChildData[1].transform.localPosition = new Vector3(coreSize * 4, 0, 0); ChildData[2].transform.localPosition = new Vector3(0, -coreSize * 4, 0); ChildData[3].transform.localPosition = new Vector3(-coreSize * 4, 0, 0); // Set the data of the infos. ChildData[0].GetComponent <TextMesh>().text = Data.page_title; ChildData[1].GetComponent <TextMesh>().text = "User: "******"Altered: " + (Data.change_size > 0 ? ("+" + Data.change_size.ToString()) : Data.change_size.ToString()) + " Bytes"; ChildData[3].GetComponent <TextMesh>().text = "Country: " + (Data.geo == null ? "Unknown" : data.geo.country_name); FullyInfected = infected; Infected = infected; // If fully infected, all cubes are infected. if (FullyInfected) { infectionPulseDelay = PULSE_DELAY_MAX * (1 - (coreSize - 1) / CORE_SIZE_MAX); InfectedCubeCount = Cubes.Length; ChildCore.renderer.material = scrNodeMaster.Instance.MatCoreInfected; scrBoss boss = ((GameObject)Instantiate(scrNodeMaster.Instance.NodeBossPrefab, transform.position, Quaternion.identity)).GetComponent <scrBoss>(); boss.Init(Data); } else { InfectedCubeCount = 0; ChildCore.renderer.material = Blocked ? scrNodeMaster.Instance.MatCoreBlocked : scrNodeMaster.Instance.MatCoreUninfected; } totalCubeCount = Cubes.Length; GetComponent <BoxCollider2D>().size = new Vector2(coreSize * 4.5f, coreSize * 4.5f); ChildInfo.GetComponent <CircleCollider2D>().radius = coreSize * 0.5f; }