Added bomb strength

This commit is contained in:
misabiko 2020-06-28 20:04:25 -04:00
parent 0182f417e2
commit c2257ed8ab
4 changed files with 55 additions and 18 deletions

View File

@ -1,6 +1,6 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7698221246229025840
--- !u!1 &3527468927952399082
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -8,46 +8,45 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7698221246229025836}
- component: {fileID: 7698221246229025839}
- component: {fileID: 7698221246229025838}
- component: {fileID: 7698221246229025841}
- component: {fileID: 8302018831448756210}
- component: {fileID: 4021005470752642242}
- component: {fileID: 2520958024087343749}
m_Layer: 0
m_Name: Explosion
m_Name: Mesh
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7698221246229025836
--- !u!4 &8302018831448756210
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7698221246229025840}
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_GameObject: {fileID: 3527468927952399082}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.2, y: 1.72, z: 1.2}
m_LocalScale: {x: 1, y: 1.72, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_Father: {fileID: 7698221246229025836}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!33 &7698221246229025839
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &4021005470752642242
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7698221246229025840}
m_GameObject: {fileID: 3527468927952399082}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &7698221246229025838
--- !u!23 &2520958024087343749
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7698221246229025840}
m_GameObject: {fileID: 3527468927952399082}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
@ -80,6 +79,38 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!1 &7698221246229025840
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7698221246229025836}
- component: {fileID: 7698221246229025841}
m_Layer: 0
m_Name: Explosion
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7698221246229025836
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7698221246229025840}
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.2, y: 1, z: 1.2}
m_Children:
- {fileID: 8302018831448756210}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!136 &7698221246229025841
CapsuleCollider:
m_ObjectHideFlags: 0

View File

@ -16,7 +16,9 @@ public class Arena : MonoBehaviour {
var newRotation = Quaternion.Euler(rotation.eulerAngles + Vector3.up * i * 60f);
var explosion = Instantiate(explosionPrefab, explosionPos, newRotation);
//TODO multiply explosion.transform.scale.y by strength
explosion.GetComponent<CapsuleCollider>().height = 2f * strength * data.hexHeight;
explosion.transform.GetChild(0).localScale = new Vector3(1f, strength * data.hexHeight, 1f);
Destroy(explosion, 1f);
}

View File

@ -33,6 +33,8 @@ public class MapData : ScriptableObject {
}*/
public float hexSize = 1f;
//TODO Make hexSize modify hexHeight on set
public float hexHeight = Mathf.Sqrt(3f);
//TODO would be nice if I could store a Matrix2x2
public Vector3 AxialToWorld(Vector2 axial)

View File

@ -7,6 +7,8 @@ public class Player : MonoBehaviour {
public GameObject bombPrefab;
public Arena arena;
int strength = 1;
void Start() {
Transform canvas = GameObject.Find("Canvas").transform;
PlayerLabel label = Instantiate(labelPrefab, canvas).GetComponent<PlayerLabel>();
@ -22,6 +24,6 @@ public class Player : MonoBehaviour {
void OnPlace(InputAction.CallbackContext ctx) {
var bomb = Instantiate(bombPrefab, arena.GetClosestTilePos(transform.position) - Vector3.up * 0.5f, bombPrefab.transform.rotation);
bomb.GetComponent<Bomb>().Init(1, arena);
bomb.GetComponent<Bomb>().Init(strength, arena);
}
}