void CreateExtrusion(GameObject extrudePanel) { walls.SetActive(true); walls.transform.position = extrudePanel.transform.position; walls.transform.rotation = extrudePanel.transform.rotation; PanelScript panelScript = extrudePanel.GetComponent <PanelScript>(); //for the 4 nodes of the selected panel float mouseDis = 1.0f; Vector3 normal = panelScript.GetNormal(); for (int i = 0; i < panelScript.nodes.Count; i++) { ghostNodes.Insert(i, Instantiate(nodePrefab, panelScript.nodes[i].transform.position, panelScript.nodes[i].transform.rotation)); ghostNodes[i].transform.position = panelScript.nodes[i].transform.position + (normal * mouseDis); } //Build Panels List <GameObject> ghostNodeConnectors = new List <GameObject>() { ghostNodes[0].GetComponent <NodeScript>().nodeConnector, ghostNodes[1].GetComponent <NodeScript>().nodeConnector, ghostNodes[2].GetComponent <NodeScript>().nodeConnector, ghostNodes[3].GetComponent <NodeScript>().nodeConnector, }; platforms.Insert(0, BuildPanel(ghostNodeConnectors)); platforms.Insert(1, BuildPanel(CreateNodeList(panelScript, 0, 1))); platforms.Insert(2, BuildPanel(CreateNodeList(panelScript, 1, 2))); platforms.Insert(3, BuildPanel(CreateNodeList(panelScript, 2, 3))); platforms.Insert(4, BuildPanel(CreateNodeList(panelScript, 3, 0))); }
void Raycast() { if (Input.GetButtonDown("Fire1")) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out whatIHit)) { foreach (GameObject go in panels) { PanelScript allPanels = go.GetComponent <PanelScript>(); allPanels.onActive = false; go.GetComponent <PanelScript>().sibling.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite = panel; } if (isTutorial) //toggle text tutorials { if (whatIHit.collider.name == "Panel2") { target.GetComponent <TextFade>().fadeMeIn = true; target2.GetComponent <TextFade>().fadeMeIn = false; } } hasHit = true; isMovable = true; PanelScript thisPanel = whatIHit.collider.gameObject.GetComponent <PanelScript>(); thisPanel.onActive = true; Debug.Log("LOL"); whatIHit.collider.gameObject.GetComponent <PanelScript>().sibling.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite = panelSelected; } } }
void Start() { Timer = GameObject.Find("TimePanel"); Player = GameObject.Find("UnityChan_2"); Timerscript = Timer.GetComponent <PanelScript>(); PlayerScript = Player.GetComponent <Player>(); }
void phaseChange() { panelscript = panelPosition.GetComponent <PanelScript> (); if (player.GetComponent <player> ().playerNumber == 1) { gamectr.changePhase(battlePhase.MAP12); } else if (player.GetComponent <player> ().playerNumber == 2) { gamectr.changePhase(battlePhase.MAP22); } else if (player.GetComponent <player> ().playerNumber == 3) { if (gamectr.player2.GetComponent <player>().isDead == true) { gamectr.changePhase(battlePhase.MAP22); } else { gamectr.changePhase(battlePhase.MAP2); } } else if (player.GetComponent <player> ().playerNumber == 4) { if (gamectr.player1.GetComponent <player>().isDead == true) { gamectr.changePhase(battlePhase.MAP12); } else { gamectr.changePhase(battlePhase.MAP1); } } }
public void Initialize(Character character, Tile tile) { this.Character = character; tile.BoardPiece = this.gameObject; this.gameObject.name = this.ToString(); this.MoveSpeed = character.MoveSpeed; this.Tile = tile; this.Team = Character.Team; this.Attack = Character.Attack; this.Defense = Character.Defense; this.Speed = Character.MoveSpeed; this.MaxHealth = Character.MaxHealth; this.Health = Character.MaxHealth; HasDied = false; _hasActed = true; HasMoved = true; TurnStartEffects = new List <Effect>(); TurnEndEffects = new List <Effect>(); healthBar = gameObject.GetComponentInChildren <BarController>(); healthBar.SetMaxValue(character.MaxHealth); healthBar.SetMinValue(0); healthBar.SetValue(character.MaxHealth); actionMenu = gameObject.GetComponentInChildren <PanelScript>(); actionMenu.unit = this; actionMenu.grid = Tile.gameBoard; this.InjuryMultiplier = character.InjuryMultiplier; this.HitMultiplier = character.HitMultiplier; if (Team == 0) { Image health = gameObject.transform.Find("HealthBarCanvas/healthBar/healthFill").gameObject.GetComponent <Image>(); health.color = Color.blue; } actionMenu.HidePanel(); }
/// <summary> /// 设置动态加载的面板 /// [外部调用] /// </summary> /// <param name="panelID">面板ID</param> private void SetPanel_DynamicLoading(EUIPanelID panelID) { //初始化一个结构体 StruUncommonPrefab tmpUncommonObj = new StruUncommonPrefab(); //将结构体存放到列表中 m_panelsList_DynamicLoading.Add(tmpUncommonObj); //主要就是加个ID,GameObject和一个倒计时时间 //并且对GameObject进行一些设置 m_panelsList_DynamicLoading[m_panelsList_DynamicLoading.Count - 1].panelID = panelID; //给需要长时间保持的面板,或者不通过UIMgr显示的面板一个足够长的时间 if (panelID == EUIPanelID.HelpDesPanel || panelID == EUIPanelID.HelpLeaguePanel) { m_panelsList_DynamicLoading[m_panelsList_DynamicLoading.Count - 1].countDownTimer = 999999; } else { //否则就十分钟一次~ m_panelsList_DynamicLoading[m_panelsList_DynamicLoading.Count - 1].countDownTimer = m_nSeconds; } m_panelsList_DynamicLoading[m_panelsList_DynamicLoading.Count - 1].panelObj = GameObject.Instantiate(Resources.Load("Panels/" + panelID + "/Panel")) as GameObject; m_panelsList_DynamicLoading[m_panelsList_DynamicLoading.Count - 1].panelObj.name = panelID.ToString(); m_panelsList_DynamicLoading[m_panelsList_DynamicLoading.Count - 1].panelObj.transform.parent = m_targetTopNode.transform; m_panelsList_DynamicLoading[m_panelsList_DynamicLoading.Count - 1].panelObj.transform.localScale = Vector3.one; m_panelsList_DynamicLoading[m_panelsList_DynamicLoading.Count - 1].panelObj.transform.localPosition = new Vector3(0, 0, m_panelsList_DynamicLoading[m_panelsList_DynamicLoading.Count - 1].panelObj.transform.localPosition.z); //简单的初始化 PanelScript tmpScript = m_panelsList_DynamicLoading[m_panelsList_DynamicLoading.Count - 1].panelObj.GetComponent <PanelScript>(); tmpScript.AppInit(); m_panelsList_DynamicLoading[m_panelsList_DynamicLoading.Count - 1].panelObj.SetActive(true); //注册这个面板的事件 m_eventMgrScript.RegisterEvent(panelID); }
// Use this for initialization void Start() { panelscript = panelPosition.GetComponent <PanelScript>(); gamectr = gameController.GetComponent <GameController>(); transform.position = panelPosition.transform.position; pawnMoveSPD = 0.3f; previosPanel = panelPosition; }
// Use this for initialization void Start() { r = GetComponent <Rigidbody>(); audioSource = GetComponent <AudioSource>(); mesh = GetComponent <MeshFilter>().mesh; meshRenderer = GetComponent <MeshRenderer>(); panelScript = GetComponent <PanelScript>(); }
void Awake() { Options = GameObject.Find("Options").GetComponent <PanelScript>(); Speech = GameObject.Find("DialoguePanel").GetComponent <PanelScript>(); NameText = GameObject.Find("Name").GetComponent <Text>(); DialogueText = GameObject.Find("Dialogue").GetComponent <Text>(); nPCAI = GameObject.Find("NPC").GetComponent <NPCAI>(); playerNav = GameObject.Find("PlayerNav").GetComponent <Image>(); }
// Start is called before the first frame update void Awake() { nameText = GameObject.Find("Name").GetComponent <Text>(); dialogueText = GameObject.Find("Dialogue").GetComponent <Text>(); //options = GameObject.Find("Options").GetComponent<PanelScript>(); display = GameObject.Find("DialoguePanel").GetComponent <PanelScript>(); nPCAI = GameObject.Find("NPC").GetComponent <NPCAI>(); //playerNav = GameObject.Find("PlayerNav").GetComponent<Image>(); player = GameObject.Find("PlayerController").GetComponent <SMPlayerStats>(); }
private void Awake() { PlayerStats = GameObject.Find("PlayerController").GetComponent <PlayerStats>(); NPCEntity = GameObject.Find("NPC").GetComponent <NPCEntity>(); button = gameObject.GetComponent <Button>(); playerTurn = GameObject.Find("PlayerNav").GetComponent <PlayerTurn>(); attack = GameObject.Find("Attack sub").GetComponent <PanelScript>(); skills = GameObject.Find("Skill sub").GetComponent <PanelScript>(); items = GameObject.Find("Item sub").GetComponent <PanelScript>(); options = GameObject.Find("Options").GetComponent <PanelScript>(); }
public void Start() { for (int i = 0; i < panels.Count; i++) { GameObject g = (GameObject)Instantiate(panel, content); PanelScript p = g.GetComponent <PanelScript>(); p.img.sprite = panels[i].ima; p.id = i; g.active = true; } }
void UpdateExtrusion(GameObject extrudePanel) { PanelScript panelScript = extrudePanel.GetComponent <PanelScript>(); for (int i = 0; i < ghostNodes.Count; i++) { Vector3 normal = panelScript.GetNormal(); Vector3 mouseDir = Vector3.Normalize(mouseHitLoc - extrudePanel.transform.position); float mouseDis = Mathf.Clamp(Vector3.Distance(mouseHitLoc, extrudePanel.transform.position) * Vector3.Dot(normal, mouseDir), 0.1f, 1.5f); ghostNodes[i].transform.position = panelScript.nodes[i].transform.position + (normal * mouseDis); } }
List <GameObject> CreateNodeList(PanelScript panelScript, int nodeA, int nodeB) { List <GameObject> nodeConnectors = new List <GameObject>() { panelScript.nodes[nodeA].GetComponent <NodeScript>().nodeConnector, panelScript.nodes[nodeB].GetComponent <NodeScript>().nodeConnector, ghostNodes[nodeB].GetComponent <NodeScript>().nodeConnector, ghostNodes[nodeA].GetComponent <NodeScript>().nodeConnector, }; return(nodeConnectors); }
void Awake() { if (Instance) // Prevents creation of second Mario while loading level { Destroy(gameObject); Start(); } else { DontDestroyOnLoad(gameObject); Instance = this; } }
// Use this for initialization void Start() { body = GetComponent <Rigidbody> (); panel = GetComponentInChildren <PanelScript> (); //Set part types for damage indicator leftWing.type = PanelScript.Parts.WING_LEFT; rightWing.type = PanelScript.Parts.WING_RIGHT; rightElevator.type = PanelScript.Parts.ELEVATOR_RIGHT; leftElevator.type = PanelScript.Parts.ELEVATOR_LEFT; fuselage.type = PanelScript.Parts.FUSELAGE; rightTailPart.type = PanelScript.Parts.TAIL; leftTailPart.type = PanelScript.Parts.TAIL; }
void Start() { panel = GetComponentInChildren <PanelScript> (); //Get all pylons pylons = GetComponentsInChildren <PylonScript> (); //Sort pylons based on ID (From left to right) Array.Sort(pylons, delegate(PylonScript p1, PylonScript p2) { return(p1.ID.CompareTo(p2.ID)); }); foreach (PylonScript pylon in pylons) { print(pylon.ID); } }
void Awake() { player = GameObject.Find("PlayerController").GetComponent <SMPlayerStats>(); //dialogueManager = GameObject.Find("DialogueManager").GetComponent<DialogueManager>(); Continue = GameObject.Find("Continue").GetComponent <Button>(); playerNav = GameObject.Find("PlayerNav").GetComponent <Image>(); attack = GameObject.Find("Attack sub").GetComponent <PanelScript>(); skills = GameObject.Find("Skill sub").GetComponent <PanelScript>(); items = GameObject.Find("Item sub").GetComponent <PanelScript>(); options = GameObject.Find("Options").GetComponent <PanelScript>(); options.show(); attack.hide(); skills.hide(); items.hide(); playerNav.gameObject.SetActive(true); }
/// <summary> /// 设置面板 /// </summary> /// <param name="nIndex">该面板在列表中的索引</param> /// <param name="panelID">面板ID</param> /// <param name="param"></param> private void SetPanel(int nIndex, EUIPanelID panelID, object param) { //重置时间,主要是针对普通面板 if (m_panelsList_DynamicLoading[nIndex].countDownTimer < m_nSeconds) { m_panelsList_DynamicLoading[nIndex].countDownTimer = m_nSeconds; } if (m_panelsList_DynamicLoading[nIndex].panelObj != null) { Debug.Log("Panel : " + panelID); if (!m_panelsList_DynamicLoading[nIndex].panelObj.activeSelf) { ++m_nShownPanelCount; } m_panelsList_DynamicLoading[nIndex].panelObj.SetActive(true); m_shownPanelIDArr[m_nShownPanelCount - 1] = panelID; PanelScript tmpScript = m_panelsList_DynamicLoading[nIndex].panelObj.GetComponent <PanelScript>(); tmpScript.UIParam = param; tmpScript.InitUIData(); if (panelID == EUIPanelID.GameSet) { if ((int)param == 1) { tmpScript.transform.localPosition = Vector3.forward * -1000; } else { tmpScript.transform.localPosition = Vector3.forward * -1600; } } } if (m_nShownPanelCount > m_panelsList_DynamicLoading.Count) { CorrectShowPanelCount(); } if (OnOpenPanel != null) { OnOpenPanel((int)panelID); } }
public void backToPrevios() { panelPosition = previosPanel; panelscript = panelPosition.GetComponent <PanelScript> (); flyback = true; }
private void confirmOk() { confirmscrn.SetActive(false); panelscript = panelPosition.GetComponent <PanelScript>(); moveStart = true; }
public static GameObject CreatePlane(Vector3[] points, bool collider, Material mat, Material ghost) { GameObject go = new GameObject("Plane"); Vector3 averagePoint = Vector3.zero; foreach (Vector3 point in points) { averagePoint += point; } averagePoint /= points.Length; go.transform.position = averagePoint; MeshFilter mf = go.AddComponent(typeof(MeshFilter)) as MeshFilter; MeshRenderer mr = go.AddComponent(typeof(MeshRenderer)) as MeshRenderer; Mesh m = new Mesh(); Vector3 normalN = GetNormal(points); Vector3 up = Vector3.Normalize((points[0] + points[3]) / 2 - ((points[1] + points[2]) / 2)); go.transform.rotation = Quaternion.LookRotation(normalN, up); Vector3 normal = GetNormal(points) * 0.01f; Vector3[] transformPoints = new Vector3[] { go.transform.InverseTransformPoint(points[0] + normal), go.transform.InverseTransformPoint(points[1] + normal), go.transform.InverseTransformPoint(points[2] + normal), go.transform.InverseTransformPoint(points[3] + normal), go.transform.InverseTransformPoint(points[0] + -normal), go.transform.InverseTransformPoint(points[1] + -normal), go.transform.InverseTransformPoint(points[2] + -normal), go.transform.InverseTransformPoint(points[3] + -normal), }; m.vertices = transformPoints; Vector2[] uvValues = new Vector2[] { new Vector2(transformPoints[0].x - 0.5f, transformPoints[0].y - 0.5f), new Vector2(transformPoints[1].x - 0.5f, transformPoints[1].y - 0.5f), new Vector2(transformPoints[2].x - 0.5f, transformPoints[2].y - 0.5f), new Vector2(transformPoints[3].x - 0.5f, transformPoints[3].y - 0.5f), }; m.uv = new Vector2[] { uvValues[0], uvValues[1], uvValues[2], uvValues[3], uvValues[0], uvValues[1], uvValues[2], uvValues[3], }; m.triangles = new int[] { 0, 1, 2, 0, 2, 3, 6, 5, 4, 4, 7, 6, }; mf.mesh = m; if (collider) { go.AddComponent <BoxCollider>().isTrigger = true; } mr.material = ghost; m.RecalculateNormals(); m.RecalculateBounds(); m.Optimize(); PlatformStress st = go.AddComponent(typeof(PlatformStress)) as PlatformStress; PlatformHealth hp = go.AddComponent(typeof(PlatformHealth)) as PlatformHealth; PanelScript ps = go.AddComponent(typeof(PanelScript)) as PanelScript; ps.solidMaterial = mat; ps.ghostMaterial = ghost; Rigidbody rb = go.AddComponent(typeof(Rigidbody)) as Rigidbody; rb.isKinematic = true; go.tag = "Build"; go.layer = IGNORERAYCAST; return(go); }
// Use this for initialization virtual protected void Start() { m_audio = gameObject.AddComponent <AudioSource>(); m_locked = false; if (m_slideSpeed == 0) { m_slideSpeed = 30.0f; } if (GameObject.Find("Confirmation Panel")) { m_confirmPanel = GameObject.Find("Confirmation Panel").GetComponent <PanelScript>(); } if (m_history == null) { m_history = new List <PanelScript>(); } m_buttons = GetComponentsInChildren <Button>(); if (m_inBoundryDis == 0) { if (m_direction == dir.UP) { m_inBoundryDis = 540; } else if (m_direction == dir.RIGHT) { m_inBoundryDis = 1150; } else if (m_direction == dir.LEFT) { m_inBoundryDis = 130; } else if (m_direction == dir.DOWN) { m_inBoundryDis = 140; } } if (m_outBoundryDis == 0) { if (m_direction == dir.UP) { m_outBoundryDis = 950; } else if (m_direction == dir.RIGHT) { m_outBoundryDis = 1450; } else if (m_direction == dir.LEFT) { m_outBoundryDis = -200; } else if (m_direction == dir.DOWN) { m_outBoundryDis = -120; } } if (GetComponentsInChildren <Text>().Length > 0) { m_text = GetComponentsInChildren <Text>(); } }
private void Start() { health = maxHealth; canvas = GameObject.Find("Canvas"); panelScript = GetComponent <PanelScript>(); }
//map previos fix // Update is called once per frame void Update() { if (flyback) { pawnMoveTime += Time.deltaTime; transform.position = Vector3.MoveTowards(transform.position, panelPosition.transform.position, pawnMoveSPD * pawnMoveTime); if (transform.position == panelPosition.transform.position) { flyback = false; pawnMoveTime = 0; } } dead(); if (gamectr.phase == battlePhase.MAP1) { if (player.GetComponent <player> ().playerNumber != 1) { return; } else { if (gamectr.mapChange) { gamectr.mapChange = false; moveMenu = true; } } } else if (gamectr.phase == battlePhase.MAP12) { if (player.GetComponent <player> ().playerNumber != 3) { return; } else { if (gamectr.mapChange) { gamectr.mapChange = false; moveMenu = true; } } } else if (gamectr.phase == battlePhase.MAP2) { if (player.GetComponent <player> ().playerNumber != 2) { return; } else { if (gamectr.mapChange) { gamectr.mapChange = false; moveMenu = true; } } } else if (gamectr.phase == battlePhase.MAP22) { if (player.GetComponent <player> ().playerNumber != 4) { return; } else { if (gamectr.mapChange) { gamectr.mapChange = false; moveMenu = true; } } } if (moveMenu) { moveMenu = false; previosPanel = panelPosition; panelscript = panelPosition.GetComponent <PanelScript> (); gamectr.mvphaseChange(movePhase.movemenu); movementChoicemenu.gameObject.SetActive(true); } if (moveMenuDone) { gamectr.mvphaseChange(movePhase.moveselect); } if (gamectr.mvPhase == movePhase.movemenu) { battleStart = false; if (player.GetComponent <player> ().playerNumber == 1 || player.GetComponent <player> ().playerNumber == 3) { if (Input.GetAxis("Vertical") < 0.1 && Input.GetAxis("Vertical") > -0.1) { isKeyPressing = false; } if (Input.GetKeyUp("up") || Input.GetAxis("Vertical") == -1) { if (!isKeyPressing) { pos -= 1; if (pos < 0) { pos = 2; } if (moveHighlight != null) { moveHighlight.GetComponent <Text> ().color = Color.black; } moveHighlight = menuScript.GetComponent <MenuSelect> ().Selectable [pos]; moveHighlight.GetComponent <Text> ().color = Color.blue; isKeyPressing = true; } } else if (Input.GetKeyUp("down") || Input.GetAxis("Vertical") == 1) { if (!isKeyPressing) { pos += 1; if (pos > 2) { pos = 0; } if (moveHighlight != null) { moveHighlight.GetComponent <Text> ().color = Color.black; } moveHighlight = menuScript.GetComponent <MenuSelect> ().Selectable [pos]; moveHighlight.GetComponent <Text> ().color = Color.blue; isKeyPressing = true; } } if (Input.GetKeyUp("space") || Input.GetKeyUp(KeyCode.Joystick1Button1)) { if (moveHighlight != null) { if (moveHighlight == menuScript.GetComponent <MenuSelect> ().Selectable [0]) { moveHighlight.GetComponent <Text> ().color = Color.black; moveMenuDone = true; } else if (moveHighlight == menuScript.GetComponent <MenuSelect> ().Selectable [1]) { if (gamectr.healNumber1 <= 0) { return; } if (panelPosition != healPanel) { return; } else if (panelPosition == healPanel) { gamectr.heal1(); moveHighlight.GetComponent <Text> ().color = Color.black; phaseChange(); movementChoicemenu.gameObject.SetActive(false); } } else if (moveHighlight == menuScript.GetComponent <MenuSelect> ().Selectable [2]) { phaseChange(); movementChoicemenu.gameObject.SetActive(false); } } } } else if (player.GetComponent <player> ().playerNumber == 2 || player.GetComponent <player> ().playerNumber == 4) { movementChoicemenu.SetActive(true); if (Input.GetAxis("Vertical2") < 0.1 && Input.GetAxis("Vertical2") > -0.1) { isKeyPressing2 = false; } if (Input.GetKeyUp("up") || Input.GetAxis("Vertical2") == -1) { if (!isKeyPressing2) { pos -= 1; if (pos < 0) { pos = 2; } if (moveHighlight != null) { moveHighlight.GetComponent <Text> ().color = Color.black; } moveHighlight = menuScript.GetComponent <MenuSelect> ().Selectable [pos]; moveHighlight.GetComponent <Text> ().color = Color.blue; isKeyPressing2 = true; } } else if (Input.GetKeyUp("down") || Input.GetAxis("Vertical2") == 1) { if (!isKeyPressing2) { pos += 1; if (pos > 2) { pos = 0; } if (moveHighlight != null) { moveHighlight.GetComponent <Text> ().color = Color.black; } moveHighlight = menuScript.GetComponent <MenuSelect> ().Selectable [pos]; moveHighlight.GetComponent <Text> ().color = Color.blue; isKeyPressing2 = true; } } if (Input.GetKeyUp("tab") || Input.GetKeyUp(KeyCode.Joystick2Button1)) { if (moveHighlight != null) { if (moveHighlight == menuScript.GetComponent <MenuSelect> ().Selectable [0]) { moveHighlight.GetComponent <Text> ().color = Color.black; moveMenuDone = true; } else if (moveHighlight == menuScript.GetComponent <MenuSelect> ().Selectable [1]) { if (gamectr.healNumber2 <= 0) { return; } if (panelPosition != healPanel) { return; } gamectr.heal2(); moveHighlight.GetComponent <Text> ().color = Color.black; phaseChange(); movementChoicemenu.gameObject.SetActive(false); } else if (moveHighlight == menuScript.GetComponent <MenuSelect> ().Selectable [2]) { phaseChange(); movementChoicemenu.gameObject.SetActive(false); } } } } } if (gamectr.mvPhase == movePhase.moveselect) { movementChoicemenu.gameObject.SetActive(false); if (player.GetComponent <player> ().playerNumber == 1 || player.GetComponent <player>().playerNumber == 3) { if (Input.GetKey("up") || Input.GetAxis("Vertical") == -1) { upMove(); } if (Input.GetKey("down") || Input.GetAxis("Vertical") == 1) { downMove(); } if (Input.GetKey("left") || Input.GetAxis("Horizontal") == -1) { leftMove(); } if (Input.GetKey("right") || Input.GetAxis("Horizontal") == 1) { rightMove(); } if (Input.GetKeyUp("space") || Input.GetKeyUp(KeyCode.Joystick1Button1)) { moveStart = true; moveMenuDone = false; } } else if (player.GetComponent <player> ().playerNumber == 2 || player.GetComponent <player>().playerNumber == 4) { if (Input.GetKey("up") || Input.GetAxis("Vertical2") == -1) { upMove(); } if (Input.GetKey("down") || Input.GetAxis("Vertical2") == 1) { downMove(); } if (Input.GetKey("left") || Input.GetAxis("Horizontal2") == -1) { leftMove(); } if (Input.GetKey("right") || Input.GetAxis("Horizontal2") == 1) { rightMove(); } if (Input.GetKeyUp("tab") || Input.GetKeyUp(KeyCode.Joystick2Button1)) { moveStart = true; moveMenuDone = false; } } } if (gamectr.tutorialStart == true) { gamectr.mvphaseChange(movePhase.pause); } if (moveStart) { gamectr.mvphaseChange(movePhase.moving); } if (gamectr.mvPhase == movePhase.moving) { pawnMoveTime += Time.deltaTime; transform.position = Vector3.MoveTowards(transform.position, panelPosition.transform.position, pawnMoveSPD * pawnMoveTime); if (transform.position == panelPosition.transform.position) { pawnMoveTime = 0; if (transform.position == enemy.transform.position) { gamectr.mvphaseChange(movePhase.battle); } else if (transform.position == enemy2.transform.position) { gamectr.mvphaseChange(movePhase.battle); } else { gamectr.mvphaseChange(movePhase.pause); phaseChange(); } moveStart = false; } } if (gamectr.mvPhase == movePhase.battle) { if (gamectr.tutorial == false) { StartCoroutine(tutorial()); } else { StartCoroutine(challengeMark()); } } }
// flagContinue: either Continue is pressed or primary input ended // Update is called once per frame void Update() { if (playSound && !audioSource.isPlaying) { audioSource.Play(); } if (!playSound && audioSource.isPlaying) { audioSource.Stop(); } if (audioPulses.Count == 0) { elapsedCycles = 0; elapsedTimeAudio = -0.1f; } if (panelScript == null) { panelScript = gameObject.GetComponent <PanelScript>(); } // get value from panel if (!isInitialLoad) { if (panelScript.initialLoadPushed()) { isStopped = true; isInitialLoad = true; initialLoadCounter = -1; initialLoadChars = 0; timeLeft = 0.0f; } } bool clearStartPushed = panelScript.clearStartPushed(), initialStartPushed = panelScript.initialStartPushed(), restartPushed = panelScript.restartPushed(), freeRunPushed = panelScript.freeRunPushed(), stopPushed = panelScript.stopPushed(), soundPushed = panelScript.soundPushed(); if (soundPushed) { if (playSound) { playSound = false; } else { elapsedCycles = 0; elapsedTimeAudio = -0.1f; audioPulses.Clear(); playSound = true; } } if (!isInitialLoad) { if (freeRunPushed) { isFreeRun = true; } if (stopPushed) { isFreeRun = false; } /* if (!isFreeRun) * { * isStopped = true; // after "one shot" * } */ if (clearStartPushed || initialStartPushed || restartPushed) { isStopped = false; timeLeft = 0; } if (clearStartPushed) { regA = 0; regM = 0; regR = 0; regK = 0; regX = readShortWord(regK); } if (initialStartPushed) { regK++; regX = readShortWord(regK); } } // cycleTime = cycleTimes[speedWheelScript.getValue()]; if (isInitialLoad) { timeLeft += Time.deltaTime; while (true) { byte a = printerScript.readTape(); if (a == 0xff) { break; } if (timeLeft < 0) { break; } addCycles(4); if (initialLoadCounter < 0) { if (a != 0 && a != initialLoadEndChar) { initialLoadCounter = 0; initialLoadChars = 0; } continue; } if (initialLoadChars == 6) { if (a == initialLoadEndChar) { isInitialLoad = false; break; } } else { initialLoadBuffer[initialLoadChars] = a; if (initialLoadChars == 5) { mainStore[initialLoadCounter & (mainStoreSize - 1)] = (initialLoadBuffer[0] << 12) | (initialLoadBuffer[1] << 6) | initialLoadBuffer[2]; mainStore[(initialLoadCounter + 1) & (mainStoreSize - 1)] = (initialLoadBuffer[3] << 12) | (initialLoadBuffer[4] << 6) | initialLoadBuffer[5]; regA = (regA ^ (((UInt64)mainStore[initialLoadCounter & (mainStoreSize - 1)] << 18) | (UInt64)mainStore[(initialLoadCounter + 1) & (mainStoreSize - 1)])); initialLoadCounter += 2; } } initialLoadChars = (initialLoadChars + 1) % 7; } } else { if (!isStopped) { timeLeft += Time.deltaTime; while (timeLeft > 0) { currentOrder = regX; regK++; regX = readShortWord(regK); processOneOrder(); if (!isFreeRun || isStopped) { isStopped = true; break; // "one shot" } } } } updateDisplay(); }
private void Slide() { bool isOpen = false; if (name == "ActionView Slide") { PanelScript parent = GetPanel("ActionViewer Panel"); m_inBoundryDis = (int)parent.transform.position.y; m_outBoundryDis = (int)parent.transform.position.y - 50; } else if (tag == "Action Button" && m_panels[0]) { PanelScript parent = m_panels[0]; if (parent.m_panels[0].name == "HUD Panel LEFT") { m_inBoundryDis = (int)parent.transform.position.x + 10; } else if (parent.m_panels[0].name == "HUD Panel RIGHT") { m_inBoundryDis = (int)parent.transform.position.x - 10; } m_outBoundryDis = (int)parent.transform.position.x; } if (m_direction == dir.UP) { if (m_inView) { if (transform.position.y > m_inBoundryDis) //if (recTrans.offsetMax.y > m_inBoundryDis) { transform.SetPositionAndRotation(new Vector3(transform.position.x, transform.position.y - m_slideSpeed, transform.position.z), transform.rotation); if (transform.position.y < m_inBoundryDis) { transform.SetPositionAndRotation(new Vector3(transform.position.x, m_inBoundryDis, transform.position.z), transform.rotation); isOpen = true; } } else { isOpen = true; } } else if (transform.position.y < m_outBoundryDis) { transform.SetPositionAndRotation(new Vector3(transform.position.x, transform.position.y + m_slideSpeed, transform.position.z), transform.rotation); if (transform.position.y > m_outBoundryDis) { transform.SetPositionAndRotation(new Vector3(transform.position.x, m_outBoundryDis, transform.position.z), transform.rotation); } } } else if (m_direction == dir.RIGHT) { if (m_inView) { if (transform.position.x > m_inBoundryDis) { transform.SetPositionAndRotation(new Vector3(transform.position.x - m_slideSpeed, transform.position.y, transform.position.z), transform.rotation); if (transform.position.x < m_inBoundryDis) { transform.SetPositionAndRotation(new Vector3(m_inBoundryDis, transform.position.y, transform.position.z), transform.rotation); isOpen = true; } } else { isOpen = true; } } else if (transform.position.x < m_outBoundryDis) { transform.SetPositionAndRotation(new Vector3(transform.position.x + m_slideSpeed, transform.position.y, transform.position.z), transform.rotation); if (transform.position.x > m_outBoundryDis) { transform.SetPositionAndRotation(new Vector3(m_outBoundryDis, transform.position.y, transform.position.z), transform.rotation); } } } else if (m_direction == dir.LEFT) { if (m_inView) { if (transform.position.x < m_inBoundryDis) { transform.SetPositionAndRotation(new Vector3(transform.position.x + m_slideSpeed, transform.position.y, transform.position.z), transform.rotation); if (transform.position.x > m_inBoundryDis) { transform.SetPositionAndRotation(new Vector3(m_inBoundryDis, transform.position.y, transform.position.z), transform.rotation); isOpen = true; } } else { isOpen = true; } } else if (transform.position.x > m_outBoundryDis) { transform.SetPositionAndRotation(new Vector3(transform.position.x - m_slideSpeed, transform.position.y, transform.position.z), transform.rotation); if (transform.position.x < m_outBoundryDis) { transform.SetPositionAndRotation(new Vector3(m_outBoundryDis, transform.position.y, transform.position.z), transform.rotation); } } } else if (m_direction == dir.DOWN) { if (m_inView) { if (transform.position.y < m_inBoundryDis) { transform.SetPositionAndRotation(new Vector3(transform.position.x, transform.position.y + m_slideSpeed, transform.position.z), transform.rotation); if (transform.position.y > m_inBoundryDis) { transform.SetPositionAndRotation(new Vector3(transform.position.x, m_inBoundryDis, transform.position.z), transform.rotation); isOpen = true; } } else { isOpen = true; } } else { if (transform.position.y > m_outBoundryDis && name != "DamagePreview") { transform.SetPositionAndRotation(new Vector3(transform.position.x, transform.position.y - m_slideSpeed, transform.position.z), transform.rotation); if (transform.position.y < m_outBoundryDis) { transform.SetPositionAndRotation(new Vector3(transform.position.x, m_outBoundryDis, transform.position.z), transform.rotation); } } else if (transform.position.y > 400) { transform.SetPositionAndRotation(new Vector3(transform.position.x, transform.position.y - m_slideSpeed, transform.position.z), transform.rotation); if (transform.position.y < m_outBoundryDis) { transform.SetPositionAndRotation(new Vector3(transform.position.x, m_outBoundryDis, transform.position.z), transform.rotation); } } } } if (name == "ActionViewer Panel" && isOpen) { m_panels[3].m_inView = true; } else if (name == "StatusViewer Panel" && isOpen) { m_panels[0].m_inView = true; } }
void Start() { Scripts = GetComponent <PanelScript>(); }