Skip to content

Commit

Permalink
version 0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
delmarle committed May 27, 2020
1 parent 1b95892 commit 05e8f0e
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 106 deletions.
65 changes: 0 additions & 65 deletions station/Assets/Content/Prefabs/Ui/[Ui root].prefab
Original file line number Diff line number Diff line change
Expand Up @@ -11861,11 +11861,6 @@ PrefabInstance:
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2518230151577645777, guid: 1ab78d5fa53f44cb2ae59ff4797ab4fb,
type: 3}
propertyPath: m_RaycastTarget
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2518230151577645790, guid: 1ab78d5fa53f44cb2ae59ff4797ab4fb,
type: 3}
propertyPath: m_AnchorMax.x
Expand All @@ -11876,16 +11871,6 @@ PrefabInstance:
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2518230151704592167, guid: 1ab78d5fa53f44cb2ae59ff4797ab4fb,
type: 3}
propertyPath: m_RaycastTarget
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2518230151954484969, guid: 1ab78d5fa53f44cb2ae59ff4797ab4fb,
type: 3}
propertyPath: m_RaycastTarget
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2518230151954484982, guid: 1ab78d5fa53f44cb2ae59ff4797ab4fb,
type: 3}
propertyPath: m_AnchorMax.x
Expand All @@ -11896,11 +11881,6 @@ PrefabInstance:
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2518230153111852060, guid: 1ab78d5fa53f44cb2ae59ff4797ab4fb,
type: 3}
propertyPath: m_RaycastTarget
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2518230153378732568, guid: 1ab78d5fa53f44cb2ae59ff4797ab4fb,
type: 3}
propertyPath: m_Name
Expand Down Expand Up @@ -12011,51 +11991,6 @@ PrefabInstance:
propertyPath: m_Pivot.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5527041148368899741, guid: 1ab78d5fa53f44cb2ae59ff4797ab4fb,
type: 3}
propertyPath: AnimationModels.Array.size
value: 2
objectReference: {fileID: 0}
- target: {fileID: 5527041148368899741, guid: 1ab78d5fa53f44cb2ae59ff4797ab4fb,
type: 3}
propertyPath: AnimationModels.Array.data[0].AnimationClipModels.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5527041148368899741, guid: 1ab78d5fa53f44cb2ae59ff4797ab4fb,
type: 3}
propertyPath: AnimationModels.Array.data[1].AnimationClipModels.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5527041148368899741, guid: 1ab78d5fa53f44cb2ae59ff4797ab4fb,
type: 3}
propertyPath: AnimationModels.Array.data[0].State
value: alive
objectReference: {fileID: 0}
- target: {fileID: 5527041148368899741, guid: 1ab78d5fa53f44cb2ae59ff4797ab4fb,
type: 3}
propertyPath: AnimationModels.Array.data[0].AnimationClipModels.Array.data[0].Clip
value:
objectReference: {fileID: 7400000, guid: 78f5034ce476a45358aa796324097f9a, type: 2}
- target: {fileID: 5527041148368899741, guid: 1ab78d5fa53f44cb2ae59ff4797ab4fb,
type: 3}
propertyPath: AnimationModels.Array.data[0].AnimationClipModels.Array.data[0].Weight
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5527041148368899741, guid: 1ab78d5fa53f44cb2ae59ff4797ab4fb,
type: 3}
propertyPath: AnimationModels.Array.data[1].State
value: dead
objectReference: {fileID: 0}
- target: {fileID: 5527041148368899741, guid: 1ab78d5fa53f44cb2ae59ff4797ab4fb,
type: 3}
propertyPath: AnimationModels.Array.data[1].AnimationClipModels.Array.data[0].Clip
value:
objectReference: {fileID: 7400000, guid: 6a68448bb148547199974cbc43fa2b31, type: 2}
- target: {fileID: 5527041148368899741, guid: 1ab78d5fa53f44cb2ae59ff4797ab4fb,
type: 3}
propertyPath: AnimationModels.Array.data[1].AnimationClipModels.Array.data[0].Weight
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1ab78d5fa53f44cb2ae59ff4797ab4fb, type: 3}
--- !u!114 &6083342869955061713 stripped
Expand Down
30 changes: 20 additions & 10 deletions station/Assets/Content/Prefabs/Ui/characterPortraitWidget.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.0141509175, g: 0.63997257, b: 1, a: 0.8666667}
m_RaycastTarget: 1
m_RaycastTarget: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -242,9 +242,9 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 51.4, y: -4}
m_SizeDelta: {x: 94.8, y: 11.43}
m_Pivot: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 5, y: -4}
m_SizeDelta: {x: 80, y: 11.43}
m_Pivot: {x: 0, y: 0.5}
--- !u!222 &2518230151635291578
CanvasRenderer:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -307,7 +307,7 @@ MonoBehaviour:
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 1
m_textAlignment: 65535
m_textAlignment: 257
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
Expand Down Expand Up @@ -496,7 +496,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.1509434, g: 0.1509434, b: 0.1509434, a: 1}
m_RaycastTarget: 1
m_RaycastTarget: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -582,7 +582,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0, b: 0, a: 0.8666667}
m_RaycastTarget: 1
m_RaycastTarget: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -696,7 +696,7 @@ MonoBehaviour:
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 2
m_textAlignment: 65535
m_textAlignment: 260
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
Expand Down Expand Up @@ -998,7 +998,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.1509434, g: 0.1509434, b: 0.1509434, a: 1}
m_RaycastTarget: 1
m_RaycastTarget: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -1184,7 +1184,17 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 8cea1f122be2f4ca58fdae85d4bdab5b, type: 3}
m_Name:
m_EditorClassIdentifier:
AnimationModels: []
AnimationModels:
- State: alive
AnimationClipModels:
- Clip: {fileID: 7400000, guid: 78f5034ce476a45358aa796324097f9a, type: 2}
Weight: 1
LayerIndex: 0
- State: dead
AnimationClipModels:
- Clip: {fileID: 7400000, guid: 6a68448bb148547199974cbc43fa2b31, type: 2}
Weight: 1
LayerIndex: 0
UseDefaultState: 0
DefaultState:
--- !u!111 &2800660740833538975
Expand Down
18 changes: 1 addition & 17 deletions station/Assets/Content/Prefabs/npc/Chomper.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -2952,7 +2952,6 @@ GameObject:
- component: {fileID: 3128725688212506763}
- component: {fileID: 5268744292986777152}
- component: {fileID: 3232383768615095540}
- component: {fileID: 6076973911399063055}
m_Layer: 9
m_Name: Chomper
m_TagString: Player
Expand Down Expand Up @@ -3027,6 +3026,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 526cdf1baba6241abb563dd121e21c69, type: 3}
m_Name:
m_EditorClassIdentifier:
FloatingPopupAnchor: {fileID: 0}
_inputHandler: {fileID: 3128725688212506763}
_characterVisual: {fileID: 807293061399403082}
--- !u!114 &9074964469764159522
Expand All @@ -3043,9 +3043,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
_movementSettings:
_acceleration: 10
_walkSpeed: 2
_jogSpeed: 4
_sprintSpeed: 6
_jumpForce: 10
_gravitySettings:
gravityStrength: 27
Expand Down Expand Up @@ -3095,19 +3092,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6fc9d87f2260d47b895850fac9514cf1, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &6076973911399063055
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8007653114716165723}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4667d50ea7b424dd9b885b60a08dab95, type: 3}
m_Name:
m_EditorClassIdentifier:
input: {fileID: 5268744292986777152}
--- !u!1 &8083002350899495092
GameObject:
m_ObjectHideFlags: 0
Expand Down
10 changes: 10 additions & 0 deletions station/Assets/RpgStation/Characters/Ai/CharacterBrain.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using UnityEngine;

namespace Station
{
public abstract class CharacterBrain : MonoBehaviour
{
public abstract void Setup(BaseCharacter owner);
public abstract void TickBrain();
}
}
11 changes: 11 additions & 0 deletions station/Assets/RpgStation/Characters/Ai/CharacterBrain.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 19 additions & 12 deletions station/Assets/RpgStation/Characters/BaseCharacter.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine;

namespace Station
Expand Down Expand Up @@ -44,6 +43,8 @@ public class BaseCharacter : MonoBehaviour
private ActionHandler _action = null;
public ActionHandler Action => _action;

private CharacterBrain _brain;

private bool _isDead;

public bool IsDead
Expand Down Expand Up @@ -144,17 +145,15 @@ private void OnDestroy()
_action.Unsubscribe();
}

public void Init(string characterId, string raceId, string factionId, string genderId, CharacterCalculation instance, string characterName, Dictionary<string, object> meta = null)
public void Init(
string characterId,
string raceId,
string factionId,
string genderId,
CharacterCalculation instance,
string characterName,
CharacterBrain brain)
{


if (meta != null)
{
foreach (var entry in meta)
{
AddMeta(entry.Key, entry.Value);
}
}

_characterId = characterId;
_raceId = raceId;
Expand All @@ -165,6 +164,10 @@ public void Init(string characterId, string raceId, string factionId, string gen
_calculatorInstance = instance;

_calculatorInstance.Setup(this);
if (_brain)
{
brain.Setup(this);
}
}

public void SetRenderer(Renderer cache)
Expand Down Expand Up @@ -225,6 +228,10 @@ public Stance ResolveStance(BaseCharacter requester)

private void Update()
{
if (_brain)
{
_brain.TickBrain();
}
_action?.UpdateCombat();
_action?.UpdateLoop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public override void Build(BaseCharacter character, BaseCharacterData baseData,
}

calculatorInstance.PreSetup(model);
character.Init(baseData.CharacterId, model.RaceId, model.FactionId, "Male", calculatorInstance, model.Name);
character.Init(baseData.CharacterId, model.RaceId, model.FactionId, "Male", calculatorInstance,model.Name,null);
character.SetupAction(model.Attack);
character.AddMeta(StationConst.NPC_KEY, baseData.Identifier);
character.AddMeta(StationConst.ICON_ID, model.Icon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public override void Build(BaseCharacter character, BaseCharacterData baseData,

calculatorInstance.PreSetup(classData);

character.Init(baseData.CharacterId,save.RaceId, save.FactionId, save.GenderId, calculatorInstance, save.Name);
character.Init(baseData.CharacterId,save.RaceId, save.FactionId, save.GenderId, calculatorInstance, save.Name, null);
character.SetupAction(model.Attack);
character.AddMeta(StationConst.CLASS_ID, save.ClassId);
character.AddMeta(StationConst.CHARACTER_ID, data[2]);
Expand Down

0 comments on commit 05e8f0e

Please sign in to comment.