Commit 77b00431 authored by 18손재민's avatar 18손재민

Merge remote-tracking branch 'origin/spike'

# Conflicts:
#	Assets/Prefabs/Rooms/NormalRoom/Room 4.prefab
#	Assets/Scenes/PlayScene.unity
#	Assets/Scripts/Characters/Enemy/Enemy.cs
parents b7e42d4b f6c075ce
...@@ -60,6 +60,7 @@ GameObject: ...@@ -60,6 +60,7 @@ GameObject:
- component: {fileID: 50122811034089708} - component: {fileID: 50122811034089708}
- component: {fileID: 66361038049447114} - component: {fileID: 66361038049447114}
- component: {fileID: 2113883505235840134} - component: {fileID: 2113883505235840134}
- component: {fileID: 66995556304571128}
m_Layer: 10 m_Layer: 10
m_Name: spike m_Name: spike
m_TagString: Untagged m_TagString: Untagged
...@@ -940,7 +941,7 @@ CompositeCollider2D: ...@@ -940,7 +941,7 @@ CompositeCollider2D:
m_VertexDistance: 0.0005 m_VertexDistance: 0.0005
--- !u!66 &66995556304571128 --- !u!66 &66995556304571128
CompositeCollider2D: CompositeCollider2D:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1226594415229206} m_GameObject: {fileID: 1226594415229206}
...@@ -955,7 +956,7 @@ CompositeCollider2D: ...@@ -955,7 +956,7 @@ CompositeCollider2D:
m_GenerationType: 0 m_GenerationType: 0
m_EdgeRadius: 0 m_EdgeRadius: 0
m_ColliderPaths: m_ColliderPaths:
- m_Collider: {fileID: 2113883506358949862} - m_Collider: {fileID: 0}
m_ColliderPaths: m_ColliderPaths:
- - X: 150000000 - - X: 150000000
Y: 173437504 Y: 173437504
......
...@@ -126,6 +126,8 @@ GameObject: ...@@ -126,6 +126,8 @@ GameObject:
- component: {fileID: 50215044223001152} - component: {fileID: 50215044223001152}
- component: {fileID: 66699744936676298} - component: {fileID: 66699744936676298}
- component: {fileID: 2113883506208320836} - component: {fileID: 2113883506208320836}
- component: {fileID: 66891075305192572}
- component: {fileID: 2113883504719364560}
m_Layer: 10 m_Layer: 10
m_Name: spike m_Name: spike
m_TagString: Untagged m_TagString: Untagged
...@@ -892,6 +894,26 @@ CompositeCollider2D: ...@@ -892,6 +894,26 @@ CompositeCollider2D:
- {x: 0, y: 0} - {x: 0, y: 0}
- {x: 11, y: 0} - {x: 11, y: 0}
m_VertexDistance: 0.0005 m_VertexDistance: 0.0005
--- !u!66 &66891075305192572
CompositeCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1687661689682920}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_GeometryType: 0
m_GenerationType: 0
m_EdgeRadius: 0
m_ColliderPaths: []
m_CompositePaths:
m_Paths: []
m_VertexDistance: 0.0005
--- !u!114 &114127645492151898 --- !u!114 &114127645492151898
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
...@@ -997,6 +1019,19 @@ TilemapCollider2D: ...@@ -997,6 +1019,19 @@ TilemapCollider2D:
m_UsedByEffector: 0 m_UsedByEffector: 0
m_UsedByComposite: 1 m_UsedByComposite: 1
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
--- !u!19719996 &2113883504719364560
TilemapCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1687661689682920}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 1
m_Offset: {x: 0, y: 0}
--- !u!19719996 &2113883505917435124 --- !u!19719996 &2113883505917435124
TilemapCollider2D: TilemapCollider2D:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
......
...@@ -87,7 +87,6 @@ GameObject: ...@@ -87,7 +87,6 @@ GameObject:
- component: {fileID: 8195094280011915956} - component: {fileID: 8195094280011915956}
- component: {fileID: 3664157344941130292} - component: {fileID: 3664157344941130292}
- component: {fileID: 50294503223574562} - component: {fileID: 50294503223574562}
- component: {fileID: 66205307532284804}
- component: {fileID: 2113883504902801176} - component: {fileID: 2113883504902801176}
m_Layer: 9 m_Layer: 9
m_Name: rope m_Name: rope
...@@ -653,340 +652,6 @@ CompositeCollider2D: ...@@ -653,340 +652,6 @@ CompositeCollider2D:
- {x: 0, y: 0} - {x: 0, y: 0}
- {x: 11, y: 0} - {x: 11, y: 0}
m_VertexDistance: 0.0005 m_VertexDistance: 0.0005
--- !u!66 &66646474760707030
CompositeCollider2D:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1540989331070204}
m_Enabled: 0
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_GeometryType: 0
m_GenerationType: 0
m_EdgeRadius: 0
m_ColliderPaths:
- m_Collider: {fileID: 2113883506183553254}
m_ColliderPaths:
- - X: 76562496
Y: 139531248
- X: 76406248
Y: 140000000
- X: 76562496
Y: 140000000
- X: 76562496
Y: 149531248
- X: 76406248
Y: 150000000
- X: 76562496
Y: 150000000
- X: 76562496
Y: 159531248
- X: 76406248
Y: 160000000
- X: 76562496
Y: 160000000
- X: 76562496
Y: 169531248
- X: 76406248
Y: 170000000
- X: 76562496
Y: 170000000
- X: 76562496
Y: 179531248
- X: 76406248
Y: 180000000
- X: 76562496
Y: 180000000
- X: 76562496
Y: 189531248
- X: 76406248
Y: 190000000
- X: 76562496
Y: 190000000
- X: 76562496
Y: 199531248
- X: 76406248
Y: 200000000
- X: 76562496
Y: 200000000
- X: 76562496
Y: 209531248
- X: 76406248
Y: 210000000
- X: 73437504
Y: 210000000
- X: 73437504
Y: 130000000
- X: 76562496
Y: 130000000
- - X: 166562496
Y: 139531248
- X: 166406256
Y: 140000000
- X: 166562496
Y: 140000000
- X: 166562496
Y: 149531248
- X: 166406256
Y: 150000000
- X: 166562496
Y: 150000000
- X: 166562496
Y: 159531248
- X: 166406256
Y: 160000000
- X: 166562496
Y: 160000000
- X: 166562496
Y: 169531248
- X: 166406256
Y: 170000000
- X: 166562496
Y: 170000000
- X: 166562496
Y: 179531248
- X: 166406256
Y: 180000000
- X: 166562496
Y: 180000000
- X: 166562496
Y: 189531248
- X: 166406256
Y: 190000000
- X: 166562496
Y: 190000000
- X: 166562496
Y: 199531248
- X: 166406256
Y: 200000000
- X: 166562496
Y: 200000000
- X: 166562496
Y: 209531248
- X: 166406256
Y: 210000000
- X: 163437504
Y: 210000000
- X: 163437504
Y: 130000000
- X: 166562496
Y: 130000000
- - X: 56562500
Y: 39531248
- X: 56406248
Y: 40000000
- X: 56562500
Y: 40000000
- X: 56562500
Y: 49531248
- X: 56406248
Y: 50000000
- X: 56562500
Y: 50000000
- X: 56562500
Y: 59531248
- X: 56406248
Y: 60000000
- X: 56562500
Y: 60000000
- X: 56562500
Y: 69531248
- X: 56406248
Y: 70000000
- X: 56562500
Y: 70000000
- X: 56562500
Y: 79531248
- X: 56406248
Y: 80000000
- X: 56562500
Y: 80000000
- X: 56562500
Y: 89531248
- X: 56406248
Y: 90000000
- X: 56562500
Y: 90000000
- X: 56562500
Y: 99531248
- X: 56406248
Y: 100000000
- X: 56562500
Y: 100000000
- X: 56562500
Y: 109531248
- X: 56406248
Y: 110000000
- X: 53437500
Y: 110000000
- X: 53437500
Y: 30000000
- X: 56562500
Y: 30000000
- - X: 186562496
Y: 39531248
- X: 186406256
Y: 40000000
- X: 186562496
Y: 40000000
- X: 186562496
Y: 49531248
- X: 186406256
Y: 50000000
- X: 186562496
Y: 50000000
- X: 186562496
Y: 59531248
- X: 186406256
Y: 60000000
- X: 186562496
Y: 60000000
- X: 186562496
Y: 69531248
- X: 186406256
Y: 70000000
- X: 186562496
Y: 70000000
- X: 186562496
Y: 79531248
- X: 186406256
Y: 80000000
- X: 186562496
Y: 80000000
- X: 186562496
Y: 89531248
- X: 186406256
Y: 90000000
- X: 186562496
Y: 90000000
- X: 186562496
Y: 99531248
- X: 186406256
Y: 100000000
- X: 186562496
Y: 100000000
- X: 186562496
Y: 109531248
- X: 186406256
Y: 110000000
- X: 183437504
Y: 110000000
- X: 183437504
Y: 30000000
- X: 186562496
Y: 30000000
m_CompositePaths:
m_Paths:
- - {x: 7.6562495, y: 13.953125}
- {x: 7.640625, y: 14}
- {x: 7.6562495, y: 14}
- {x: 7.6562495, y: 14.953125}
- {x: 7.640625, y: 15}
- {x: 7.6562495, y: 15}
- {x: 7.6562495, y: 15.953125}
- {x: 7.640625, y: 16}
- {x: 7.6562495, y: 16}
- {x: 7.6562495, y: 16.953125}
- {x: 7.640625, y: 17}
- {x: 7.6562495, y: 17}
- {x: 7.6562495, y: 17.953125}
- {x: 7.640625, y: 18}
- {x: 7.6562495, y: 18}
- {x: 7.6562495, y: 18.953125}
- {x: 7.640625, y: 19}
- {x: 7.6562495, y: 19}
- {x: 7.6562495, y: 19.953125}
- {x: 7.640625, y: 20}
- {x: 7.6562495, y: 20}
- {x: 7.6562495, y: 20.953125}
- {x: 7.640625, y: 21}
- {x: 7.3437505, y: 21}
- {x: 7.3437505, y: 13}
- {x: 7.6562495, y: 13}
- - {x: 16.65625, y: 13.953125}
- {x: 16.640625, y: 14}
- {x: 16.65625, y: 14}
- {x: 16.65625, y: 14.953125}
- {x: 16.640625, y: 15}
- {x: 16.65625, y: 15}
- {x: 16.65625, y: 15.953125}
- {x: 16.640625, y: 16}
- {x: 16.65625, y: 16}
- {x: 16.65625, y: 16.953125}
- {x: 16.640625, y: 17}
- {x: 16.65625, y: 17}
- {x: 16.65625, y: 17.953125}
- {x: 16.640625, y: 18}
- {x: 16.65625, y: 18}
- {x: 16.65625, y: 18.953125}
- {x: 16.640625, y: 19}
- {x: 16.65625, y: 19}
- {x: 16.65625, y: 19.953125}
- {x: 16.640625, y: 20}
- {x: 16.65625, y: 20}
- {x: 16.65625, y: 20.953125}
- {x: 16.640625, y: 21}
- {x: 16.34375, y: 21}
- {x: 16.34375, y: 13}
- {x: 16.65625, y: 13}
- - {x: 5.65625, y: 3.9531248}
- {x: 5.640625, y: 4}
- {x: 5.65625, y: 4}
- {x: 5.65625, y: 4.953125}
- {x: 5.640625, y: 5}
- {x: 5.65625, y: 5}
- {x: 5.65625, y: 5.953125}
- {x: 5.640625, y: 6}
- {x: 5.65625, y: 6}
- {x: 5.65625, y: 6.953125}
- {x: 5.640625, y: 7}
- {x: 5.65625, y: 7}
- {x: 5.65625, y: 7.953125}
- {x: 5.640625, y: 8}
- {x: 5.65625, y: 8}
- {x: 5.65625, y: 8.953125}
- {x: 5.640625, y: 9}
- {x: 5.65625, y: 9}
- {x: 5.65625, y: 9.953125}
- {x: 5.640625, y: 10}
- {x: 5.65625, y: 10}
- {x: 5.65625, y: 10.953125}
- {x: 5.640625, y: 11}
- {x: 5.34375, y: 11}
- {x: 5.34375, y: 3}
- {x: 5.65625, y: 3}
- - {x: 18.65625, y: 3.9531248}
- {x: 18.640625, y: 4}
- {x: 18.65625, y: 4}
- {x: 18.65625, y: 4.953125}
- {x: 18.640625, y: 5}
- {x: 18.65625, y: 5}
- {x: 18.65625, y: 5.953125}
- {x: 18.640625, y: 6}
- {x: 18.65625, y: 6}
- {x: 18.65625, y: 6.953125}
- {x: 18.640625, y: 7}
- {x: 18.65625, y: 7}
- {x: 18.65625, y: 7.953125}
- {x: 18.640625, y: 8}
- {x: 18.65625, y: 8}
- {x: 18.65625, y: 8.953125}
- {x: 18.640625, y: 9}
- {x: 18.65625, y: 9}
- {x: 18.65625, y: 9.953125}
- {x: 18.640625, y: 10}
- {x: 18.65625, y: 10}
- {x: 18.65625, y: 10.953125}
- {x: 18.640625, y: 11}
- {x: 18.34375, y: 11}
- {x: 18.34375, y: 3}
- {x: 18.65625, y: 3}
m_VertexDistance: 0.0005
--- !u!66 &66693623723505602 --- !u!66 &66693623723505602
CompositeCollider2D: CompositeCollider2D:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
......
...@@ -34,7 +34,7 @@ Transform: ...@@ -34,7 +34,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1704656476422024} m_GameObject: {fileID: 1704656476422024}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 192, y: 0, z: -2} m_LocalPosition: {x: 72, y: 0, z: -2}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
......
...@@ -77,8 +77,16 @@ public class Enemy : MonoBehaviour { ...@@ -77,8 +77,16 @@ public class Enemy : MonoBehaviour {
private void FixedUpdate() private void FixedUpdate()
{ {
PlayerDistance = Vector2.Distance(enemyManager.Player.transform.position, transform.parent.position); bool wallTest = IsTouchingWall();
CheckCliff(); CheckWall(); if (wallTest)
{
// Debug.Log("Touching wall");
}
bool cliffTest = IsAdvancingToCliff();
if (cliffTest)
{
// Debug.Log("Advancing to cliff");
}
} }
// Movement & Physics // Movement & Physics
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
public class playerOnSpike : MonoBehaviour {
public TileBase[] spikeTile;
public Rigidbody2D rb;
public int SpikeLayer = 10; //10 is for spike layer
public float spikeDamage = 5f;
public float spikeKnockBackx = 5f;
public float spikeKnockBacky = 5f;
private void Start()
{
rb = GetComponent<Rigidbody2D>();
}
void OnCollisionEnter2D(Collision2D coll)
{
if (coll.gameObject.layer == SpikeLayer)
{
Tilemap t = coll.gameObject.GetComponent<Tilemap>();
Vector3 hitPosition = Vector3.zero;
ContactPoint2D hit = coll.contacts[0];
hitPosition.x = hit.point.x - 0.01f * hit.normal.x;
hitPosition.y = hit.point.y - 0.01f * hit.normal.y;
//충돌 위치 중심 계산
TileBase colTile = t.GetTile(t.WorldToCell(hitPosition));
if (colTile != null)
{
EnemyAttackInfo attack = new EnemyAttackInfo(spikeDamage, 0f, 0, null, null); //넉백은 따로 구현
GetComponent<PlayerAttack>().TakeDamage(attack);
//방향에 따른 넉백 구현
if (colTile == spikeTile[0]) //spike up tile
{
// print("uuch!");
rb.velocity = new Vector2(rb.velocity.x, spikeKnockBacky);
}
else if (colTile == spikeTile[1]) //spike down tile
{
// print("duch!");
rb.velocity = new Vector2(rb.velocity.x, -spikeKnockBacky);
}
if (colTile == spikeTile[2]) //spike l tile
{
// print("luch!");
rb.velocity = new Vector2( -spikeKnockBackx, rb.velocity.y);
}
else if (colTile == spikeTile[3]) //spike r tile
{
// print("ruch!");
rb.velocity = new Vector2( spikeKnockBackx, rb.velocity.y);
}
}
}
}
}
fileFormatVersion: 2
guid: a4458b2b5e7c3f842b29e2121f8400ea
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class tiletest : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
fileFormatVersion: 2
guid: eb17c0dc633a1ef4c8337e5ffa1ffdae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
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