1
Fork 0

Abuse of the refactor function

This commit is contained in:
Steffo 2019-04-28 16:34:50 +02:00
parent 1ac4d2866b
commit 09333ab4dd
22 changed files with 163 additions and 247 deletions

View file

@ -1,85 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7475959774386308610
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7475959774386308609}
- component: {fileID: 7475959774386308608}
- component: {fileID: 7475959774386308611}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7475959774386308609
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7475959774386308610}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!20 &7475959774386308608
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7475959774386308610}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 8
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!81 &7475959774386308611
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7475959774386308610}
m_Enabled: 1

View file

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 04409c352bfbdea4b9830f11d7b4d40e
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,5 +1,88 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2894367173346332696
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2894367173346332699}
- component: {fileID: 2894367173346332698}
- component: {fileID: 2894367173346332697}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2894367173346332699
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2894367173346332696}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2935319493830293414}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!20 &2894367173346332698
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2894367173346332696}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 8
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!81 &2894367173346332697
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2894367173346332696}
m_Enabled: 1
--- !u!1 &2935319493830293412
GameObject:
m_ObjectHideFlags: 0
@ -9,8 +92,8 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 2935319493830293414}
- component: {fileID: 2935319493830293413}
- component: {fileID: -5893075763862095451}
- component: {fileID: 2935319493830293413}
- component: {fileID: 8856581523727923621}
m_Layer: 0
m_Name: Player
@ -34,24 +117,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2935319493830293413
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2935319493830293412}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4de6b97c3d785d146a0df2c1c078fe91, type: 3}
m_Name:
m_EditorClassIdentifier:
hpMax: 10
overlappable: 0
hp: 10
sprite: {fileID: 21300000, guid: 88f4c277892ae9449a57b321cd810bce, type: 3}
exp: 0
level: 0
--- !u!212 &-5893075763862095451
SpriteRenderer:
m_ObjectHideFlags: 0
@ -100,6 +165,24 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &2935319493830293413
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2935319493830293412}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f16e1b4841b0d4546a52853aafbb7d85, type: 3}
m_Name:
m_EditorClassIdentifier:
hpMax: 0
overlappable: 0
hp: 0
sprite: {fileID: 0}
exp: 0
level: 0
--- !u!114 &8856581523727923621
MonoBehaviour:
m_ObjectHideFlags: 0
@ -109,82 +192,7 @@ MonoBehaviour:
m_GameObject: {fileID: 2935319493830293412}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 05a8e698d12930547a9e83f369e506d2, type: 3}
m_Script: {fileID: 11500000, guid: 0cb881aee511ed643880a50159d731b7, type: 3}
m_Name:
m_EditorClassIdentifier:
damage: 1
--- !u!1001 &5734536248370648602
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 2935319493830293414}
m_Modifications:
- target: {fileID: 7475959774386308610, guid: 04409c352bfbdea4b9830f11d7b4d40e,
type: 3}
propertyPath: m_Name
value: Main Camera
objectReference: {fileID: 0}
- target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e,
type: 3}
propertyPath: m_LocalPosition.z
value: -10
objectReference: {fileID: 0}
- target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 04409c352bfbdea4b9830f11d7b4d40e, type: 3}
--- !u!4 &2894367173346332699 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e,
type: 3}
m_PrefabInstance: {fileID: 5734536248370648602}
m_PrefabAsset: {fileID: 0}

View file

@ -9,8 +9,8 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 2043533519980591455}
- component: {fileID: 571363246873614695}
- component: {fileID: 1351652798109185028}
- component: {fileID: 571363246873614695}
m_Layer: 0
m_Name: Slime
m_TagString: Untagged
@ -32,24 +32,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &571363246873614695
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1164136568549368904}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2fcfe4b94620b234fb7a294bf4453a69, type: 3}
m_Name:
m_EditorClassIdentifier:
hpMax: 2
overlappable: 0
hp: 0
sprite: {fileID: 21300000, guid: ee7ef72c830dc204c9df0595e161f049, type: 3}
moveChance: 0.5
visionRange: 4
--- !u!212 &1351652798109185028
SpriteRenderer:
m_ObjectHideFlags: 0
@ -98,3 +80,21 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &571363246873614695
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1164136568549368904}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1ce1b6adc640d6f46bbf4d7072735b7f, type: 3}
m_Name:
m_EditorClassIdentifier:
hpMax: 0
overlappable: 0
hp: 0
sprite: {fileID: 0}
moveChance: 0.5
visionRange: 4

View file

@ -41,13 +41,13 @@ MonoBehaviour:
m_GameObject: {fileID: 470211819356819165}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1f0883433553dbb4fa23a815949f596b, type: 3}
m_Script: {fileID: 11500000, guid: cfb3c44da9ebb1840b5a2bcdfd5e2730, type: 3}
m_Name:
m_EditorClassIdentifier:
hpMax: 1
hpMax: 0
overlappable: 0
hp: 0
sprite: {fileID: 21300000, guid: 5e4d29e1adc2ea0429b199b82253416c, type: 3}
sprite: {fileID: 0}
--- !u!212 &7501912107144583665
SpriteRenderer:
m_ObjectHideFlags: 0

View file

@ -2,7 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
public class Item : Entity
public class EntityItem : Entity
{
public static string itemName = "White Triangle";
@ -11,7 +11,7 @@ public class Item : Entity
overlappable = true;
}
public virtual void OnPickup(Player player) {
public virtual void OnPickup(EntityPlayer player) {
Debug.LogWarning("OnPickup not overridden");
messageBar.Write("Picked up: " + itemName, Color.yellow);
Destroy(gameObject);

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2fcfe4b94620b234fb7a294bf4453a69
guid: cfb3c44da9ebb1840b5a2bcdfd5e2730
MonoImporter:
externalObjects: {}
serializedVersion: 2

View file

@ -2,7 +2,7 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AI : Entity
public class EntityMonster : Entity
{
public virtual void OnTurn(){
Debug.LogWarning("OnTurn() not overridden");

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4de6b97c3d785d146a0df2c1c078fe91
guid: aec5e971190b4b544a78be24566f9e6c
MonoImporter:
externalObjects: {}
serializedVersion: 2

View file

@ -2,15 +2,15 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AISlime : AI
public class EntityMonsterSlime : EntityMonster
{
public float moveChance = 0.5f;
public float visionRange = 4;
protected Player player;
protected EntityPlayer player;
protected new void Start() {
base.Start();
player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
player = GameObject.FindGameObjectWithTag("Player").GetComponent<EntityPlayer>();
}
public override void OnTurn(){

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1f0883433553dbb4fa23a815949f596b
guid: 1ce1b6adc640d6f46bbf4d7072735b7f
MonoImporter:
externalObjects: {}
serializedVersion: 2

View file

@ -7,7 +7,7 @@ public enum ControlMode {
Attack
}
public class Player : Entity
public class EntityPlayer : Entity
{
public int exp;
public int level;
@ -98,8 +98,8 @@ public class Player : Entity
//Check for pickuppable items
List<Entity> entities = turnHandler.GetEntitiesAtPosition(MapPosition);
foreach(Entity entity in entities) {
if(entity is Item) {
Item item = entity as Item;
if(entity is EntityItem) {
EntityItem item = entity as EntityItem;
item.OnPickup(this);
}
}

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e694420377849854db7a2686ff36420c
guid: f16e1b4841b0d4546a52853aafbb7d85
MonoImporter:
externalObjects: {}
serializedVersion: 2

View file

@ -5,11 +5,11 @@ using UnityEngine.UI;
public class FillAmountFromPlayerHP : MonoBehaviour
{
private Player player;
private EntityPlayer player;
private Image image;
private void Start() {
player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
player = GameObject.FindGameObjectWithTag("Player").GetComponent<EntityPlayer>();
image = GetComponent<Image>();
}

View file

@ -124,10 +124,10 @@ public class Map : MonoBehaviour
private List<MapRoom> rooms;
private TurnHandler turnHandler;
public Tile GetTile(Vector2Int position) {
public MapTile GetTile(Vector2Int position) {
try {
GameObject tileObject = tiles[position.x, position.y];
return tileObject.GetComponent<Tile>();
return tileObject.GetComponent<MapTile>();
}
catch(System.IndexOutOfRangeException) {
return null;
@ -151,7 +151,7 @@ public class Map : MonoBehaviour
}
private void EditTile(Vector2Int position, bool walkable, bool roomPart) {
Tile tile = GetTile(position);
MapTile tile = GetTile(position);
tile.walkable = walkable;
tile.roomPart |= roomPart;
}
@ -163,7 +163,7 @@ public class Map : MonoBehaviour
tileObject.transform.position = new Vector3(x, y, 0);
tiles[x, y] = tileObject;
tileObject.name = "Tile [" + x.ToString() + ", " + y.ToString() + "]";
Tile tile = tileObject.GetComponent<Tile>();
MapTile tile = tileObject.GetComponent<MapTile>();
tile.walkable = false;
}
}
@ -270,8 +270,8 @@ public class Map : MonoBehaviour
public void GenerateTileSprites() {
for(int x = 0; x < mapSize; x++) {
for(int y = 0; y < mapSize; y++) {
Tile tile = GetTile(new Vector2Int(x, y));
Tile otherTile;
MapTile tile = GetTile(new Vector2Int(x, y));
MapTile otherTile;
if(tile.walkable) tile.sprite = SampleSprite(floorSprites);
else if((bool)(otherTile = GetTile(new Vector2Int(x, y+1))) && otherTile.walkable) tile.sprite = SampleSprite(botWallSprites);
else if((bool)(otherTile = GetTile(new Vector2Int(x, y+1))) && otherTile.walkable) tile.sprite = SampleSprite(topWallSprites);

View file

@ -2,7 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
public class Tile : MonoBehaviour
public class MapTile : MonoBehaviour
{
public bool walkable;
public bool roomPart;

View file

@ -4,13 +4,13 @@ using UnityEngine;
public class PlayerAttack : MonoBehaviour
{
protected Player player;
protected EntityPlayer player;
protected GameObject gameController;
protected TurnHandler turnHandler;
protected Map map;
protected void Start() {
player = GetComponent<Player>();
player = GetComponent<EntityPlayer>();
gameController = GameObject.FindGameObjectWithTag("GameController");
turnHandler = gameController.GetComponentInChildren<TurnHandler>();
map = gameController.GetComponentInChildren<Map>();

View file

@ -2,7 +2,7 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerAttack_Melee : PlayerAttack
public class PlayerAttackMelee : PlayerAttack
{
public float damage = 1f;

View file

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

View file

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

View file

@ -12,8 +12,8 @@ public class TurnHandler : MonoBehaviour
entity.Die();
}
//Move AIs
if(entity is AI) {
AI ai = entity as AI;
if(entity is EntityMonster) {
EntityMonster ai = entity as EntityMonster;
ai.OnTurn();
}
}