Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Decompiled with JetBrains decompiler
- // Type: Chartergo
- // Assembly: Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
- // MVID: A258C9B1-E700-457A-BAE7-06EFF4747DB4
- // Assembly location: /Volumes/T5_1TB/Projects/WakeApp/23_Petr/build/TestWakeApp_Data/Managed/Assembly-CSharp.dll
- using UnityEngine;
- using UnityEngine.UI;
- public class Chartergo : MonoBehaviour
- {
- public float speedMove;
- private float gravityForce;
- public Vector3 moveVector;
- private CharacterController ch_controller;
- private Animator ch_animator;
- public Text ScoreText;
- public int score;
- private void Start()
- {
- this.score = 0;
- this.ch_controller = this.GetComponent<CharacterController>();
- this.ch_animator = this.GetComponent<Animator>();
- }
- private void Update()
- {
- this.CharacterMove();
- this.CamingGravity();
- this.OutputScore();
- }
- private void CharacterMove()
- {
- this.moveVector = Vector3.zero;
- this.moveVector.x = Input.GetAxis("Horizontal") * this.speedMove;
- this.moveVector.z = Input.GetAxis("Vertical") * this.speedMove;
- if ((double) this.moveVector.x != 0.0 || (double) this.moveVector.z != 0.0)
- {
- int num = (int) this.ch_controller.Move(this.moveVector * Time.deltaTime);
- this.ch_animator.SetBool("Move", true);
- }
- else
- this.ch_animator.SetBool("Move", false);
- if ((double) Vector3.Angle(Vector3.forward, this.moveVector) <= 1.0 && (double) Vector3.Angle(Vector3.forward, this.moveVector) != 0.0)
- return;
- this.transform.rotation = Quaternion.LookRotation(Vector3.RotateTowards(this.transform.forward, this.moveVector, this.speedMove, 0.0f));
- }
- private void CamingGravity()
- {
- if (this.ch_controller.isGrounded)
- this.gravityForce -= 20f * Time.deltaTime;
- else
- this.gravityForce = -1f;
- }
- private void OutputScore()
- {
- this.ScoreText.text = "Coins: " + (object) this.score;
- }
- private void OnTriggerEnter(Collider other)
- {
- if (!other.gameObject.CompareTag("Coins"))
- return;
- Object.Destroy((Object) other.gameObject);
- ++this.score;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement