internal void SpawnText(Vector3 iniPosPass, string msgP = "") { //spwan a message if (msgP != "") { textMessage = (Btn3D)General.Create(Root.menusTextMiddle, iniPosPass); textMessage.MoveSpeed = 40f; //so fade happens textMessage.FadeDirection = "FadeIn"; textMessage.GetComponent <GUIText>().text = msgP; } //spwans a tip else if (Program.MOUSEOVERTHIS != null) { if (Tips.ReturnTip(Program.MOUSEOVERTHIS.name) != "No tips") { if (tipHover) { tipMenu = (Btn3D)General.Create(Root.menusTextLeft, iniPosPass); tipMenu.MoveSpeed = 40f; //so fade happens tipMenu.FadeDirection = "FadeIn"; tipMenu.GetComponent <GUIText>().text = Tips.ReturnTip(Program.MOUSEOVERTHIS.name); tipHover = false; } else if (tipMenu.GetComponent <GUIText>().text != Tips.ReturnTip(Program.MOUSEOVERTHIS.name)) { tipMenu.GetComponent <GUIText>().text = Tips.ReturnTip(Program.MOUSEOVERTHIS.name); tipMenu.transform.position = iniPosPass; } } else if (Tips.ReturnTip(Program.MOUSEOVERTHIS.name) == "No tips") { DestroyTipMenu(); } } }
//will bribg foward an Menu Obj Towards the camera void BringForward(Transform transfPass = null, string action = "") { float step = 0.15f;//setp to brong fprward if (toBringForward && transfPass != null) { for (int i = 0; i < menusArrayOne.Length; i++) { if (menusArrayOne[i] != null) { //and that object in the array was positionedFixed already then if (menusArrayOne[i].PositionFixed) { //if the transform object passed contains the name of the menusArrayOne[i]... if (transfPass.name.Contains(menusArrayOne[i].transform.name)) { //we make hovered temp this... hoveredTemp = menusArrayOne[i]; } } } } //if hoevered was assign then if (hoveredTemp != null) { //we will birng it a step tpwards the screen hoveredTemp.MovingToPosition = Vector3.MoveTowards(transfPass.position, Camera.main.transform.position, step); toBringForward = false; } } //bring it back to origin else if (!toBringForward && action == "BackToOrigin") { hoveredTemp.MovingToPosition = hoveredTemp.InitialPosition; toBringForward = true; } }
internal void DestroyTipMenu() { if (tipMenu != null && !tipHover) { tipMenu.Destroyer(); tipMenu = null; tipHover = true; } }
// Use this for initialization private void Start() { if (Developer.IsDev) { GameSpeed = 0; } Debug.Log("GameScene Start():" + Time.time); Book.Start(); if (HType == H.Create) { LoadTerrain(); } GameController1.Start(); StartCoroutine("SixtySecUpdate"); StartCoroutine("OneSecUpdate"); textMessage = (Btn3D)General.Create(Root.menusTextMiddle, new Vector3(0.85f, 0.3f, 0)); textMessage.MoveSpeed = 40f; //so fade happens textMessage.FadeDirection = "FadeIn"; dummyBlue = General.Create(Root.blueCubeBig, new Vector3()); dummyRed = General.Create(Root.redCube, new Vector3()); createDummySpawn = true; dummySpawnPoint = (Structure)Building.CreateBuild(Root.dummyBuildWithSpawnPointUnTimed, new Vector3(), H.Dummy, container: Program.ClassContainer.transform); //hudColor = textMessage.GetComponent<GUIText>().color; ProgramDataInit(); if (GameTimePeople == null) { GameTimePeople = new GameTime(ModController.PeopleAgeFactor()); } _unitsManager = FindObjectOfType <UnitsManager>(); _enemyManager = FindObjectOfType <EnemyManager>(); Debug.Log("GameScene Start():" + Time.time); }
/// <summary> /// It finds the single board obj and replace it with the one for the selected character /// </summary> /// <param name="setOfBtns">The set of buttons passed</param> /// <param name="rootP">The obj root will be spawn</param> private void SelectPlayerRoutine(Button[] setOfBtns, string rootP) { int indexOfSingleB = -1; Btn3D singleBoard = (Btn3D)USearch.FindBtnInColl(setOfBtns, "SingleBoard", out indexOfSingleB); string storeTemp = singleBoard.gameObject.name; moveToPosTemp = singleBoard.MovingToPosition; Destroy(singleBoard.gameObject); MenuHandler.CREATEMENU = true; //Single Board object handlgins singleBoard = (Btn3D)CreateBtn(singleBoard, rootP, moveToPosTemp); singleBoard.gameObject.name = storeTemp; singleBoard.MovingToPosition = moveToPosTemp; //needs to be assign otherwise after being hovered lose movetoPos singleBoard.InitialPosition = moveToPosTemp; MenuHandler.CREATEMENU = false; //asign this back to the array so as is reference the array will hold this new obj now setOfBtns[indexOfSingleB] = singleBoard; }
//Creates physical connection btw two points public void ThreeDConnectionCreator(Vector3 originPass, Vector3 targetPass, MenusType middleModel, MenusType connectionModel) { Vector3[] spheresLink = new Vector3[8]; //if flag is on... and is on Start() if (!areConnectionSpheresCreated) { //find all Vector3 point btw origin and this for (float where = 0.1f; where < 1f; where = where + 0.1f) { //if is not the middle one if (where != 0.5f) { //will assign Vector3 position.. will find distance btw points given 'where' (where 0-1, 1 is 100%) spheresLink[spheresLinkIndex] = FindMiddlePoint(originPass, targetPass, where); if (spheresLinkIndex < 7) { //will add a new number to index spheresLinkIndex++; } } } //creates the middle sphere Btn3D sphereMiddle = (Btn3D)General.Create(Root.redSphereHelp, midPointBtwMenuAndOrigin); sphereMiddle.FadeDirection = "FadeIn"; sphereMiddle.name = "RedSphereHelpMid"; sphereMiddle.MoveSpeed = 100f;//needs speed cheat! otherwise doesnt do anything link[0] = sphereMiddle; //creates the link for (int i = 0; i < spheresLink.Length; i++) { Btn3D sphereLinkMenu = (Btn3D)General.Create(Root.yellowSphereHelp, spheresLink[i]); sphereLinkMenu.FadeDirection = "FadeIn"; sphereLinkMenu.name = "RedSphereHelpLink"; sphereLinkMenu.MoveSpeed = 20f + i * 30f;//speed diferent for each one.. so gives sensation of graduality link[i + 1] = sphereLinkMenu; } //will set to false the flag areConnectionSpheresCreated = true; } }