Merge pull request #7 from waltterireunamaki/npc

npc talk to nearby players
This commit is contained in:
Christer Warén 2020-04-25 18:07:30 +03:00 committed by GitHub
commit 4c72c9c603
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 188 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 B

View File

@ -0,0 +1,99 @@
fileFormatVersion: 2
guid: 8d1be07efb3a1aa448b129141776bc0f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 3
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 4
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 4
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline:
- - {x: -2, y: -2}
- {x: -2, y: 2}
- {x: 2, y: 2}
- {x: 2, y: -2}
physicsShape:
- - {x: -2, y: -2}
- {x: -2, y: 2}
- {x: 2, y: 2}
- {x: 2, y: -2}
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,15 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InteractionObject : MonoBehaviour
{
public bool talks;
public string message;
public void Talk()
{
Debug.Log(message);
}
}

View File

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

View File

@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerInteract : MonoBehaviour
{
public GameObject currentInterObj = null;
public InteractionObject currentInterObjScript = null;
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown ("Interact") && currentInterObj)
{
if (currentInterObjScript.talks)
{
currentInterObjScript.Talk();
}
}
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("interObject"))
{
Debug.Log(other.name);
currentInterObj = other.gameObject;
currentInterObjScript = currentInterObj.GetComponent <InteractionObject> ();
}
}
}

View File

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

View File

@ -293,3 +293,19 @@ InputManager:
type: 0 type: 0
axis: 0 axis: 0
joyNum: 0 joyNum: 0
- serializedVersion: 3
m_Name: Interact
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: e
altNegativeButton:
altPositiveButton: joystick button 1
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0

View File

@ -3,7 +3,8 @@
--- !u!78 &1 --- !u!78 &1
TagManager: TagManager:
serializedVersion: 2 serializedVersion: 2
tags: [] tags:
- interObject
layers: layers:
- Default - Default
- TransparentFX - TransparentFX