Format code

This commit is contained in:
Sollace 2018-11-21 22:16:20 +02:00
parent 84efb53960
commit 894aa095cc
24 changed files with 696 additions and 701 deletions

View file

@ -1,14 +1,28 @@
public enum CloudRegionCode
{
/// <summary>
/// Country region codes for the remote cloud server
/// </summary>
public enum CloudRegionCode {
// Europe
eu = 0,
// United States
us = 1,
// Asia
asia = 2,
// Japone
jp = 3,
// Australia
au = 5,
// ???
usw = 6,
// Saddle Arabia
sa = 7,
// ???
cae = 8,
// ???
kr = 9,
// India
@in = 10,
// None/Offline
none = 4
}

View file

@ -1,8 +1,6 @@
using Fie.Object;
namespace Fie.AI
{
public class FieAIControllerBase : FieInputControllerBase
{
namespace Fie.AI {
public class FieAIControllerBase : FieInputControllerBase {
}
}

View file

@ -3,97 +3,84 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Fie.AI
{
public class FieAIHateController : FieAIControllerBase
{
private float MAXIMUM_STACKED_HATE = 6f;
namespace Fie.AI {
public class FieAIHateController : FieAIControllerBase {
private float MAXIMUM_STACKED_HATE = 6;
private Dictionary<int, IEnumerator> _hateCorutine = new Dictionary<int, IEnumerator>();
private Dictionary<int, float> _hateList = new Dictionary<int, float>();
private void Start()
{
_ownerCharacter.damageSystem.damagedEvent += delegate(FieGameCharacter attacker, FieDamage damage)
{
if (!(attacker == null) && damage != null && PhotonNetwork.isMasterClient)
{
private void Start() {
_ownerCharacter.damageSystem.damagedEvent += delegate (FieGameCharacter attacker, FieDamage damage) {
if (attacker != null && damage != null && PhotonNetwork.isMasterClient) {
AddHate(attacker, damage.hate);
}
};
}
private void AddHate(FieGameCharacter attaker, float hate)
{
if (!(attaker == null))
{
private void AddHate(FieGameCharacter attaker, float hate) {
if (!(attaker == null)) {
int instanceID = attaker.GetInstanceID();
if (_hateCorutine.ContainsKey(instanceID))
{
if (_hateCorutine.ContainsKey(instanceID)) {
StopCoroutine(_hateCorutine[instanceID]);
}
if (!_hateList.ContainsKey(instanceID))
{
if (!_hateList.ContainsKey(instanceID)) {
_hateList[instanceID] = hate;
}
else
{
} else {
_hateList[instanceID] = Mathf.Min(_hateList[instanceID] + hate, MAXIMUM_STACKED_HATE);
}
_hateCorutine[instanceID] = CalculateHateCoroutine(instanceID);
StartCoroutine(_hateCorutine[instanceID]);
}
}
private void Update()
{
private void Update() {
updateLockonTargetByHate();
}
private void updateLockonTargetByHate()
{
if (_hateList.Count > 0)
{
private void updateLockonTargetByHate() {
if (_hateList.Count > 0) {
bool flag = false;
int instanceId = 0;
float num = 0f;
foreach (KeyValuePair<int, float> hate in _hateList)
{
if (num < hate.Value)
{
float num = 0;
foreach (KeyValuePair<int, float> hate in _hateList) {
if (num < hate.Value) {
instanceId = hate.Key;
flag = true;
}
num = Mathf.Max(num, hate.Value);
}
if (flag)
{
if (flag) {
_ownerCharacter.detector.ChangeLockonTargetByInstanceID(instanceId);
}
}
}
private IEnumerator CalculateHateCoroutine(int attackerInstanceId)
{
if (_hateList.ContainsKey(attackerInstanceId))
{
Dictionary<int, float> hateList;
int key;
(hateList = _hateList)[key = attackerInstanceId] = hateList[key] - Time.deltaTime;
if (!(_hateList[attackerInstanceId] <= 0f))
{
yield return (object)0;
/*Error: Unable to find new state assignment for yield return*/;
private IEnumerator CalculateHateCoroutine(int attackerInstanceId) {
if (_hateList.ContainsKey(attackerInstanceId)) {
_hateList[attackerInstanceId] -= Time.deltaTime;
if (_hateList[attackerInstanceId] > 0) {
yield return 0;
}
_hateList.Remove(attackerInstanceId);
}
if (_hateCorutine.ContainsKey(attackerInstanceId))
{
if (_hateCorutine.ContainsKey(attackerInstanceId)) {
_hateCorutine.Remove(attackerInstanceId);
}
yield return (object)null;
/*Error: Unable to find new state assignment for yield return*/;
yield return null;
}
}
}

View file

@ -2,12 +2,9 @@ using Fie.Object;
using Fie.Ponies.Applejack;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskApplejackBackstep : FieAITaskBase
{
private enum StepState
{
namespace Fie.AI {
public class FieAITaskApplejackBackstep : FieAITaskBase {
private enum StepState {
STATE_PREPARE,
STATE_STEP
}
@ -18,42 +15,42 @@ namespace Fie.AI
private StepState _stepState;
public override void Initialize(FieAITaskController manager)
{
public override void Initialize(FieAITaskController manager) {
_isEndState = false;
_stepState = StepState.STATE_PREPARE;
}
public override bool Task(FieAITaskController manager)
{
if (manager.ownerCharacter.groundState != 0)
{
public override bool Task(FieAITaskController manager) {
if (manager.ownerCharacter.groundState != 0) {
return true;
}
switch (_stepState)
{
case StepState.STATE_PREPARE:
{
Vector3 directionalVec = new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), Random.Range(-1f, 1f));
switch (_stepState) {
case StepState.STATE_PREPARE: {
Vector3 directionalVec = new Vector3(
Random.Range(-1f, 1f),
Random.Range(-1f, 1f),
Random.Range(-1f, 1f)
);
manager.ownerCharacter.RequestToChangeState<FieStateMachineApplejackEvasion>(directionalVec, 1f, FieGameCharacter.StateMachineType.Base);
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (currentStateMachine is FieStateMachineApplejackEvasion || currentStateMachine is FieStateMachineApplejackBackstep || currentStateMachine is FieStateMachineApplejackCharge)
{
currentStateMachine.stateChangeEvent += delegate
{
if (currentStateMachine is FieStateMachineApplejackEvasion
|| currentStateMachine is FieStateMachineApplejackBackstep
|| currentStateMachine is FieStateMachineApplejackCharge) {
currentStateMachine.stateChangeEvent += delegate {
_isEndState = true;
};
_stepState = StepState.STATE_STEP;
}
else
{
} else {
_isEndState = true;
}
break;
}
case StepState.STATE_STEP:
if (_isEndState)
{
if (_isEndState) {
return true;
}
break;

View file

@ -2,33 +2,36 @@ using Fie.Ponies;
using Fie.Ponies.Applejack;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskApplejackEnemyTracking : FieAITaskBase
{
public override bool Task(FieAITaskController manager)
{
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
namespace Fie.AI {
public class FieAITaskApplejackEnemyTracking : FieAITaskBase {
public override bool Task(FieAITaskController manager) {
if (manager.ownerCharacter.detector.lockonTargetObject == null) {
return true;
}
float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.centerTransform.position);
if (!(num > 2f))
{
if (!(num > 2f)) {
Vector3 position = manager.ownerCharacter.detector.lockonTargetObject.centerTransform.position;
float y = position.y;
Vector3 position2 = manager.ownerCharacter.transform.position;
if (y > position2.y + 5f && manager.ownerCharacter.abilitiesContainer.GetCooltime<FieStateMachineApplejackRope>() <= 0f)
{
if (y > position2.y + 5f && manager.ownerCharacter.abilitiesContainer.GetCooltime<FieStateMachineApplejackRope>() <= 0f) {
nextStateWeightList[typeof(FieStateMachineApplejackRope)] = 100;
return true;
}
return true;
}
Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.centerTransform.position - manager.ownerCharacter.transform.position;
vector.y = vector.z;
vector.z = 0f;
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesGallop>(vector.normalized, 1f, FieGameCharacter.StateMachineType.Base);
return false;
}
}

View file

@ -4,78 +4,63 @@ using Fie.Ponies;
using Fie.Ponies.Applejack;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskApplejackIdle : FieAITaskBase
{
namespace Fie.AI {
public class FieAITaskApplejackIdle : FieAITaskBase {
private FieGameCharacter injuryCharacter;
public override void Initialize(FieAITaskController manager)
{
if (Random.Range(0f, 100f) > 50f)
{
public override void Initialize(FieAITaskController manager) {
if (Random.Range(0f, 100f) > 50f) {
FieGameCharacter randomEnemyGameCharacter = manager.ownerCharacter.detector.getRandomEnemyGameCharacter();
if (randomEnemyGameCharacter != null)
{
if (randomEnemyGameCharacter != null) {
manager.ownerCharacter.detector.ChangeLockonTargetByInstanceID(randomEnemyGameCharacter.GetInstanceID());
}
}
injuryCharacter = FieManagerBehaviour<FieInGameCharacterStatusManager>.I.GetNearbyInjuryAllyCharacter(manager.ownerCharacter);
}
public override bool Task(FieAITaskController manager)
{
if (manager.ownerCharacter.groundState != 0)
{
public override bool Task(FieAITaskController manager) {
if (manager.ownerCharacter.groundState != 0) {
return false;
}
if (manager.ownerCharacter.damageSystem.isDead)
{
if (manager.ownerCharacter.friendshipStats.getCurrentFriendshipPoint() >= 3)
{
if (manager.ownerCharacter.damageSystem.isDead) {
if (manager.ownerCharacter.friendshipStats.getCurrentFriendshipPoint() >= 3) {
(manager.ownerCharacter as FiePonies).TryToRevive();
}
return true;
}
if (injuryCharacter != null && manager.ownerCharacter.friendshipStats.getCurrentFriendshipPoint() >= 2)
{
if (injuryCharacter != null && manager.ownerCharacter.friendshipStats.getCurrentFriendshipPoint() >= 2) {
nextStateWeightList[typeof(FieAITaskPoniesRescue)] = 100;
return true;
}
float num = Vector3.Distance(manager.ownerCharacter.transform.position, FieManagerBehaviour<FieUserManager>.I.gameOwnerCharacter.transform.position);
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
if (num > 2.5f)
{
if (manager.ownerCharacter.detector.lockonTargetObject == null) {
if (num > 2.5f) {
nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100;
return true;
}
return false;
}
float num2 = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.position);
if (num2 > 4.5f)
{
if (num2 > 4.5f) {
nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100;
return true;
}
if (num2 > 2.5f)
{
if (num2 > 2.5f) {
nextStateWeightList[typeof(FieAITaskApplejackEnemyTracking)] = 500;
if (manager.ownerCharacter.abilitiesContainer.GetCooltime<FieStateMachineApplejackRope>() <= 0f)
{
if (manager.ownerCharacter.abilitiesContainer.GetCooltime<FieStateMachineApplejackRope>() <= 0f) {
nextStateWeightList[typeof(FieAITaskApplejackRope)] = 500;
}
return true;
}
if (manager.ownerCharacter.abilitiesContainer.GetCooltime<FieStateMachineApplejackStomp>() <= 0f && manager.ownerCharacter.abilitiesContainer.GetCooltime<FieStateMachineApplejackYeehaw>() <= 0f)
{
if (manager.ownerCharacter.abilitiesContainer.GetCooltime<FieStateMachineApplejackStomp>() <= 0f && manager.ownerCharacter.abilitiesContainer.GetCooltime<FieStateMachineApplejackYeehaw>() <= 0f) {
nextStateWeightList[typeof(FieAITaskApplejackStomp)] = (int)Mathf.Max(1000f * manager.ownerCharacter.healthStats.nowHelthAndShieldRatePerMax, 100f);
nextStateWeightList[typeof(FieAITaskApplejackYeehaw)] = (int)Mathf.Max(2000f * (1f - manager.ownerCharacter.healthStats.nowHelthAndShieldRatePerMax), 500f);
return true;
}
nextStateWeightList[typeof(FieAITaskApplejackBackstep)] = 200;
if (manager.ownerCharacter.groundState == FieObjectGroundState.Grounding)
{
if (manager.ownerCharacter.groundState == FieObjectGroundState.Grounding) {
nextStateWeightList[typeof(FieAITaskApplejackJump)] = 200;
}
nextStateWeightList[typeof(FieAITaskApplejackMelee)] = 200;

View file

@ -1,14 +1,23 @@
using System;
using System.Collections.Generic;
namespace Fie.AI
{
public interface FieAITaskInterface
{
namespace Fie.AI {
/// <summary>
/// An AI task that a character can perform. Called to handle movement/targetting/etc.
/// </summary>
public interface FieAITaskInterface {
/// <summary>
/// Runs this task.
/// </summary>
/// <param name="manager">The manager responsible for calling this task</param>
/// <returns></returns>
bool TaskExec(FieAITaskController manager);
bool Task(FieAITaskController manager);
/// <summary>
/// Gets a relative importance mapping for this task given different targets and contexts.
/// </summary>
Dictionary<Type, int> GetWeight();
}
}

View file

@ -1,25 +1,25 @@
using Fie.Ponies;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskRainbowDashEnemyTracking : FieAITaskBase
{
public override bool Task(FieAITaskController manager)
{
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
namespace Fie.AI {
public class FieAITaskRainbowDashEnemyTracking : FieAITaskBase {
public override bool Task(FieAITaskController manager) {
if (manager.ownerCharacter.detector.lockonTargetObject == null) {
return true;
}
float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.centerTransform.position);
if (!(num > 2f))
{
if (num <= 2) {
return true;
}
Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.centerTransform.position - manager.ownerCharacter.transform.position;
vector.y = vector.z;
vector.z = 0f;
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesGallop>(vector.normalized, 1f, FieGameCharacter.StateMachineType.Base);
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesGallop>(vector.normalized, 1, FieGameCharacter.StateMachineType.Base);
return false;
}
}

View file

@ -1,20 +1,19 @@
using Fie.Ponies;
using UnityEngine;
namespace Fie.AI
{
public abstract class FieAITaskTwilightBase : FieAITaskBase
{
protected bool AdjustDirectionByBasicMovement(FieAITaskController manager)
{
if (manager.ownerCharacter.detector.lockonTargetObject.flipDirectionVector != manager.ownerCharacter.flipDirectionVector)
{
namespace Fie.AI {
public abstract class FieAITaskTwilightBase : FieAITaskBase {
protected bool AdjustDirectionByBasicMovement(FieAITaskController manager) {
if (manager.ownerCharacter.detector.lockonTargetObject.flipDirectionVector != manager.ownerCharacter.flipDirectionVector) {
return false;
}
Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.position - manager.ownerCharacter.transform.position;
vector.y = vector.z;
vector.z = 0f;
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesGallop>(vector.normalized, 1f, FieGameCharacter.StateMachineType.Base);
vector.z = 0;
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesGallop>(vector.normalized, 1, FieGameCharacter.StateMachineType.Base);
return true;
}
}

View file

@ -2,48 +2,39 @@ using Fie.Object;
using Fie.Ponies.Twilight;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskTwilightSummonArrow : FieAITaskTwilightBase
{
namespace Fie.AI {
/// <summary>
/// Summons a magic bold
/// </summary>
public class FieAITaskTwilightSummonArrow : FieAITaskTwilightBase {
private bool _isEnd;
public override void Initialize(FieAITaskController manager)
{
public override void Initialize(FieAITaskController manager) {
_isEnd = false;
manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent;
manager.ownerCharacter.damageSystem.damagedEvent += HealthSystem_damagedEvent;
}
public override void Terminate(FieAITaskController manager)
{
public override void Terminate(FieAITaskController manager) {
manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent;
manager.ownerCharacter.damageSystem.damagedEvent -= HealthSystem_damagedEvent;
}
private void HealthSystem_damagedEvent(FieGameCharacter attacker, FieDamage damage)
{
private void HealthSystem_damagedEvent(FieGameCharacter attacker, FieDamage damage) {
nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100;
_isEnd = true;
}
private void healthSystem_staggerEvent(FieDamage damageObject)
{
private void healthSystem_staggerEvent(FieDamage damageObject) {
nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100;
_isEnd = true;
}
public override bool Task(FieAITaskController manager)
{
if (_isEnd)
{
return true;
public override bool Task(FieAITaskController manager) {
if (!_isEnd && manager.ownerCharacter.detector.lockonTargetObject != null) {
manager.ownerCharacter.RequestToChangeState<FieStateMachineTwilightSummonArrow>(Vector3.zero, 0, FieGameCharacter.StateMachineType.Attack);
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
manager.ownerCharacter.RequestToChangeState<FieStateMachineTwilightSummonArrow>(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack);
return true;
}
}

View file

@ -2,20 +2,32 @@ using Fie.Manager;
using Fie.Scene;
using UnityEngine;
namespace Fie.Core
{
public class FieBootstrap : MonoBehaviour
{
private static bool _isBootedFromBootStrap;
namespace Fie.Core {
/// <summary>
/// Entry-point for Fie. Everything starts here.
/// </summary>
public class FieBootstrap : MonoBehaviour {
public static bool isBootedFromBootStrap { get; private set; };
public static bool isBootedFromBootStrap => _isBootedFromBootStrap;
private void Start()
{
/// <summary>
/// Starts the game. Loads the title screen.
/// </summary>
private void Start() {
FieManagerFactory.I.StartUp();
FieManagerBehaviour<FieSceneManager>.I.LoadScene(new FieSceneTitle(), allowSceneActivation: true, FieFaderManager.FadeType.OUT_TO_WHITE, FieFaderManager.FadeType.IN_FROM_WHITE, 1.5f);
_isBootedFromBootStrap = true;
FieManagerBehaviour<FieAudioManager>.I.ChangeMixerVolume(0f, 0.5f, FieAudioManager.FieAudioMixerType.BGM, FieAudioManager.FieAudioMixerType.Voice, FieAudioManager.FieAudioMixerType.SE);
FieManagerBehaviour<FieSceneManager>.I.LoadScene(new FieSceneTitle(), allowSceneActivation: true,
FieFaderManager.FadeType.OUT_TO_WHITE,
FieFaderManager.FadeType.IN_FROM_WHITE,
1.5f
);
isBootedFromBootStrap = true;
FieManagerBehaviour<FieAudioManager>.I.ChangeMixerVolume(0f, 0.5f,
FieAudioManager.FieAudioMixerType.BGM,
FieAudioManager.FieAudioMixerType.Voice,
FieAudioManager.FieAudioMixerType.SE
);
UnityEngine.Object.Destroy(base.gameObject);
}
}

View file

@ -5,10 +5,8 @@ using GameDataEditor;
using System.Collections.Generic;
using UnityEngine;
namespace Fie.DebugUtility
{
public class FieDebugGameSceneBoot : MonoBehaviour
{
namespace Fie.DebugUtility {
public class FieDebugGameSceneBoot : MonoBehaviour {
[Range(1f, 3f)]
[SerializeField]
private int playerNum = 1;
@ -25,12 +23,15 @@ namespace Fie.DebugUtility
[SerializeField]
private List<FieConstValues.FieSkill> _debugSkills = new List<FieConstValues.FieSkill>();
private void Awake()
{
if (!FieBootstrap.isBootedFromBootStrap && _debugCharacters.Count == _debugCharactersIntelligenceTypes.Count && _debugCharactersIntelligenceTypes.Count == _debugCharactersNames.Count && _debugCharacters.Count == _debugCharactersNames.Count)
{
private void Awake() {
if (!FieBootstrap.isBootedFromBootStrap
&& _debugCharacters.Count == _debugCharactersIntelligenceTypes.Count
&& _debugCharactersIntelligenceTypes.Count == _debugCharactersNames.Count
&& _debugCharacters.Count == _debugCharactersNames.Count) {
PhotonNetwork.offlineMode = true;
PhotonNetwork.InstantiateInRoomOnly = false;
FieManagerFactory.I.currentSceneType = FieSceneType.INGAME;
FieManagerBehaviour<FieSceneManager>.I.StartUp();
FieManagerBehaviour<FieSaveManager>.I.StartUp();
@ -38,29 +39,25 @@ namespace Fie.DebugUtility
FieManagerBehaviour<FieEnvironmentManager>.I.StartUp();
FieManagerBehaviour<FieUserManager>.I.nowPlayerNum = playerNum;
FieManagerBehaviour<FieUserManager>.I.StartUp();
List<GDESkillTreeData> list = FieMasterData<GDESkillTreeData>.FindMasterDataList(delegate(GDESkillTreeData data)
{
if (_debugSkills.Contains((FieConstValues.FieSkill)data.ID))
{
return true;
}
return false;
List<GDESkillTreeData> list = FieMasterData<GDESkillTreeData>.FindMasterDataList(delegate (GDESkillTreeData data) {
return _debugSkills.Contains((FieConstValues.FieSkill)data.ID);
});
for (int i = 0; i < playerNum; i++)
{
for (int i = 0; i < playerNum; i++) {
_debugCharacters[i].intelligenceType = _debugCharactersIntelligenceTypes[i];
if (list != null && list.Count > 0)
{
if (list != null && list.Count > 0) {
FieSaveManager.debugSkills = list;
}
FieManagerBehaviour<FieUserManager>.I.SetUserName(i, _debugCharactersNames[i]);
FieManagerBehaviour<FieUserManager>.I.SetUserCharacterPrefab(i, _debugCharacters[i]);
}
}
}
private void Start()
{
private void Start() {
FieManagerBehaviour<FieInGameStateManager>.I.StartUp();
}
}

View file

@ -1,11 +1,8 @@
using Fie.Object;
namespace Fie.Enemies
{
public class FieEnemiesAnimationContainer : FieAnimationContainerBase
{
public FieEnemiesAnimationContainer()
{
namespace Fie.Enemies {
public class FieEnemiesAnimationContainer : FieAnimationContainerBase {
public FieEnemiesAnimationContainer() {
addAnimationData(0, new FieSkeletonAnimationObject(0, "idle"));
}
}

View file

@ -1,17 +1,13 @@
using Fie.Object;
namespace Fie.Enemies
{
public class FieEnemiesHoovesRacesAnimationContainer : FieEnemiesAnimationContainer
{
public enum HoovesRacesAnimTrack
{
namespace Fie.Enemies {
public class FieEnemiesHoovesRacesAnimationContainer : FieEnemiesAnimationContainer {
public enum HoovesRacesAnimTrack {
HORN = 2,
MAX_HOOVES_RACES_TRACK
}
public enum HoovesRacesAnimList
{
public enum HoovesRacesAnimList {
WALK = 1,
GALLOP,
STAGGER,
@ -22,8 +18,7 @@ namespace Fie.Enemies
MAX_HOOVES_RACES_ANIMATION
}
public FieEnemiesHoovesRacesAnimationContainer()
{
public FieEnemiesHoovesRacesAnimationContainer() {
addAnimationData(1, new FieSkeletonAnimationObject(0, "walk"));
addAnimationData(2, new FieSkeletonAnimationObject(0, "gallop"));
addAnimationData(3, new FieSkeletonAnimationObject(0, "stagger"));

View file

@ -5,6 +5,9 @@ using UnityEngine.UI;
namespace Fie.Fader
{
/// <summary>
/// Fader used to white out the screen whilst the game is loading.
/// </summary>
public class FieFader : MonoBehaviour
{
[SerializeField]
@ -13,52 +16,61 @@ namespace Fie.Fader
[SerializeField]
private Image faderPlaneObject;
/// <summary>
/// The loading icon that appears in the lower right corner.
/// </summary>
[SerializeField]
private SkeletonGraphic _loadingIcon;
private Tweener<TweenTypesInOutSine> faderTweener = new Tweener<TweenTypesInOutSine>();
/// <summary>
/// True if the loading screen is currently visible.
/// </summary>
private bool isDrawFader;
public void Initialize()
{
public void Initialize() {
faderCameraRootObject.transform.gameObject.SetActive(value: false);
}
public void HideFader()
{
public void HideFader() {
isDrawFader = false;
faderCameraRootObject.transform.gameObject.SetActive(value: false);
}
public void InitFader(Vector4 startColor, Vector4 endColor, float time)
{
/// <summary>
/// Creates this view, sets it to visible, and starts showing the loading screen.
/// </summary>
public void InitFader(Vector4 startColor, Vector4 endColor, float time) {
isDrawFader = true;
faderTweener.InitTweener(time, startColor, endColor);
faderCameraRootObject.transform.gameObject.SetActive(value: true);
}
public bool IsEndUpdateFader()
{
/// <summary>
/// Checks if the loading screen is still fading in/our and returns false otherwise.
/// </summary>
public bool IsEndUpdateFader() {
return faderTweener == null || faderTweener.IsEnd();
}
private void Update()
{
if (isDrawFader)
{
/// <summary>
/// Draws the loading screen. Currently just a plain white background.
/// </summary>
private void Update() {
if (isDrawFader) {
Color color = faderTweener.UpdateParameterVec4(Time.deltaTime);
faderPlaneObject.color = color;
_loadingIcon.color = new Color(1f, 1f, 1f, color.a);
}
}
public void ShowLoadScreen()
{
public void ShowLoadScreen() {
// TODO: Implement this
}
public void HideLoadScreen()
{
public void HideLoadScreen() {
// TODO: Implement this
}
}
}

View file

@ -2,41 +2,53 @@ using Fie.Utility;
using System.Collections.Generic;
using UnityEngine;
namespace Fie.Footstep
{
public class FieFootstepMaterial : MonoBehaviour
{
namespace Fie.Footstep {
/// <summary>
/// Plays the footstep animations created as players or enemies move around.
/// </summary>
public class FieFootstepMaterial : MonoBehaviour {
[SerializeField]
private float _audioVolume = 0.5f;
[SerializeField]
private List<AudioClip> _audioClips = new List<AudioClip>();
/// <summary>
/// The particle material to spawn under an entity's hooves as they walk.
/// </summary>
[SerializeField]
private Material _footStepParticleMaterial;
/// <summary>
/// A lotto of audio clips to play. Provides a random one when queried.
/// </summary>
private Lottery<AudioClip> _lottery = new Lottery<AudioClip>();
/// <summary>
/// The pool of sounds that can be played by this material.
/// </summary>
public List<AudioClip> audioClips => _audioClips;
private void Awake()
{
foreach (AudioClip audioClip in _audioClips)
{
_lottery.AddItem(audioClip);
private void Awake() {
foreach (AudioClip audioClip in _audioClips) {
_lottery.AddItem(audioClip); // add each audio clip to the lottery
}
}
public void playFootstepAudio(FieFootstepPlayer player)
{
if (!(player == null) && _lottery.IsExecutable())
{
/// <summary>
/// Attempts to play an audio clip for the given footstep player.
/// Accepts nulls.
/// </summary>
public void playFootstepAudio(FieFootstepPlayer player) {
if (!(player == null) && _lottery.IsExecutable()) {
AudioClip audioClip = _lottery.Lot();
if (!(audioClip == null))
{
if (!(audioClip == null)) {
player.SetMaterial(_footStepParticleMaterial);
player.audioSource.pitch = player.pitchOffset;
player.audioSource.PlayOneShot(audioClip, _audioVolume);
player.EmitFootstepParticle(audioClip.length);
}
}

View file

@ -2,10 +2,11 @@ using ParticlePlayground;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Fie.Footstep
{
public class FieFootstepPlayer : MonoBehaviour
{
namespace Fie.Footstep {
/// <summary>
/// An audio player for playing audio clips under a player.
/// </summary>
public class FieFootstepPlayer : MonoBehaviour {
[SerializeField]
private AudioSource _audioSource;
@ -21,35 +22,31 @@ namespace Fie.Footstep
public float pitchOffset => _pitchOffset;
public void EmitFootstepParticle(float duration)
{
public void EmitFootstepParticle(float duration) {
_particleDuration = duration;
}
public void SetMaterial(Material material)
{
public void SetMaterial(Material material) {
_particle.particleSystemRenderer.material = material;
}
private void Update()
{
bool flag = _particleDuration > 0f;
private void Update() {
bool flag = _particleDuration > 0;
_particle.emit = flag;
if (flag)
{
if (flag) {
_particleDuration -= Time.deltaTime;
}
}
private void Awake()
{
private void Awake() {
SceneManager.sceneLoaded += SceneManager_sceneLoaded;
}
private void SceneManager_sceneLoaded(UnityEngine.SceneManagement.Scene arg0, LoadSceneMode arg1)
{
if ((bool)_particle)
{
/// <summary>
/// Called when the scene is loaded.
/// </summary>
private void SceneManager_sceneLoaded(UnityEngine.SceneManagement.Scene scene, LoadSceneMode mode) {
if ((bool)_particle) {
_particle.Start();
}
}

View file

@ -1,40 +1,44 @@
using System.Collections.Generic;
namespace Fie.Object
{
public abstract class FieAnimationContainerBase
{
public enum BaseAnimTrack
{
namespace Fie.Object {
public abstract class FieAnimationContainerBase {
public enum BaseAnimTrack {
MOTION,
EMOTION,
MAX_BASE_TRACK
}
public enum BaseAnimList
{
public enum BaseAnimList {
IDLE,
MAX_BASE_ANIMATION
}
private Dictionary<int, FieSkeletonAnimationObject> animationList = new Dictionary<int, FieSkeletonAnimationObject>();
public Dictionary<int, FieSkeletonAnimationObject> getAnimationList()
{
/// <summary>
/// Gets the list of all animations registered to this container.
/// </summary>
public Dictionary<int, FieSkeletonAnimationObject> getAnimationList() {
return animationList;
}
public FieSkeletonAnimationObject getAnimation(int animationId)
{
if (animationList.ContainsKey(animationId))
{
/// <summary>
/// Gets the skeleton animation for the provided animation id.
/// Returns null of one such animation exists (????)
/// </summary>
public FieSkeletonAnimationObject getAnimation(int animationId) {
// TODO: Shouldn't this be inverted?
if (animationList.ContainsKey(animationId)) {
return null;
}
return animationList[animationId];
}
public void addAnimationData(int animationID, FieSkeletonAnimationObject animationObject)
{
/// <summary>
/// Registers animation details for the given id to this container.
/// </summary>
public void addAnimationData(int animationID, FieSkeletonAnimationObject animationObject) {
animationList.Add(animationID, animationObject);
}
}

View file

@ -1,15 +1,12 @@
using UnityEngine;
namespace Fie.Object
{
public class FieInputControllerBase : MonoBehaviour
{
namespace Fie.Object {
public class FieInputControllerBase : MonoBehaviour {
public FieGameCharacter _ownerCharacter;
public FieGameCharacter ownerCharacter => _ownerCharacter;
public void SetOwner(FieGameCharacter character)
{
public void SetOwner(FieGameCharacter character) {
_ownerCharacter = character;
}
}

View file

@ -1,11 +1,8 @@
using UnityEngine;
namespace Fie.Utility
{
public class Wiggler
{
public enum WiggleTemplate
{
namespace Fie.Utility {
public class Wiggler {
public enum WiggleTemplate {
WIGGLE_TYPE_MINIMUM,
WIGGLE_TYPE_SMALL,
WIGGLE_TYPE_MIDDLE,
@ -38,8 +35,7 @@ namespace Fie.Utility
public bool isEnd => nowWiggleCount >= totalWiggleCount;
public Wiggler(Vector3 normal, float initTotalTime, int initWiggleCount, Vector3 initWiggleScale)
{
public Wiggler(Vector3 normal, float initTotalTime, int initWiggleCount, Vector3 initWiggleScale) {
totalTime = Mathf.Max(initTotalTime, 0f);
totalWiggleCount = Mathf.Max(initWiggleCount, 1);
wiggleScale = initWiggleScale;
@ -47,13 +43,11 @@ namespace Fie.Utility
InitializeGeneralParams();
}
public Wiggler(Vector3 normal, WiggleTemplate template)
{
public Wiggler(Vector3 normal, WiggleTemplate template) {
float num = 0f;
int num2 = 1;
Vector3 zero = Vector3.zero;
switch (template)
{
switch (template) {
default:
num = 0.15f;
num2 = 4;
@ -82,16 +76,13 @@ namespace Fie.Utility
InitializeGeneralParams();
}
public Vector3 UpdateWiggler(float updateTime)
{
if (nowTime >= totalTime)
{
public Vector3 UpdateWiggler(float updateTime) {
if (nowTime >= totalTime) {
return Vector3.zero;
}
Vector3 result = (!(wiggleSegmentTime > 0f)) ? Vector3.zero : Vector3.Lerp(nowWigglePoint, nextWigglePoint, Mathf.Min(nowTime / wiggleSegmentTime, 1f));
nowTime += updateTime;
if (nowTime > wiggleSegmentTime && nowWiggleCount < totalWiggleCount)
{
if (nowTime > wiggleSegmentTime && nowWiggleCount < totalWiggleCount) {
nowWiggleCount++;
SetNextWigglePoint(nowWiggleCount);
nowTime = 0f;
@ -99,23 +90,27 @@ namespace Fie.Utility
return result;
}
private void InitializeGeneralParams()
{
private void InitializeGeneralParams() {
nowTime = 0f;
wiggleSegmentTime = totalTime / (float)totalWiggleCount;
nowWiggleCount = 0;
SetNextWigglePoint(nowWiggleCount);
}
private void SetNextWigglePoint(int count)
{
private void SetNextWigglePoint(int count) {
nowWigglePoint = new Vector3(nextWigglePoint.x, nextWigglePoint.y);
float num = ((float)totalWiggleCount - (float)count) / (float)totalWiggleCount;
float angle = nowAngle + Random.Range(120f, 240f);
Quaternion rotation = Quaternion.AngleAxis(angle, wiggleNormal);
Vector3 vector = rotation * Vector3.up;
vector.Normalize();
nextWigglePoint = new Vector3(wiggleScale.x * (vector.x * num), wiggleScale.y * (vector.y * num));
nextWigglePoint = new Vector3(wiggleScale.x * vector.x * num, wiggleScale.y * vector.y * num);
nowAngle = angle;
}
}

View file

@ -1,16 +1,14 @@
using UnityEngine;
public class TwilightMagicSphere : MonoBehaviour
{
public class TwilightMagicSphere : MonoBehaviour {
private float angle;
private void Start()
{
private void Start() {
}
private void Update()
{
private void Update() {
angle += 60f * Time.deltaTime;
base.transform.rotation = Quaternion.AngleAxis(angle, Vector3.up);
transform.rotation = Quaternion.AngleAxis(angle, Vector3.up);
}
}

View file

@ -1,17 +1,14 @@
using UnityEngine;
public class TwilightMagicSphereNormal : MonoBehaviour
{
public class TwilightMagicSphereNormal : MonoBehaviour {
private float angle;
private void Start()
{
private void Start() {
}
private void Update()
{
angle += 0.9f * Time.deltaTime;
angle = Mathf.Repeat(angle, 1f);
base.gameObject.GetComponent<Renderer>().material.SetTextureOffset("_BumpMap", new Vector2(0f - angle, 1f));
private void Update() {
angle = Mathf.Repeat(angle + 0.9f * Time.deltaTime, 1f);
gameObject.GetComponent<Renderer>().material.SetTextureOffset("_BumpMap", new Vector2(0 - angle, 1));
}
}

View file

@ -2,8 +2,7 @@ using Fie.Enemies;
using System;
[Serializable]
public class ValueList
{
public class ValueList {
public FieObjectEnemies _enemy;
public int _spawnableCapForEasy;