protected void Init() { _id = gameObject.GetInstanceID(); infoCanvas = Instantiate <InfoCanvas>(infoCanvas, transform.position, transform.rotation); if (minionType == MinionType.MiniZeppelin) { infoCanvas.Init(hp, 0, 0, true); } else { infoCanvas.Init(hp, skillTime, skillCooldown); } if (minionType == MinionType.Runner)//bugfix of next node when using runner skill. { pDistanceToNextNode = 0.5f; } _initHP = hp; _normalSpeed = speed; if (Debug.isDebugBuild) { var parent = GameObject.Find("InfoCanvasParent"); if (parent == null) { parent = new GameObject("InfoCanvasParent"); } infoCanvas.transform.SetParent(parent.transform); } foreach (Transform item in transform) { if (item.tag == "ShieldBubble") { pShieldBubble = item.gameObject; pShieldBubble.SetActive(false); break; } } }
void Awake() { instance = this; }
private void Start() { if (transperantMat == null) { this.transperantMat = Resources.Load("Materials/transperantMat", typeof(Material)) as Material; this.inputPanelPrefab = Resources.Load("Prefabs/WorldSpaceCanvases/ConstantCanvasPrefab", typeof(GameObject)) as GameObject; this.resultAndVariablesPanelPrefab = Resources.Load("Prefabs/WorldSpaceCanvases/ResultCanvasPrefab", typeof(GameObject)) as GameObject; this.worldSpaceTextPrefab = Resources.Load("Prefabs/WorldSpaceCanvases/WorldSpaceTextPrefab", typeof(GameObject)) as GameObject; } this.spellcraftParent = new GameObject("Spellcraft Parent"); this.persistantParent = new GameObject("Persistant Parent"); this.connTracker = new ConnectionsTracker(this); //Rotation of class nodes implementation that wull be replaced this.rotatorGO = new GameObject("Rotator"); this.rotatorGO.transform.SetParent(this.spellcraftParent.transform); //... //Parented this.drawer = new LineDrawer(this); this.drawer.DrawBox(SpellcraftConstants.HalfSize, SpellcraftConstants.Thickness, SpellcraftConstants.BoxCenter); this.myCamera = GameObject.Find("Camera").GetComponent <Camera>(); this.camHandling = this.myCamera.gameObject.AddComponent <SpellcraftCam>(); this.myCamera2 = GameObject.Find("Camera2").GetComponent <Camera>(); this.camHandling2 = this.myCamera2.gameObject.AddComponent <SpellMenuDragCam>(); this.myCamera2.enabled = false; this.procUI = this.GetComponent <SpellcraftProcUI>(); this.procUI.Setup(this.myCamera2, this.connTracker, 0.035f); // Procedural SpellCraftUI float YY = 1000; this.procUI.SetCanvasPosition(new Vector3(0, YY, -1000)); this.procUIAnchor = new GameObject("ProcUIAnchor"); this.procUIAnchor.transform.position = new Vector3(0, YY, -2000); GameObject center = new GameObject("Center"); center.transform.SetParent(this.spellcraftParent.transform); this.camHandling.Setup(center); this.classVisualisation = new ClassVisualisation(this); this.resultCanvas = new ResultCanvas(this.resultAndVariablesPanelPrefab, this.myCamera, this.connTracker, this.persistantParent.transform); this.resultCanvas.SetPosition(new Vector3(0, 0, -25)); this.resultCanvas.SetScale(new Vector3(0.02f, 0.02f, 0.02f)); this.resultCanvas.Hide(); this.inputCanvas = new InputCanvas(this.myCamera, this.inputPanelPrefab, this.persistantParent.transform); //Extract that somewhere this.resultGO = GameObject.CreatePrimitive(PrimitiveType.Sphere); this.resultGO.name = "Result GO"; this.resultGO.transform.SetParent(this.persistantParent.transform); this.resultGO.transform.position = new Vector3(0, -15, 0); this.resultNode = this.resultGO.AddComponent <ResultNode>(); //... this.connRegisterer = new ConnectionsRegisterer(this.connTracker, this.inputCanvas, this.drawer, this.resultNode); this.infoCanvas = new InfoCanvas(this.worldSpaceTextPrefab, this.myCamera, this.spellcraftParent.transform); this.levels = new Setups(this.resultCanvas, this.inputCanvas, this.connRegisterer, this, this.resultNode, this.classVisualisation); this.resultCanvasVantigePoint = new GameObject("VantigePoint"); this.resultCanvasVantigePoint.transform.position = new Vector3(0, 0, -30); this.resultCanvasVantigePoint.transform.SetParent(this.spellcraftParent.transform); this.dynamicSetup = new DynamicSetup(this.classVisualisation, this, this.resultCanvas, this.inputCanvas); //this.levels.JustTwoAddMethod(true); if (LoadLevel) { this.levels.LineDestroyer(false); } else { this.connTracker.RegisterBundle(null); } this.spellcraftParent.transform.position = this.position; this.persistantParent.transform.position = this.position; }