Commit d26e7d1d authored by 16이진형's avatar 16이진형

원거리 잡기

parent fc09b79e
using Assets.Scripts.Interface;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Arm : MonoBehaviour
{
public IBody body;
// Start is called before the first frame update
void Start()
{
body = transform.parent.GetComponent<PlayerMovement>();
}
private void OnTriggerEnter(Collider other)
{
body.OnTriggerEnterArm(other);
}
private void OnTriggerExit(Collider other)
{
body.OnTriggerExitArm(other);
}
}
fileFormatVersion: 2
guid: 03095063af092eb48986a2dd734a547d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: cbc6e3e1c08a170489e9a338eee1257f
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Assets.Scripts.Interface
{
public interface IBody
{
void OnTriggerEnterArm(Collider other);
void OnTriggerExitArm(Collider other);
}
}
fileFormatVersion: 2
guid: c07b41e7277d05c419e5cbdc54dac9dc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -5,7 +5,7 @@ using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double;
using Assets.Scripts.Interface;
public class PlayerMovement : FlatlandMovement,IInteractor,IGraber
public class PlayerMovement : FlatlandMovement,IInteractor,IGraber,IBody
{
bool isinertial = true;
bool isGrab = false;
......@@ -230,34 +230,11 @@ public class PlayerMovement : FlatlandMovement,IInteractor,IGraber
public override void OnCollisionEnterchild(Collision collision)
{
base.OnCollisionEnterchild(collision);
if (collision.transform.parent != null)
{
InteractiveObject x = collision.transform.parent.gameObject.GetComponent<InteractiveObject>();
if (x)
{
//상호작용가능한 물건일때
//Debug.Log(x.InteractType);
interactiveObjects.Add(x);
//uiManager.InteractText = x.InteractType;
}
}
}
public override void OnCollisionExitchild(Collision collision)
{
base.OnCollisionExitchild(collision);
if (collision.transform.parent != null)
{
//Debug.Log("Collision");
InteractiveObject x = collision.transform.parent.gameObject.GetComponent<InteractiveObject>();
if (x)
{
//상호작용가능한 물건일때
//Debug.Log(x.InteractType);
interactiveObjects.Remove(x);
//uiManager.InteractText = x.InteractType;
}
}
}
private InteractiveObject TryFindClosestInterativeObject()
......@@ -293,6 +270,37 @@ public class PlayerMovement : FlatlandMovement,IInteractor,IGraber
isInteracting = false;
}
public void OnTriggerEnterArm(Collider other)
{
if (other.transform.parent != null)
{
InteractiveObject x = other.transform.parent.gameObject.GetComponent<InteractiveObject>();
if (x)
{
//상호작용가능한 물건일때
//Debug.Log(x.InteractType);
interactiveObjects.Add(x);
//uiManager.InteractText = x.InteractType;
}
}
}
public void OnTriggerExitArm(Collider other)
{
if (other.transform.parent != null)
{
//Debug.Log("Collision");
InteractiveObject x = other.transform.parent.gameObject.GetComponent<InteractiveObject>();
if (x)
{
//상호작용가능한 물건일때
//Debug.Log(x.InteractType);
interactiveObjects.Remove(x);
//uiManager.InteractText = x.InteractType;
}
}
}
public Vector3 GraberV
{
get
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment