Skip to content

Instantly share code, notes, and snippets.

public float gravityPower; //調整必要 例 - 1000
void FixedUpdate() {
Gravity();
}
void Gravity() {
if (jumpNow == true) {
rb.AddForce(new Vector3(0, gravityPower, 0));
}
Vector2 startPos,endPos;
void Flick() {
if (Input.GetKeyDown(KeyCode.Mouse0)) {
startPos = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
}
if (Input.GetKey(KeyCode.Mouse0)) {
endPos = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
Vector2 dt = endPos - startPos;
Vector3 latestPos;
public void FixedUpdate()
{
//前フレームとの位置の差から進行方向を割り出してその方向に回転します。
Vector3 differenceDis = new Vector3(transform.position.x, 0, transform.position.z) - new Vector3(latestPos.x, 0, latestPos.z);
latestPos = transform.position;
if (Mathf.Abs(differenceDis.x) > 0.001f || Mathf.Abs(differenceDis.z) > 0.001f)
{
if (movingDirecion == new Vector3(0, 0, 0)) return;
Vector3 movingDirecion;
public float speedMagnification; //調整必要 例10
public RigidBody rb;
public Vector3 movingVelocity;
void Start(){
rb = Getcomponent<RigidBody>();
}
void Update() {
private bool jumpNow;
public float jumpPower; //調整必要 例850
private void OnCollisionEnter(Collision other) {
if (jumpNow == true) {
if (other.gameObject.CompareTag("Ground")) {
jumpNow = false;
}
}
}
Update() {
if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.D) || Input.GetKeyUp(KeyCode.W) || Input.GetKeyUp(KeyCode.A) || Input.GetKeyUp(KeyCode.S) || Input.GetKeyUp(KeyCode.D)) {
stopRigidbody = true;
}
}
FixedUpdate() {
if (stopRigidbody == true) {
rb.velocity = Vector3.zero;
stopRigidbody = false;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(People))]
public class Historia : People
{
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(AudioSource))]
public class People : MonoBehaviour
{
private GameObject player;
[System.NonSerialized]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using TMPro;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.UI;
public class GameManager : MonoBehaviour
//親クラス
void Start(){
AddWords();
}
public List < string > words = new List < string > ();
public virtual void AddWords() {
}
//子クラス