FIIIIIREEEEE
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
public enum TreasureType { Coin, Key }
|
||||
public enum MapElementType {Empty,Wall,Ladder,Bridge }
|
||||
public enum MapElementType {Empty,Wall,Ladder,Bridge,BreakableWall,Water }
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Hammer : MonoBehaviour
|
||||
{
|
||||
private float _life = 3;
|
||||
private void Awake()
|
||||
{
|
||||
Destroy(gameObject, _life);
|
||||
}
|
||||
|
||||
private void OnCollisionEnter2D(Collision2D collision)
|
||||
{
|
||||
var player = collision.collider.GetComponent<Player>();
|
||||
if (player == null)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a389cb21d7bb9ce4391feffae499272f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,15 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 541209b3a8828a3429d3a6c93b0350f3, type: 3}
|
||||
m_Name: BreakableWall
|
||||
m_EditorClassIdentifier:
|
||||
ElementType: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da0ec95da6f0526499978941b1631c3e
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -2,10 +2,19 @@ using UnityEngine;
|
||||
|
||||
public class Player : Character
|
||||
{
|
||||
[SerializeField]
|
||||
private Transform _hammerSpawnPoint;
|
||||
[SerializeField]
|
||||
private GameObject _hammerPrefab;
|
||||
|
||||
private int _hammerSpeed=10;
|
||||
|
||||
private int _totalCoins = 0;
|
||||
private bool _hasKey = false;
|
||||
public static Player Instance { get; private set; }
|
||||
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
@@ -45,6 +54,11 @@ public class Player : Character
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
var hammer = Instantiate(_hammerPrefab, _hammerSpawnPoint.position, _hammerSpawnPoint.rotation);
|
||||
hammer.GetComponent<Rigidbody2D>().velocity = new Vector2(gameObject.transform.localScale.x * _hammerSpeed,0);
|
||||
}
|
||||
base.MoveTo(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user