Skocz do zawartości

MUX

Użytkownik
  • Zawartość

    3
  • Rejestracja

  • Ostatnia wizyta

Reputacja

0 Neutralna

O MUX

  • Tytuł
    Nowy
  1. Bład to (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); } }
  2. Problem Z Skryptem C#

    Nie wiem czy mogę wypowiadać się pod swoim tematem ale czy możesz dać średniki tak gdzie powinny być? Jestem nowy w programowaniu wiec wiesz popełniam dużo błędów gdyż dopiero się uczę
  3. Bład to (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; } } }
×