Fixed some bugs
This commit is contained in:
parent
0d54723900
commit
c45632247d
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 173f6a76aed37484ab7c21df3d06555d
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,7 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class CustomSnap : MonoBehaviour
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 15744dd8ca4a9044b844f2c87e4715eb
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,12 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class CustomSnapPoint : MonoBehaviour
|
|
||||||
{
|
|
||||||
private void OnDrawGizmos()
|
|
||||||
{
|
|
||||||
Gizmos.color = Color.green;
|
|
||||||
Gizmos.DrawSphere(transform.position, radius: 0.05f);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 44c61104889393343ac0fea14ff74581
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,77 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEditor;
|
|
||||||
using UnityEditor.EditorTools;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
[EditorTool("Custom Snap Move", typeof(CustomSnap))]
|
|
||||||
public class CustomSnappingTool : EditorTool
|
|
||||||
{
|
|
||||||
public Texture2D ToolIcon;
|
|
||||||
|
|
||||||
public override GUIContent toolbarIcon {
|
|
||||||
get
|
|
||||||
{
|
|
||||||
|
|
||||||
return new GUIContent
|
|
||||||
{
|
|
||||||
image = ToolIcon,
|
|
||||||
text = "Custom Snape Move Tool",
|
|
||||||
tooltip = "Custom Snape Move Tool - best tool ever"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnToolGUI(EditorWindow window)
|
|
||||||
{
|
|
||||||
Transform targetTransform = ((CustomSnap)target).transform;
|
|
||||||
|
|
||||||
EditorGUI.BeginChangeCheck();
|
|
||||||
Vector3 newPosition = Handles.PositionHandle(targetTransform.position, Quaternion.identity);
|
|
||||||
|
|
||||||
if(EditorGUI.EndChangeCheck())
|
|
||||||
{
|
|
||||||
Undo.RecordObject(targetTransform, name: "Move with snap tool");
|
|
||||||
} MoveWithSnapping(targetTransform, newPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void MoveWithSnapping(Transform targetTransform, Vector3 newPosition)
|
|
||||||
{
|
|
||||||
CustomSnapPoint[] allPoints = FindObjectsOfType<CustomSnapPoint>();
|
|
||||||
CustomSnapPoint[] targetPoints = targetTransform.GetComponentsInChildren<CustomSnapPoint>();
|
|
||||||
|
|
||||||
Vector3 bestPosition = newPosition;
|
|
||||||
float closestDistance = float.PositiveInfinity;
|
|
||||||
|
|
||||||
foreach (CustomSnapPoint point in allPoints)
|
|
||||||
{
|
|
||||||
if (point.transform.parent == targetTransform) continue;
|
|
||||||
|
|
||||||
foreach (CustomSnapPoint ownPoint in targetPoints)
|
|
||||||
{
|
|
||||||
Vector3 targetPos = point.transform.position - (ownPoint.transform.position - targetTransform.position);
|
|
||||||
float distance = Vector3.Distance(a: targetPos, b: newPosition);
|
|
||||||
|
|
||||||
if(distance < closestDistance)
|
|
||||||
{
|
|
||||||
closestDistance = distance;
|
|
||||||
bestPosition = targetPos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(closestDistance < 0.5f)
|
|
||||||
{
|
|
||||||
targetTransform.position = bestPosition;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
targetTransform.position = newPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: cce80278a8aadb94bac8ebc9be8cf090
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences:
|
|
||||||
- m_Target: {instanceID: 0}
|
|
||||||
- ToolIcon: {fileID: 2800000, guid: 0b6f492d8c1555c4da0550561f2e5f4b, type: 3}
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -3401,6 +3401,7 @@ MonoBehaviour:
|
|||||||
menuSprites:
|
menuSprites:
|
||||||
- {fileID: 21300000, guid: 426478b073313244bbe84d3ec1cafa64, type: 3}
|
- {fileID: 21300000, guid: 426478b073313244bbe84d3ec1cafa64, type: 3}
|
||||||
- {fileID: 21300000, guid: 29916103981328e438052adcf04f2737, type: 3}
|
- {fileID: 21300000, guid: 29916103981328e438052adcf04f2737, type: 3}
|
||||||
|
gameText: {fileID: 1138818630}
|
||||||
--- !u!1 &1862883448
|
--- !u!1 &1862883448
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -71,6 +71,7 @@ public class SuperJump : PlayerAction
|
|||||||
if (tile.buildingOnTile != null)
|
if (tile.buildingOnTile != null)
|
||||||
{
|
{
|
||||||
Destroy(tile.buildingOnTile);
|
Destroy(tile.buildingOnTile);
|
||||||
|
TileManagment.ReleaseTile(tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,15 @@ using System.Collections;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
public class ChooseLevelButtonsTasks : MonoBehaviour
|
public class ChooseLevelButtonsTasks : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] private Image menuLevelImg;
|
[SerializeField] private Image menuLevelImg;
|
||||||
[SerializeField] private List<Sprite> menuSprites;
|
[SerializeField] private List<Sprite> menuSprites;
|
||||||
|
[SerializeField] private TextMeshProUGUI gameText;
|
||||||
|
|
||||||
|
private List<string> menuText = new List<string> { "MATS", "EMIR" };
|
||||||
|
|
||||||
private int levelsAmount = 2;
|
private int levelsAmount = 2;
|
||||||
|
|
||||||
@ -20,6 +24,7 @@ public class ChooseLevelButtonsTasks : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
menuLevelImg.sprite = menuSprites[GameData.currentChosenLevel - 1];
|
menuLevelImg.sprite = menuSprites[GameData.currentChosenLevel - 1];
|
||||||
|
gameText.text = menuText[GameData.currentChosenLevel - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnNextBtnClick()
|
public void OnNextBtnClick()
|
||||||
@ -31,6 +36,7 @@ public class ChooseLevelButtonsTasks : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
menuLevelImg.sprite = menuSprites[GameData.currentChosenLevel - 1];
|
menuLevelImg.sprite = menuSprites[GameData.currentChosenLevel - 1];
|
||||||
|
gameText.text = menuText[GameData.currentChosenLevel - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnTestBtnClick()
|
public void OnTestBtnClick()
|
||||||
|
@ -68,6 +68,7 @@ public class TileManagment : MonoBehaviour
|
|||||||
foreach (var tile in levelTiles)
|
foreach (var tile in levelTiles)
|
||||||
{
|
{
|
||||||
lvTilesStruct[(int)Mathf.Round(2 * tile.tilePosition.x / tileOffset), (int)Mathf.Round(-2 * tile.tilePosition.z / tileOffset)] = tile;
|
lvTilesStruct[(int)Mathf.Round(2 * tile.tilePosition.x / tileOffset), (int)Mathf.Round(-2 * tile.tilePosition.z / tileOffset)] = tile;
|
||||||
|
//Debug.Log((int)Mathf.Round(2 * tile.tilePosition.x / tileOffset) +" and "+ Mathf.Round(-2 * tile.tilePosition.z / tileOffset));
|
||||||
}
|
}
|
||||||
|
|
||||||
OnInitialized?.Invoke();
|
OnInitialized?.Invoke();
|
||||||
@ -194,8 +195,9 @@ public class TileManagment : MonoBehaviour
|
|||||||
{
|
{
|
||||||
return resultTile;
|
return resultTile;
|
||||||
}*/
|
}*/
|
||||||
if (position.x < 0 || position.z > 0)
|
if (position.x < 0 || position.z > 0.5f)
|
||||||
{
|
{
|
||||||
|
//Debug.Log("null pos");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,8 +205,10 @@ public class TileManagment : MonoBehaviour
|
|||||||
|
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
|
//Debug.Log(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
//Debug.Log("not tile");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ public class ToweHealthController : MonoBehaviour
|
|||||||
|
|
||||||
private void Die()
|
private void Die()
|
||||||
{
|
{
|
||||||
|
TileInfo tile = TileManagment.GetTile(transform.position);
|
||||||
|
TileManagment.ReleaseTile(tile);
|
||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ PlayerSettings:
|
|||||||
16:10: 1
|
16:10: 1
|
||||||
16:9: 1
|
16:9: 1
|
||||||
Others: 1
|
Others: 1
|
||||||
bundleVersion: 0.36
|
bundleVersion: 0.38
|
||||||
preloadedAssets: []
|
preloadedAssets: []
|
||||||
metroInputSource: 0
|
metroInputSource: 0
|
||||||
wsaTransparentSwapchain: 0
|
wsaTransparentSwapchain: 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user