Kleiner Anfang für Dialog system

This commit is contained in:
Dominik
2023-05-28 11:44:55 +02:00
parent 370380751b
commit 792c90a214
702 changed files with 109467 additions and 1 deletions

View File

@@ -0,0 +1,99 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CharControllerMod : MonoBehaviour
{
public float maxSpeed = 3.4f;
public float jumpHeight = 6.5f;
public float gravityScale = 1.5f;
public Camera mainCamera;
bool facingRight = true;
public bool grounded = false;
Vector3 cameraPos;
float moveDirection = 0;
Rigidbody2D rb;
CapsuleCollider2D mainCollider;
CapsuleCollider2D friction;
Transform t;
// Start is called before the first frame update
void Start()
{
t = transform;
rb = GetComponent<Rigidbody2D>();
mainCollider = GetComponent<CapsuleCollider2D>();
friction = GetComponent<CapsuleCollider2D>();
rb.freezeRotation = true;
rb.gravityScale = gravityScale;
if(mainCamera)
{
cameraPos = mainCamera.transform.position;
}
}
// Update is called once per frame
void Update()
{
//if(grounded || Mathf.Abs(rb.velocity.x) > 0.01f)
moveDirection = Input.GetAxisRaw("Horizontal");
if(moveDirection != 0)
{
if (moveDirection > 0 && !facingRight)
{
facingRight = true;
t.localScale = new Vector3(Mathf.Abs(t.localScale.x), t.localScale.y, transform.localScale.z);
}
if (moveDirection < 0 && facingRight)
{
facingRight = false;
t.localScale = new Vector3(-Mathf.Abs(t.localScale.x), t.localScale.y, t.localScale.z);
}
}
if(Input.GetButtonDown("Jump") && grounded)
{
rb.velocity = new Vector2(rb.velocity.x, jumpHeight);
}
if (mainCamera)
{
mainCamera.transform.position = new Vector3(t.position.x, t.position.y, cameraPos.z);
}
}
void FixedUpdate()
{
Bounds colliderBounds = mainCollider.bounds;
float colliderRadius = mainCollider.size.x * 0.4f * Mathf.Abs(transform.localScale.x);
Vector3 groundCheckPos = colliderBounds.min + new Vector3(colliderBounds.size.x * 0.5f, colliderRadius * 0.9f, 0);
Collider2D[] colliders = Physics2D.OverlapCircleAll(groundCheckPos, colliderRadius);
grounded = false;
if (colliders.Length > 2)
{
foreach (Collider2D hit in colliders){
if (hit != mainCollider){
grounded = true;
break;
}
}
}
rb.velocity = new Vector2(moveDirection * maxSpeed, rb.velocity.y);
Debug.DrawLine(groundCheckPos, groundCheckPos - new Vector3(0, colliderRadius, 0), grounded ? Color.green : Color.red);
Debug.DrawLine(groundCheckPos, groundCheckPos - new Vector3(colliderRadius, 0, 0), grounded ? Color.green : Color.red);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b722d4a418b0d3d49afc9f83ef56cc7b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/AssetsFORELLE/Texts.meta generated Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cab69bfc46479d14584aea0e1e3eadcb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

17
Assets/AssetsFORELLE/Texts/Frank.asset generated Normal file
View File

@@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d46921e71e9f04ccb83ec685be24573c, type: 3}
m_Name: Frank
m_EditorClassIdentifier:
dialoger: Frank
photo: {fileID: 21300000, guid: db8361264f6f98b409ddf1401172f344, type: 3}
expressions: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0f529567232f5cc4da9d735ab3fa290f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

17
Assets/AssetsFORELLE/Texts/Meowlin.asset generated Normal file
View File

@@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d46921e71e9f04ccb83ec685be24573c, type: 3}
m_Name: Meowlin
m_EditorClassIdentifier:
dialoger: Meowlin
photo: {fileID: 21300000, guid: af0cf61c310ea5f4cb882f698b58781b, type: 3}
expressions: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ab839d34f02e91747add76a08fc6278b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1 @@
Meowlin: Ach weisst du Frank, so'n Stückchen Fisch wär ganz cool

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5f33509a9da7da14b912793bf1825784
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: