These are chat archives for ChaiScript/ChaiScript

8th
Jun 2018
maniurobert
@maniurobert1_twitter
Jun 08 2018 11:38

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(Rigidbody))]
public class PlayerController : MonoBehaviour {
{
private Rigidbody rb;
private float moveSpeed = 5f;
public float sprintSpeed = 10;
private float currentSpeed;

public global::System.Single MoveSpeed { get => moveSpeed; set => moveSpeed = value; }

void Start()
{
rb = GetComponent<Rigidbody>();
currentSpeed = MoveSpeed;
}

void update()
{
    if (Input.GetKeyDown(KeyCode.LeftShift)) {
        currentSpeed = sprintSpeed;
    }

    if (Input.GetKeyUp(KeyCode.LeftShift)) {
        currentSpeed = MoveSpeed;
    }

    PerformMovement();

void PerformMovement()
if (Input.GetKey(KeyCode.W)) {
transform.Translate(Vector3.forward* currentSpeed * Time.deltaTime);
 } 
if (Input.GetKey(KeyCode.S)) {
transform.Translate(Vector3.back * currentSpeed * Time.deltaTime);
 }

if (Input.GetKey(KeyCode.A)) {
transform.Translate (Vecctor3.left* currentSpeed * Time.deltaTime);
 }

if (Input.Getkey(Keycode.D)) {
transform.Translate (Vector3.right* currentSpeed * Time.deltaTime);
 }

}

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(Rigidbody))]
public class PlayerController : MonoBehaviour {
{
private Rigidbody rb;
private float moveSpeed = 5f;
public float sprintSpeed = 10;
private float currentSpeed;

public global::System.Single MoveSpeed { get => moveSpeed; set => moveSpeed = value; }

void Start()
{
rb = GetComponent<Rigidbody>();
currentSpeed = MoveSpeed;
}

void update()
{
    if (Input.GetKeyDown(KeyCode.LeftShift)) {
        currentSpeed = sprintSpeed;
    }

    if (Input.GetKeyUp(KeyCode.LeftShift)) {
        currentSpeed = MoveSpeed;
    }

    PerformMovement();

void PerformMovement()
if (Input.GetKey(KeyCode.W)) {
transform.Translate(Vector3.forward* currentSpeed * Time.deltaTime);
 } 
if (Input.GetKey(KeyCode.S)) {
transform.Translate(Vector3.back * currentSpeed * Time.deltaTime);
 }

if (Input.GetKey(KeyCode.A)) {
transform.Translate (Vecctor3.left* currentSpeed * Time.deltaTime);
 }

if (Input.Getkey(Keycode.D)) {
transform.Translate (Vector3.right* currentSpeed * Time.deltaTime);
 }

} Nu stiu dece acceasta comanda nu mere , ma refer ce script e gresit , ma puteti ajuta sa faceti corect scriptu . Daca lai facut corect trimitetimi mail cu scriptu corect la maniurobert4@gmail.com

Jason Turner
@lefticus
Jun 08 2018 14:53
@maniurobert1_twitter I'm not sure what programming language this is, or what your question is