npc talk to nearby players
This commit is contained in:
parent
4db6366f0b
commit
78ed8d1285
BIN
Jump Game/Assets/Scenes/Square.png
Normal file
BIN
Jump Game/Assets/Scenes/Square.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 78 B |
99
Jump Game/Assets/Scenes/Square.png.meta
Normal file
99
Jump Game/Assets/Scenes/Square.png.meta
Normal 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:
|
15
Jump Game/Assets/Scripts/InteractionObject.cs
Normal file
15
Jump Game/Assets/Scripts/InteractionObject.cs
Normal 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);
|
||||
}
|
||||
|
||||
|
||||
}
|
11
Jump Game/Assets/Scripts/InteractionObject.cs.meta
Normal file
11
Jump Game/Assets/Scripts/InteractionObject.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 416a1b62da70d7b478995f767ba96c11
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
34
Jump Game/Assets/Scripts/PlayerInteract.cs
Normal file
34
Jump Game/Assets/Scripts/PlayerInteract.cs
Normal 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> ();
|
||||
}
|
||||
}
|
||||
}
|
11
Jump Game/Assets/Scripts/PlayerInteract.cs.meta
Normal file
11
Jump Game/Assets/Scripts/PlayerInteract.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1088a3f236f0e02439c2713c24252f61
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -293,3 +293,19 @@ InputManager:
|
||||
type: 0
|
||||
axis: 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
|
||||
|
@ -3,7 +3,8 @@
|
||||
--- !u!78 &1
|
||||
TagManager:
|
||||
serializedVersion: 2
|
||||
tags: []
|
||||
tags:
|
||||
- interObject
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
|
Loading…
Reference in New Issue
Block a user