This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public float gravityPower; //調整必要 例 - 1000 | |
void FixedUpdate() { | |
Gravity(); | |
} | |
void Gravity() { | |
if (jumpNow == true) { | |
rb.AddForce(new Vector3(0, gravityPower, 0)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vector3 movingDirecion; | |
public float speedMagnification; //調整必要 例10 | |
public RigidBody rb; | |
public Vector3 movingVelocity; | |
void Start(){ | |
rb = Getcomponent<RigidBody>(); | |
} | |
void Update() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private bool jumpNow; | |
public float jumpPower; //調整必要 例850 | |
private void OnCollisionEnter(Collision other) { | |
if (jumpNow == true) { | |
if (other.gameObject.CompareTag("Ground")) { | |
jumpNow = false; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
[CustomEditor(typeof(People))] | |
public class Historia : People | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
[RequireComponent(typeof(AudioSource))] | |
public class People : MonoBehaviour | |
{ | |
private GameObject player; | |
[System.NonSerialized] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//親クラス | |
void Start(){ | |
AddWords(); | |
} | |
public List < string > words = new List < string > (); | |
public virtual void AddWords() { | |
} | |
//子クラス |
NewerOlder