Skocz do zawartości

MUX

Pecetowicz
  • Zawartość

    7
  • Rejestracja

  • Ostatnia wizyta

  • Opinia

    Brak

Reputacja

0 Neutralna

O MUX

  • Tytuł
    Nowy

Dodatkowe informacje

  • Płeć
    Mężczyzna

Ostatnie wizyty

56 wyświetleń profilu
  1. Zostałem zablokowany na czacie nie wiem za co i na ile może ktoś pomoc?
  2. Mam problem z pokazywaniem timera czekania na grę (rozpoczęcia gry) Skrypty MenageraPolaczen (wykorzystuje PhotonNetwork) using UnityEngine; using System.Collections; public class MenegerPolaczen : MonoBehaviour { public bool szukamgraczy = false; public float timergraczy = 30f; MenuGlowne MenuGlowne; // Use this for initialization void Start () { MenuGlowne = GetComponent<MenuGlowne>(); } // Update is called once per frame void Update () { if (szukamgraczy) { if(PhotonNetwork.room.PlayerCount>= 2){ timergraczy -= Time.deltaTime; MenuGlowne.pokaztimergry = true; }else{ timergraczy = 30f; MenuGlowne.pokaztimergry = false; } } } void OnJoinedRoom(){ szukamgraczy = true; } public void Polacz(){ PhotonNetwork.ConnectUsingSettings("1.0"); } void OnJoinedLobby (){ PhotonNetwork.JoinRandomRoom(); } void OnPhotonRandomJoinFailed(){ PhotonNetwork.CreateRoom(null); } void OnGUI(){ GUILayout.Label (PhotonNetwork.connectionStateDetailed.ToString ()); } } Skrypt Do MenuGlowne using UnityEngine; using System.Collections; public class MenuGlowne : MonoBehaviour { public string pierwszeokno = ""; Vector2 srodekEkranu; Vector2 PG; string login = ""; string haslo = ""; string email = ""; string DO = "login"; float WG = 0; Rect oknostatow; Rect znajomi; Rect WZ; Rect aktualnosci; Rect bna1; Rect bna2; MenegerPolaczen MenagerPolaczen; public bool pokaztimergry = false; // graj down // bool dropDownGraj = false; bool dropDownUst = false; // znajdz gre // bool lobby = false; bool szukamGryOnline = false; bool szukamGryOffline = false; // Use this for initialization void Start () { MenagerPolaczen = GetComponent<MenegerPolaczen>(); login = PlayerPrefs.GetString ("login"); srodekEkranu = new Vector2(Screen.width /2-100, Screen.height /2-15); PG = new Vector2(Screen.width/2 - 300, 0); WG = Screen.height+0.055f; oknostatow = new Rect(WG * 1, WG * 3, WG * 8, WG * 3.3f); znajomi = new Rect(WG*1, WG*6.8f, WG*8, Screen.height*2/3f); aktualnosci = new Rect(znajomi.width + WG*1.5f,WG*8f, WG*18, Screen.height*2/3f-WG); // 10,235,350,400 } // Update is called once per frame void Update () { if (Input.GetKey (KeyCode.Escape)) { pierwszeokno = DO; szukamGryOffline = false; szukamGryOnline = false; lobby = false; dropDownUst = false; dropDownGraj = false; } // usunac po zakonczeniu projektu // szybkie przejscie do menuGlownego // if(Input.GetKey (KeyCode.Space)){ pierwszeokno = "menuGlowne"; } } void OnGUI(){ switch(pierwszeokno){ case "login": OknoLogowania(); break; case "menuGlowne": PokazOM(); break; case "lobby": break; case "rejestracja": OknoRejestracji(); break; } } void PokazOM(){ GUI.Box (new Rect(0,PG.y,Screen.width, 40),""); if (GUI.Button (new Rect(PG.x, PG.y, 200, 40), "Graj")){ dropDownGraj = !dropDownGraj; } if (GUI.Button (new Rect (PG.x + 200, PG.y, 200, 40), "Ustawienia")){ } if (GUI.Button (new Rect(PG.x + 400, PG.y, 200, 40), "Wyjscie")){ Application.Quit(); } // staty // GUI.Box (new Rect(10,70,350,150),""); // znajomi // GUI.Box (new Rect(10,235,350,365),""); if (lobby == false) { // ogłoszenia // GUI.Box (new Rect (370, 70, 640, 530), ""); } // graj drop // if(dropDownGraj){ GUI.Box (new Rect(PG.x, PG.y+40, 200, 80),""); if (GUI.Button(new Rect(PG.x, PG.y+80, 200, 40),"Znajdz Gre")){ dropDownGraj = false; lobby = true; szukamGryOnline = true; szukamGryOffline = false; } if (GUI.Button(new Rect(PG.x, PG.y+40, 200, 40),"Lokalnie Z Botami")){ dropDownGraj = false; lobby = true; szukamGryOnline = false; szukamGryOffline = true; } } // szukanie gry i lobby // if (lobby) { if (szukamGryOnline) { // box szukania gry // GUI.Box (new Rect (370, 70, 640, 600), "Szukanie Gry Online"); // boxy na graczy// for (int i = 0; i < 5; i++) { GUI.Box (new Rect (405, 90, 100, 100), ""); GUI.Box (new Rect (515, 90, 100, 100), ""); GUI.Box (new Rect (625, 90, 100, 100), ""); GUI.Box (new Rect (735, 90, 100, 100), ""); GUI.Box (new Rect (845, 90, 100, 100), ""); } } //przyciski do gry// if (GUI.Button (new Rect (750, 90, 100, 70), "Graj")) { MenagerPolaczen.Polacz (); } if (GUI.Button (new Rect (850, 530, 120, 70), "Preferowana Mapa: ")) { } //info o meczu if (PhotonNetwork.connected) { // anuluj // if (GUI.Button (new Rect (340, 70, 20, 20), "X")){ } if (pokaztimergry) { GUI.Box (new Rect (10, 70, 350, 150), "Znaleziono Graczy/n" + Mathf.Round (MenagerPolaczen.timergraczy).ToString ()); } else { GUI.Box (new Rect (10, 70, 350, 150), "Wyszukiwanie Graczy"); } } if(szukamGryOffline){ GUI.Box (new Rect(370, 70, 640, 25),"Przepraszamy, ten tryb nie został jeszcze zrobiony przez stworcow!"); } } } void OknoLogowania(){ login = GUI.TextField (new Rect (srodekEkranu.x, srodekEkranu.y-35, 200, 30), login, 20, "box"); GUI.Label (new Rect (srodekEkranu.x-50, srodekEkranu.y-35, 200, 30), "Login:"); haslo = GUI.PasswordField (new Rect (srodekEkranu.x, srodekEkranu.y, 200, 30), haslo, '*', 20, "box"); GUI.Label (new Rect (srodekEkranu.x-50, srodekEkranu.y, 200, 30), "Haslo:"); if (GUI.Button (new Rect (srodekEkranu.x, srodekEkranu.y + 70, 200, 30), "Zaloguj")){ GenerujLinkLoginu(); } if (GUI.Button (new Rect (srodekEkranu.x, srodekEkranu.y + 100, 200, 30), "Rejestracja")){ pierwszeokno = "rejestracja"; } } void OknoRejestracji(){ login = GUI.TextField (new Rect (srodekEkranu.x, srodekEkranu.y-70, 200, 30), login, 20, "box"); GUI.Label (new Rect (srodekEkranu.x-50, srodekEkranu.y-70, 100, 30), "Login:"); haslo = GUI.PasswordField (new Rect (srodekEkranu.x, srodekEkranu.y-35, 200, 30), haslo, '*', 20, "box"); GUI.Label (new Rect (srodekEkranu.x-50, srodekEkranu.y-35, 100, 30), "Haslo:"); email = GUI.TextField (new Rect (srodekEkranu.x, srodekEkranu.y, 200, 30), email, 100, "box"); GUI.Label (new Rect (srodekEkranu.x-50, srodekEkranu.y, 100, 30),"Email:"); if (GUI.Button (new Rect(srodekEkranu.x, srodekEkranu.y+70, 200, 30),"Zarejestruj")) GenerujLinkRejstracji(); if (GUI.Button (new Rect (srodekEkranu.x, srodekEkranu.y+100, 200, 30), "Powrot")) pierwszeokno = "login"; } void GenerujLinkLoginu(){ WWWForm w = new WWWForm(); w.AddField ("login", login); w.AddField ("haslo", haslo); WWW link = new WWW("http://muxiu.5v.pl/Skrypty/login.php", w); StartCoroutine (Zaloguj (link)); } IEnumerator Zaloguj(WWW link){ yield return link; Debug.Log (link.text); if (link.text == "login-SUCCESS"){ pierwszeokno = "menuGlowne"; DO = "MenuGlowne"; PlayerPrefs.SetString ("login",login); } } void GenerujLinkRejstracji(){ WWWForm w = new WWWForm(); w.AddField ("login", login); w.AddField ("haslo", haslo); w.AddField ("email", email); WWW link = new WWW("http://muxiu.5v.pl/Skrypty/register.php", w); StartCoroutine (Zarejestruj (link)); } IEnumerator Zarejestruj(WWW link){ yield return link; Debug.Log (link.text); if(link.text == "Register-SUCCESS"){ pierwszeokno = "login"; } } } Odniesienie do Timera 140_150 linika
  3. Błędy 1: (64,31): error CS1525: Unexpected symbol `(', expecting `)', `,', `;', `[', or `=' 2: (64,30): error CS1547: Keyword `void' cannot be used in this context Skrypt: using UnityEngine; using System.Collections; public class MenuGlowne : MonoBehaviour { public string pierwszeokno = ""; Vector2 srodekEkranu; string login = ""; string haslo = ""; string email = ""; // Use this for initialization void Start () { srodekEkranu = new Vector2(Screen.width /2-100, Screen.height /2-15); } // Update is called once per frame void Update () { if (Input.GetKey (KeyCode.Escape)) { pierwszeokno = "login"; } } void OnGUI(){ switch(pierwszeokno){ case "login": OknoLogowania(); break; case "menuGłowne": break; case "lobby": break; case "rejestracja": OknoRejestracji(); break; } } void OknoLogowania(){ login = GUI.TextField (new Rect (srodekEkranu.x, srodekEkranu.y-35, 200, 30), login, 20, "box"); haslo = GUI.PasswordField (new Rect (srodekEkranu.x, srodekEkranu.y, 200, 30), haslo, '*', 20, "box"); if (GUI.Button (new Rect (srodekEkranu.x, srodekEkranu.y + 70, 200, 30), "Zaloguj")){ GenerujLinkLoginu(); } if (GUI.Button (new Rect (srodekEkranu.x, srodekEkranu.y + 70, 200, 30), "Rejestracja")){ pierwszeokno = "rejestracja"; } } void OknoRejestracji(){ login = GUI.TextField (new Rect (srodekEkranu.x, srodekEkranu.y-70, 200, 30), login, 20, "box"); GUI.Label (new Rect (srodekEkranu.x, srodekEkranu.y-70, 100, 30), "Login:"); haslo = GUI.PasswordField (new Rect (srodekEkranu.x-205, srodekEkranu.y, 200, 30), haslo, '*', 20, "box"); GUI.Label (new Rect (srodekEkranu.x, srodekEkranu.y-35, 100, 30), "Haslo:"); email = GUI.PasswordField (new Rect (srodekEkranu.x, srodekEkranu.y-35, 200, 30), email, '*', 100, "box"); GUI.Label (new Rect (srodekEkranu.x, srodekEkranu.y, 100, 30),"Email:"); if (GUI.Button (new Rect(srodekEkranu.x, srodekEkranu.y+70, 200, 30),"Zarejestruj")){ GenerujLinkRejstracji(); } void GenerujLinkLoginu(){ WWWForm w = new WWWForm(); w.AddField ("login", login); w.AddField ("haslo", haslo); WWW link = new WWW("http://mux.ugu.pl/login.php", w); StartCoroutine (Zaloguj (link)); } IEnumerator Zaloguj(WWW link){ yield return link; Debug.Log (link.text); } void GenerujLinkRejstracji(){ WWWForm w = new WWWForm(); w.AddField ("login", login); w.AddField ("haslo", haslo); w.AddField ("email", email); WWW link = new WWW("http://mux.ugu.pl/register.php", w); StartCoroutine (Zarejestruj (link)); } IEnumerator Zarejestruj(WWW link){ yield return link; Debug.Log (link.text); } }
  4. (20,17): error CS0246: The type or namespace name `CharacterMotor' could not be found. Are you missing a using directive or an assembly reference? using UnityEngine; using System.Collections; public class HPARMOR : MonoBehaviour { private float maxHealth = 100; private float currentHealth = 100; private float maxArmour = 100; private float currentArmour = 100; private float maxStamina = 100; private float currentStamina = 100; private float barWidth = 100; private float barHeight = 100; private float canHeal = 0.0f; private float canRegenerate = 0.0f; private CharacterController chCont; private CharacterMotor chMotor; private Vector3 lastPosition; public Texture2D healthTexture; public Texture2D armourTexture; public Texture2D staminaTexture; public float walkSpeed = 10.0f; public float runSpeed = 20.0f; public GUITexture hitTexture; void Awake() { barHeight = Screen.height * 0.02f; barWidth = barHeight * 10.0f; chCont = GetComponent<CharacterController>(); chMotor = GetComponent<CharacterMotor>(); lastPosition = transform.position; } void OnGUI() { GUI.DrawTexture(new Rect(Screen.width - barWidth - 10, Screen.height - barHeight - 10, currentHealth * barWidth / maxHealth, barHeight), healthTexture); GUI.DrawTexture(new Rect(Screen.width - barWidth - 10, Screen.height - barHeight * 2 - 20, currentArmour * barWidth / maxArmour, barHeight), armourTexture); GUI.DrawTexture(new Rect(Screen.width - barWidth - 10, Screen.height - barHeight * 3 - 30, currentStamina * barWidth / maxStamina, barHeight), staminaTexture); } void Start() { Rect currentRes = new Rect(-Screen.width * 0.5f, -Screen.height * 0.5f, Screen.width, Screen.height); hitTexture.pixelInset = currentRes; } void Update() { if(Input.GetKeyDown(KeyCode.P)) { takeHit(30); } if(canHeal > 0.0f) { canHeal -= Time.deltaTime; } if(canRegenerate > 0.0f) { canRegenerate -= Time.deltaTime; } if(canHeal <= 0.0f && currentHealth < maxHealth) { regenerate(ref currentHealth, maxHealth); } if(canRegenerate <= 0.0f && currentStamina < maxStamina) { regenerate(ref currentStamina, maxStamina); } } void FixedUpdate () { float speed = walkSpeed; if(chCont.isGrounded && Input.GetKey(KeyCode.LeftShift) && lastPosition != transform.position && currentStamina > 0) { lastPosition = transform.position; speed = runSpeed; currentStamina -= 1; currentStamina = Mathf.Clamp(currentStamina, 0, maxStamina); canRegenerate = 5.0f; } chMotor.movement.maxForwardSpeed = speed; } void takeHit(float damage) { Destroy(Instantiate(hitTexture), 0.15f); if(currentArmour > 0) { currentArmour = currentArmour - damage; if(currentArmour < 0) { currentHealth += currentArmour; currentArmour = 0; } } else { currentHealth -= damage; } if(currentHealth < maxHealth) { canHeal = 5.0f; } currentArmour = Mathf.Clamp(currentArmour, 0, maxArmour); currentHealth = Mathf.Clamp(currentHealth, 0, maxHealth); } void regenerate(ref float currentStat, float maxStat) { currentStat += maxStat * 0.005f; Mathf.Clamp(currentStat, 0, maxStat); } }
  5. Skrypt macie tutaj proszę o pomoc z problemem "(24,35): error CS1525: Unexpected symbol `networkView' " using UnityEngine; using System.Collections; public class NewBehaviourScript : MonoBehaviour { Vector3 lastPos; Quaternion lastRot; void Awake() { if(!networkView.isMine) { // enabled = false; } } void Update() { if(lastPos != transform.position) { lastPos = transform.position networkView.RPC("UpdatePos", RPCMode.AllBuffered, transform.position, transform.rotation) } if(lastRot != transform.rotation) { lastRot = transform.rotation networkView.RPC("UpdatePos", RPCMode.AllBuffered, transform.position, transform.rotation) } } [RPC] void UpdatePos(Vector3 pos, Quaternion rot) { if (!networkView.isMine) { transform.position = pos; transform.rotation = rot; } } }
×