merloj: applied new soldiers to tilemap

This commit is contained in:
Maciekxdabu 2022-05-16 14:44:45 +02:00
parent 3e6fb92ac2
commit 6019a8eccd
7 changed files with 17 additions and 141 deletions

View File

@ -1,113 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7329575924073430320
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7329575924073430335}
- component: {fileID: 7329575924073430332}
- component: {fileID: 7329575924073430333}
- component: {fileID: 7329575924073430322}
- component: {fileID: 7329575924073430323}
m_Layer: 0
m_Name: Dummy Soldier
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7329575924073430335
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7329575924073430320}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &7329575924073430332
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7329575924073430320}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &7329575924073430333
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7329575924073430320}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!136 &7329575924073430322
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7329575924073430320}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &7329575924073430323
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7329575924073430320}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8cb9ceee24755fa4880d17603fefc63a, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -59,7 +59,7 @@ Rigidbody:
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 1
m_UseGravity: 0
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
@ -76,6 +76,13 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d34caf35d0ce610f8bc87cf815ba1915, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
enemyTag:
healthPoints: 1
rangeAttack: 1
rangeView: 1
damageAttack: 1
speedAttack: 1
--- !u!1 &2353457452513625490
GameObject:
m_ObjectHideFlags: 0

View File

@ -1,8 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DummySoldier : MonoBehaviour
{
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 8cb9ceee24755fa4880d17603fefc63a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,6 +1,7 @@
fileFormatVersion: 2
guid: 0cea408c577cfdf4fa0c7295d22ba421
PrefabImporter:
guid: 5d5ec7ec529070f4aa733bf14cc8e222
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:

View File

@ -14,7 +14,7 @@ public class TilemapManager : MonoBehaviour
public struct Tile
{
public DummySoldier standingSoldier;
public Soldier standingSoldier;
}
[Header("Common Values")]
@ -49,8 +49,8 @@ public class TilemapManager : MonoBehaviour
private void Start()
{
SpawnSoldier(soldierStartingPosition.x, soldierStartingPosition.y);
SpawnSoldier(enemyStartingPosition.x, enemyStartingPosition.y);
SpawnSoldier(soldierStartingPosition.x, soldierStartingPosition.y, true);
SpawnSoldier(enemyStartingPosition.x, enemyStartingPosition.y, false);
}
private void OnValidate()
@ -76,12 +76,12 @@ public class TilemapManager : MonoBehaviour
// ---------- public functions
public bool SpawnSoldier(int x, int y)
public bool SpawnSoldier(int x, int y, bool isAlly)
{
if (GetTileState(x, y) != TileState.free)
return false;
tiles[x, y].standingSoldier = Instantiate(soldierPrefab, tilemap.CellToWorld(new Vector3Int(x, y, 0)), Quaternion.identity).GetComponent<DummySoldier>();
tiles[x, y].standingSoldier = Instantiate(soldierPrefab, tilemap.CellToWorld(new Vector3Int(x, y, 0)), Quaternion.identity).GetComponent<Soldier>();
if (tiles[x, y].standingSoldier != null)
return true;
@ -101,7 +101,7 @@ public class TilemapManager : MonoBehaviour
return true;
}
public DummySoldier GetSoldier(int x, int y)
public Soldier GetSoldier(int x, int y)
{
if (GetTileState(x, y) != TileState.taken)
return null;