FIIIIIREEEEE

This commit is contained in:
2023-06-28 13:38:48 +03:00
parent 79c870b6fa
commit c79d2a6b49
25 changed files with 1415 additions and 1798 deletions
+1 -1
View File
@@ -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 }
+21
View File
@@ -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);
}
}
}
+11
View File
@@ -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:
+14
View File
@@ -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"));
}
}