Commit 09a09bd6 authored by abpo11's avatar abpo11

이제 모든 종류의 가시가 정상적으로 작동함. 가시를 추가하려면 udlr 순서대로 배열에 넣어주면 됨

parent bda25718
......@@ -468,6 +468,26 @@ Prefab:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 114574072693989902, guid: 3d077a5f727dd1e4780e9265ed26e036,
type: 2}
propertyPath: spikeTileu.Array.size
value: 2
objectReference: {fileID: 0}
- target: {fileID: 114574072693989902, guid: 3d077a5f727dd1e4780e9265ed26e036,
type: 2}
propertyPath: spikeTiled.Array.size
value: 2
objectReference: {fileID: 0}
- target: {fileID: 114574072693989902, guid: 3d077a5f727dd1e4780e9265ed26e036,
type: 2}
propertyPath: spikeTilel.Array.size
value: 2
objectReference: {fileID: 0}
- target: {fileID: 114574072693989902, guid: 3d077a5f727dd1e4780e9265ed26e036,
type: 2}
propertyPath: spikeTiler.Array.size
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4549734214569802, guid: 3d077a5f727dd1e4780e9265ed26e036, type: 2}
propertyPath: m_LocalPosition.x
value: -5.64
......@@ -510,6 +530,54 @@ Prefab:
propertyPath: combo
value:
objectReference: {fileID: 1200867968}
- target: {fileID: 114574072693989902, guid: 3d077a5f727dd1e4780e9265ed26e036,
type: 2}
propertyPath: spikeTileu.Array.data[0]
value:
objectReference: {fileID: 11400000, guid: 7f2c5cb43ad7207499b22fb5e0acd41a,
type: 2}
- target: {fileID: 114574072693989902, guid: 3d077a5f727dd1e4780e9265ed26e036,
type: 2}
propertyPath: spikeTiled.Array.data[0]
value:
objectReference: {fileID: 11400000, guid: f411e29431b787c4ab84b5ff59ca5e6e,
type: 2}
- target: {fileID: 114574072693989902, guid: 3d077a5f727dd1e4780e9265ed26e036,
type: 2}
propertyPath: spikeTilel.Array.data[0]
value:
objectReference: {fileID: 11400000, guid: 85440e0dd81e48840947ce485614bab6,
type: 2}
- target: {fileID: 114574072693989902, guid: 3d077a5f727dd1e4780e9265ed26e036,
type: 2}
propertyPath: spikeTiler.Array.data[0]
value:
objectReference: {fileID: 11400000, guid: 7dbb7c55a3417f54fbd38fafb369478e,
type: 2}
- target: {fileID: 114574072693989902, guid: 3d077a5f727dd1e4780e9265ed26e036,
type: 2}
propertyPath: spikeTiled.Array.data[1]
value:
objectReference: {fileID: 11400000, guid: 034d5fb04a013124cb432284fdc8c423,
type: 2}
- target: {fileID: 114574072693989902, guid: 3d077a5f727dd1e4780e9265ed26e036,
type: 2}
propertyPath: spikeTileu.Array.data[1]
value:
objectReference: {fileID: 11400000, guid: f9cdf78c8a087c94a9279cc07fc03a25,
type: 2}
- target: {fileID: 114574072693989902, guid: 3d077a5f727dd1e4780e9265ed26e036,
type: 2}
propertyPath: spikeTilel.Array.data[1]
value:
objectReference: {fileID: 11400000, guid: f6a8681f94ddcf24eac96d8e4a5c82f6,
type: 2}
- target: {fileID: 114574072693989902, guid: 3d077a5f727dd1e4780e9265ed26e036,
type: 2}
propertyPath: spikeTiler.Array.data[1]
value:
objectReference: {fileID: 11400000, guid: 69359808565f98f4297a6efb8da5c4da,
type: 2}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 3d077a5f727dd1e4780e9265ed26e036, type: 2}
m_IsPrefabAsset: 0
......
......@@ -3,7 +3,10 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
public class playerOnSpike : MonoBehaviour {
public TileBase[] spikeTile;
public TileBase[] spikeTileu;
public TileBase[] spikeTiled;
public TileBase[] spikeTilel;
public TileBase[] spikeTiler;
public Rigidbody2D rb;
public int SpikeLayer = 10; //10 is for spike layer
public float spikeDamage = 5f;
......@@ -32,28 +35,39 @@ public class playerOnSpike : MonoBehaviour {
if (colTile != null)
{
EnemyAttackInfo attack = new EnemyAttackInfo(spikeDamage, 0f, 0, null, null); //넉백은 따로 구현
GetComponent<PlayerAttack>().TakeDamage(attack);
GetComponent<PlayerAttack>().TakeDamage(attack);
//방향에 따른 넉백 구현
if (colTile == spikeTile[0]) //spike up tile
{
// print("uuch!");
rb.velocity = new Vector2(rb.velocity.x, spikeKnockBacky);
foreach (TileBase tile in spikeTileu) {
if (colTile == tile) //spike up tile
{
// print("uuch!");
rb.velocity = new Vector2(rb.velocity.x, spikeKnockBacky);
}
}
else if (colTile == spikeTile[1]) //spike down tile
foreach (TileBase tile in spikeTiled)
{
// print("duch!");
rb.velocity = new Vector2(rb.velocity.x, -spikeKnockBacky);
if (colTile == tile) //spike down tile
{
// print("duch!");
rb.velocity = new Vector2(rb.velocity.x, -spikeKnockBacky);
}
}
if (colTile == spikeTile[2]) //spike l tile
foreach (TileBase tile in spikeTilel)
{
// print("luch!");
rb.velocity = new Vector2( -spikeKnockBackx, rb.velocity.y);
if (colTile == tile) //spike l tile
{
// print("luch!");
rb.velocity = new Vector2(-spikeKnockBackx, rb.velocity.y);
}
}
else if (colTile == spikeTile[3]) //spike r tile
foreach (TileBase tile in spikeTiler)
{
// print("ruch!");
rb.velocity = new Vector2( spikeKnockBackx, rb.velocity.y);
if (colTile == tile) //spike r tile
{
// print("ruch!");
rb.velocity = new Vector2(spikeKnockBackx, rb.velocity.y);
}
}
}
}
......
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