mirror of
https://github.com/FriendshipIsEpic/FiE-Game.git
synced 2024-11-21 21:37:59 +01:00
Format code
This commit is contained in:
parent
84efb53960
commit
894aa095cc
24 changed files with 696 additions and 701 deletions
|
@ -1,14 +1,28 @@
|
|||
public enum CloudRegionCode
|
||||
{
|
||||
eu = 0,
|
||||
us = 1,
|
||||
asia = 2,
|
||||
jp = 3,
|
||||
au = 5,
|
||||
usw = 6,
|
||||
sa = 7,
|
||||
cae = 8,
|
||||
kr = 9,
|
||||
@in = 10,
|
||||
none = 4
|
||||
|
||||
/// <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
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
using Fie.Object;
|
||||
|
||||
namespace Fie.AI
|
||||
{
|
||||
public class FieAIControllerBase : FieInputControllerBase
|
||||
{
|
||||
}
|
||||
namespace Fie.AI {
|
||||
public class FieAIControllerBase : FieInputControllerBase {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 Dictionary<int, IEnumerator> _hateCorutine = new Dictionary<int, IEnumerator>();
|
||||
private float MAXIMUM_STACKED_HATE = 6;
|
||||
|
||||
private Dictionary<int, float> _hateList = new Dictionary<int, float>();
|
||||
private Dictionary<int, IEnumerator> _hateCorutine = new Dictionary<int, IEnumerator>();
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_ownerCharacter.damageSystem.damagedEvent += delegate(FieGameCharacter attacker, FieDamage damage)
|
||||
{
|
||||
if (!(attacker == null) && damage != null && PhotonNetwork.isMasterClient)
|
||||
{
|
||||
AddHate(attacker, damage.hate);
|
||||
}
|
||||
};
|
||||
}
|
||||
private Dictionary<int, float> _hateList = new Dictionary<int, float>();
|
||||
|
||||
private void AddHate(FieGameCharacter attaker, float hate)
|
||||
{
|
||||
if (!(attaker == null))
|
||||
{
|
||||
int instanceID = attaker.GetInstanceID();
|
||||
if (_hateCorutine.ContainsKey(instanceID))
|
||||
{
|
||||
StopCoroutine(_hateCorutine[instanceID]);
|
||||
}
|
||||
if (!_hateList.ContainsKey(instanceID))
|
||||
{
|
||||
_hateList[instanceID] = hate;
|
||||
}
|
||||
else
|
||||
{
|
||||
_hateList[instanceID] = Mathf.Min(_hateList[instanceID] + hate, MAXIMUM_STACKED_HATE);
|
||||
}
|
||||
_hateCorutine[instanceID] = CalculateHateCoroutine(instanceID);
|
||||
StartCoroutine(_hateCorutine[instanceID]);
|
||||
}
|
||||
}
|
||||
private void Start() {
|
||||
_ownerCharacter.damageSystem.damagedEvent += delegate (FieGameCharacter attacker, FieDamage damage) {
|
||||
if (attacker != null && damage != null && PhotonNetwork.isMasterClient) {
|
||||
AddHate(attacker, damage.hate);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
updateLockonTargetByHate();
|
||||
}
|
||||
private void AddHate(FieGameCharacter attaker, float hate) {
|
||||
if (!(attaker == null)) {
|
||||
int instanceID = attaker.GetInstanceID();
|
||||
|
||||
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)
|
||||
{
|
||||
instanceId = hate.Key;
|
||||
flag = true;
|
||||
}
|
||||
num = Mathf.Max(num, hate.Value);
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
_ownerCharacter.detector.ChangeLockonTargetByInstanceID(instanceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_hateCorutine.ContainsKey(instanceID)) {
|
||||
StopCoroutine(_hateCorutine[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*/;
|
||||
}
|
||||
_hateList.Remove(attackerInstanceId);
|
||||
}
|
||||
if (_hateCorutine.ContainsKey(attackerInstanceId))
|
||||
{
|
||||
_hateCorutine.Remove(attackerInstanceId);
|
||||
}
|
||||
yield return (object)null;
|
||||
/*Error: Unable to find new state assignment for yield return*/;
|
||||
}
|
||||
}
|
||||
if (!_hateList.ContainsKey(instanceID)) {
|
||||
_hateList[instanceID] = hate;
|
||||
} else {
|
||||
_hateList[instanceID] = Mathf.Min(_hateList[instanceID] + hate, MAXIMUM_STACKED_HATE);
|
||||
}
|
||||
|
||||
_hateCorutine[instanceID] = CalculateHateCoroutine(instanceID);
|
||||
|
||||
StartCoroutine(_hateCorutine[instanceID]);
|
||||
}
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
updateLockonTargetByHate();
|
||||
}
|
||||
|
||||
private void updateLockonTargetByHate() {
|
||||
if (_hateList.Count > 0) {
|
||||
bool flag = false;
|
||||
int instanceId = 0;
|
||||
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) {
|
||||
_ownerCharacter.detector.ChangeLockonTargetByInstanceID(instanceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)) {
|
||||
_hateCorutine.Remove(attackerInstanceId);
|
||||
}
|
||||
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,63 +2,60 @@ using Fie.Object;
|
|||
using Fie.Ponies.Applejack;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Fie.AI
|
||||
{
|
||||
public class FieAITaskApplejackBackstep : FieAITaskBase
|
||||
{
|
||||
private enum StepState
|
||||
{
|
||||
STATE_PREPARE,
|
||||
STATE_STEP
|
||||
}
|
||||
namespace Fie.AI {
|
||||
public class FieAITaskApplejackBackstep : FieAITaskBase {
|
||||
private enum StepState {
|
||||
STATE_PREPARE,
|
||||
STATE_STEP
|
||||
}
|
||||
|
||||
private const float ATTACK_DISTANCE = 15f;
|
||||
private const float ATTACK_DISTANCE = 15f;
|
||||
|
||||
private bool _isEndState;
|
||||
private bool _isEndState;
|
||||
|
||||
private StepState _stepState;
|
||||
private StepState _stepState;
|
||||
|
||||
public override void Initialize(FieAITaskController manager)
|
||||
{
|
||||
_isEndState = false;
|
||||
_stepState = StepState.STATE_PREPARE;
|
||||
}
|
||||
public override void Initialize(FieAITaskController manager) {
|
||||
_isEndState = false;
|
||||
_stepState = StepState.STATE_PREPARE;
|
||||
}
|
||||
|
||||
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));
|
||||
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
|
||||
{
|
||||
_isEndState = true;
|
||||
};
|
||||
_stepState = StepState.STATE_STEP;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isEndState = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case StepState.STATE_STEP:
|
||||
if (_isEndState)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
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)
|
||||
);
|
||||
|
||||
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 {
|
||||
_isEndState = true;
|
||||
};
|
||||
_stepState = StepState.STATE_STEP;
|
||||
} else {
|
||||
_isEndState = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case StepState.STATE_STEP:
|
||||
if (_isEndState) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,34 +2,37 @@ 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)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.centerTransform.position);
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
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)) {
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,82 +4,67 @@ using Fie.Ponies;
|
|||
using Fie.Ponies.Applejack;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Fie.AI
|
||||
{
|
||||
public class FieAITaskApplejackIdle : FieAITaskBase
|
||||
{
|
||||
private FieGameCharacter injuryCharacter;
|
||||
namespace Fie.AI {
|
||||
public class FieAITaskApplejackIdle : FieAITaskBase {
|
||||
private FieGameCharacter injuryCharacter;
|
||||
|
||||
public override void Initialize(FieAITaskController manager)
|
||||
{
|
||||
if (Random.Range(0f, 100f) > 50f)
|
||||
{
|
||||
FieGameCharacter randomEnemyGameCharacter = manager.ownerCharacter.detector.getRandomEnemyGameCharacter();
|
||||
if (randomEnemyGameCharacter != null)
|
||||
{
|
||||
manager.ownerCharacter.detector.ChangeLockonTargetByInstanceID(randomEnemyGameCharacter.GetInstanceID());
|
||||
}
|
||||
}
|
||||
injuryCharacter = FieManagerBehaviour<FieInGameCharacterStatusManager>.I.GetNearbyInjuryAllyCharacter(manager.ownerCharacter);
|
||||
}
|
||||
public override void Initialize(FieAITaskController manager) {
|
||||
if (Random.Range(0f, 100f) > 50f) {
|
||||
FieGameCharacter randomEnemyGameCharacter = manager.ownerCharacter.detector.getRandomEnemyGameCharacter();
|
||||
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)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100;
|
||||
return true;
|
||||
}
|
||||
if (num2 > 2.5f)
|
||||
{
|
||||
nextStateWeightList[typeof(FieAITaskApplejackEnemyTracking)] = 500;
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
nextStateWeightList[typeof(FieAITaskApplejackJump)] = 200;
|
||||
}
|
||||
nextStateWeightList[typeof(FieAITaskApplejackMelee)] = 200;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public override bool Task(FieAITaskController manager) {
|
||||
if (manager.ownerCharacter.groundState != 0) {
|
||||
return false;
|
||||
}
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100;
|
||||
return true;
|
||||
}
|
||||
if (num2 > 2.5f) {
|
||||
nextStateWeightList[typeof(FieAITaskApplejackEnemyTracking)] = 500;
|
||||
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) {
|
||||
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) {
|
||||
nextStateWeightList[typeof(FieAITaskApplejackJump)] = 200;
|
||||
}
|
||||
nextStateWeightList[typeof(FieAITaskApplejackMelee)] = 200;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Fie.AI
|
||||
{
|
||||
public interface FieAITaskInterface
|
||||
{
|
||||
bool TaskExec(FieAITaskController manager);
|
||||
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);
|
||||
bool Task(FieAITaskController manager);
|
||||
|
||||
Dictionary<Type, int> GetWeight();
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets a relative importance mapping for this task given different targets and contexts.
|
||||
/// </summary>
|
||||
Dictionary<Type, int> GetWeight();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
using Fie.Ponies;
|
||||
using UnityEngine;
|
||||
|
||||
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))
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
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 <= 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, 1, FieGameCharacter.StateMachineType.Base);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
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)
|
||||
{
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
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 = 0;
|
||||
|
||||
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesGallop>(vector.normalized, 1, FieGameCharacter.StateMachineType.Base);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,49 +2,40 @@ using Fie.Object;
|
|||
using Fie.Ponies.Twilight;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Fie.AI
|
||||
{
|
||||
public class FieAITaskTwilightSummonArrow : FieAITaskTwilightBase
|
||||
{
|
||||
private bool _isEnd;
|
||||
namespace Fie.AI {
|
||||
/// <summary>
|
||||
/// Summons a magic bold
|
||||
/// </summary>
|
||||
public class FieAITaskTwilightSummonArrow : FieAITaskTwilightBase {
|
||||
private bool _isEnd;
|
||||
|
||||
public override void Initialize(FieAITaskController manager)
|
||||
{
|
||||
_isEnd = false;
|
||||
manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent;
|
||||
manager.ownerCharacter.damageSystem.damagedEvent += HealthSystem_damagedEvent;
|
||||
}
|
||||
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)
|
||||
{
|
||||
manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent;
|
||||
manager.ownerCharacter.damageSystem.damagedEvent -= HealthSystem_damagedEvent;
|
||||
}
|
||||
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)
|
||||
{
|
||||
nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100;
|
||||
_isEnd = true;
|
||||
}
|
||||
private void HealthSystem_damagedEvent(FieGameCharacter attacker, FieDamage damage) {
|
||||
nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100;
|
||||
_isEnd = true;
|
||||
}
|
||||
|
||||
private void healthSystem_staggerEvent(FieDamage damageObject)
|
||||
{
|
||||
nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100;
|
||||
_isEnd = true;
|
||||
}
|
||||
private void healthSystem_staggerEvent(FieDamage damageObject) {
|
||||
nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100;
|
||||
_isEnd = true;
|
||||
}
|
||||
|
||||
public override bool Task(FieAITaskController manager)
|
||||
{
|
||||
if (_isEnd)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (manager.ownerCharacter.detector.lockonTargetObject == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
manager.ownerCharacter.RequestToChangeState<FieStateMachineTwilightSummonArrow>(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack);
|
||||
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);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,63 +5,60 @@ using GameDataEditor;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Fie.DebugUtility
|
||||
{
|
||||
public class FieDebugGameSceneBoot : MonoBehaviour
|
||||
{
|
||||
[Range(1f, 3f)]
|
||||
[SerializeField]
|
||||
private int playerNum = 1;
|
||||
namespace Fie.DebugUtility {
|
||||
public class FieDebugGameSceneBoot : MonoBehaviour {
|
||||
[Range(1f, 3f)]
|
||||
[SerializeField]
|
||||
private int playerNum = 1;
|
||||
|
||||
[SerializeField]
|
||||
private List<FieGameCharacter> _debugCharacters = new List<FieGameCharacter>();
|
||||
[SerializeField]
|
||||
private List<FieGameCharacter> _debugCharacters = new List<FieGameCharacter>();
|
||||
|
||||
[SerializeField]
|
||||
private List<FieGameCharacter.IntelligenceType> _debugCharactersIntelligenceTypes = new List<FieGameCharacter.IntelligenceType>();
|
||||
[SerializeField]
|
||||
private List<FieGameCharacter.IntelligenceType> _debugCharactersIntelligenceTypes = new List<FieGameCharacter.IntelligenceType>();
|
||||
|
||||
[SerializeField]
|
||||
private List<string> _debugCharactersNames = new List<string>();
|
||||
[SerializeField]
|
||||
private List<string> _debugCharactersNames = new List<string>();
|
||||
|
||||
[SerializeField]
|
||||
private List<FieConstValues.FieSkill> _debugSkills = new List<FieConstValues.FieSkill>();
|
||||
[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)
|
||||
{
|
||||
PhotonNetwork.offlineMode = true;
|
||||
PhotonNetwork.InstantiateInRoomOnly = false;
|
||||
FieManagerFactory.I.currentSceneType = FieSceneType.INGAME;
|
||||
FieManagerBehaviour<FieSceneManager>.I.StartUp();
|
||||
FieManagerBehaviour<FieSaveManager>.I.StartUp();
|
||||
FieManagerBehaviour<FieFaderManager>.I.StartUp();
|
||||
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;
|
||||
});
|
||||
for (int i = 0; i < playerNum; i++)
|
||||
{
|
||||
_debugCharacters[i].intelligenceType = _debugCharactersIntelligenceTypes[i];
|
||||
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 Awake() {
|
||||
if (!FieBootstrap.isBootedFromBootStrap
|
||||
&& _debugCharacters.Count == _debugCharactersIntelligenceTypes.Count
|
||||
&& _debugCharactersIntelligenceTypes.Count == _debugCharactersNames.Count
|
||||
&& _debugCharacters.Count == _debugCharactersNames.Count) {
|
||||
|
||||
private void Start()
|
||||
{
|
||||
FieManagerBehaviour<FieInGameStateManager>.I.StartUp();
|
||||
}
|
||||
}
|
||||
PhotonNetwork.offlineMode = true;
|
||||
PhotonNetwork.InstantiateInRoomOnly = false;
|
||||
|
||||
FieManagerFactory.I.currentSceneType = FieSceneType.INGAME;
|
||||
FieManagerBehaviour<FieSceneManager>.I.StartUp();
|
||||
FieManagerBehaviour<FieSaveManager>.I.StartUp();
|
||||
FieManagerBehaviour<FieFaderManager>.I.StartUp();
|
||||
FieManagerBehaviour<FieEnvironmentManager>.I.StartUp();
|
||||
FieManagerBehaviour<FieUserManager>.I.nowPlayerNum = playerNum;
|
||||
FieManagerBehaviour<FieUserManager>.I.StartUp();
|
||||
|
||||
List<GDESkillTreeData> list = FieMasterData<GDESkillTreeData>.FindMasterDataList(delegate (GDESkillTreeData data) {
|
||||
return _debugSkills.Contains((FieConstValues.FieSkill)data.ID);
|
||||
});
|
||||
|
||||
for (int i = 0; i < playerNum; i++) {
|
||||
_debugCharacters[i].intelligenceType = _debugCharactersIntelligenceTypes[i];
|
||||
|
||||
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() {
|
||||
FieManagerBehaviour<FieInGameStateManager>.I.StartUp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
using Fie.Object;
|
||||
|
||||
namespace Fie.Enemies
|
||||
{
|
||||
public class FieEnemiesAnimationContainer : FieAnimationContainerBase
|
||||
{
|
||||
public FieEnemiesAnimationContainer()
|
||||
{
|
||||
addAnimationData(0, new FieSkeletonAnimationObject(0, "idle"));
|
||||
}
|
||||
}
|
||||
namespace Fie.Enemies {
|
||||
public class FieEnemiesAnimationContainer : FieAnimationContainerBase {
|
||||
public FieEnemiesAnimationContainer() {
|
||||
addAnimationData(0, new FieSkeletonAnimationObject(0, "idle"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +1,31 @@
|
|||
using Fie.Object;
|
||||
|
||||
namespace Fie.Enemies
|
||||
{
|
||||
public class FieEnemiesHoovesRacesAnimationContainer : FieEnemiesAnimationContainer
|
||||
{
|
||||
public enum HoovesRacesAnimTrack
|
||||
{
|
||||
HORN = 2,
|
||||
MAX_HOOVES_RACES_TRACK
|
||||
}
|
||||
namespace Fie.Enemies {
|
||||
public class FieEnemiesHoovesRacesAnimationContainer : FieEnemiesAnimationContainer {
|
||||
public enum HoovesRacesAnimTrack {
|
||||
HORN = 2,
|
||||
MAX_HOOVES_RACES_TRACK
|
||||
}
|
||||
|
||||
public enum HoovesRacesAnimList
|
||||
{
|
||||
WALK = 1,
|
||||
GALLOP,
|
||||
STAGGER,
|
||||
STAGGER_AIR,
|
||||
STAGGER_FALL,
|
||||
STAGGER_FALL_RECOVER,
|
||||
DEAD,
|
||||
MAX_HOOVES_RACES_ANIMATION
|
||||
}
|
||||
public enum HoovesRacesAnimList {
|
||||
WALK = 1,
|
||||
GALLOP,
|
||||
STAGGER,
|
||||
STAGGER_AIR,
|
||||
STAGGER_FALL,
|
||||
STAGGER_FALL_RECOVER,
|
||||
DEAD,
|
||||
MAX_HOOVES_RACES_ANIMATION
|
||||
}
|
||||
|
||||
public FieEnemiesHoovesRacesAnimationContainer()
|
||||
{
|
||||
addAnimationData(1, new FieSkeletonAnimationObject(0, "walk"));
|
||||
addAnimationData(2, new FieSkeletonAnimationObject(0, "gallop"));
|
||||
addAnimationData(3, new FieSkeletonAnimationObject(0, "stagger"));
|
||||
addAnimationData(4, new FieSkeletonAnimationObject(0, "stagger_air"));
|
||||
addAnimationData(5, new FieSkeletonAnimationObject(0, "stagger_fall"));
|
||||
addAnimationData(6, new FieSkeletonAnimationObject(0, "stagger_fall_recover"));
|
||||
addAnimationData(7, new FieSkeletonAnimationObject(0, "dead"));
|
||||
}
|
||||
}
|
||||
public FieEnemiesHoovesRacesAnimationContainer() {
|
||||
addAnimationData(1, new FieSkeletonAnimationObject(0, "walk"));
|
||||
addAnimationData(2, new FieSkeletonAnimationObject(0, "gallop"));
|
||||
addAnimationData(3, new FieSkeletonAnimationObject(0, "stagger"));
|
||||
addAnimationData(4, new FieSkeletonAnimationObject(0, "stagger_air"));
|
||||
addAnimationData(5, new FieSkeletonAnimationObject(0, "stagger_fall"));
|
||||
addAnimationData(6, new FieSkeletonAnimationObject(0, "stagger_fall_recover"));
|
||||
addAnimationData(7, new FieSkeletonAnimationObject(0, "dead"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,41 +1,45 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Fie.Object
|
||||
{
|
||||
public abstract class FieAnimationContainerBase
|
||||
{
|
||||
public enum BaseAnimTrack
|
||||
{
|
||||
MOTION,
|
||||
EMOTION,
|
||||
MAX_BASE_TRACK
|
||||
}
|
||||
namespace Fie.Object {
|
||||
|
||||
public enum BaseAnimList
|
||||
{
|
||||
IDLE,
|
||||
MAX_BASE_ANIMATION
|
||||
}
|
||||
public abstract class FieAnimationContainerBase {
|
||||
public enum BaseAnimTrack {
|
||||
MOTION,
|
||||
EMOTION,
|
||||
MAX_BASE_TRACK
|
||||
}
|
||||
|
||||
private Dictionary<int, FieSkeletonAnimationObject> animationList = new Dictionary<int, FieSkeletonAnimationObject>();
|
||||
public enum BaseAnimList {
|
||||
IDLE,
|
||||
MAX_BASE_ANIMATION
|
||||
}
|
||||
|
||||
public Dictionary<int, FieSkeletonAnimationObject> getAnimationList()
|
||||
{
|
||||
return animationList;
|
||||
}
|
||||
private Dictionary<int, FieSkeletonAnimationObject> animationList = new Dictionary<int, FieSkeletonAnimationObject>();
|
||||
|
||||
public FieSkeletonAnimationObject getAnimation(int animationId)
|
||||
{
|
||||
if (animationList.ContainsKey(animationId))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return animationList[animationId];
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the list of all animations registered to this container.
|
||||
/// </summary>
|
||||
public Dictionary<int, FieSkeletonAnimationObject> getAnimationList() {
|
||||
return animationList;
|
||||
}
|
||||
|
||||
public void addAnimationData(int animationID, FieSkeletonAnimationObject animationObject)
|
||||
{
|
||||
animationList.Add(animationID, animationObject);
|
||||
}
|
||||
}
|
||||
/// <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];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers animation details for the given id to this container.
|
||||
/// </summary>
|
||||
public void addAnimationData(int animationID, FieSkeletonAnimationObject animationObject) {
|
||||
animationList.Add(animationID, animationObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace Fie.Object
|
||||
{
|
||||
public class FieInputControllerBase : MonoBehaviour
|
||||
{
|
||||
public FieGameCharacter _ownerCharacter;
|
||||
namespace Fie.Object {
|
||||
public class FieInputControllerBase : MonoBehaviour {
|
||||
public FieGameCharacter _ownerCharacter;
|
||||
|
||||
public FieGameCharacter ownerCharacter => _ownerCharacter;
|
||||
public FieGameCharacter ownerCharacter => _ownerCharacter;
|
||||
|
||||
public void SetOwner(FieGameCharacter character)
|
||||
{
|
||||
_ownerCharacter = character;
|
||||
}
|
||||
}
|
||||
public void SetOwner(FieGameCharacter character) {
|
||||
_ownerCharacter = character;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,122 +1,117 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace Fie.Utility
|
||||
{
|
||||
public class Wiggler
|
||||
{
|
||||
public enum WiggleTemplate
|
||||
{
|
||||
WIGGLE_TYPE_MINIMUM,
|
||||
WIGGLE_TYPE_SMALL,
|
||||
WIGGLE_TYPE_MIDDLE,
|
||||
WIGGLE_TYPE_BIG
|
||||
}
|
||||
namespace Fie.Utility {
|
||||
public class Wiggler {
|
||||
public enum WiggleTemplate {
|
||||
WIGGLE_TYPE_MINIMUM,
|
||||
WIGGLE_TYPE_SMALL,
|
||||
WIGGLE_TYPE_MIDDLE,
|
||||
WIGGLE_TYPE_BIG
|
||||
}
|
||||
|
||||
private const float MIN_RANDOM_SHAKE_ANGLE_RANGE = 120f;
|
||||
private const float MIN_RANDOM_SHAKE_ANGLE_RANGE = 120f;
|
||||
|
||||
private const float MAX_RANDOM_SHAKE_ANGLE_RANGE = 240f;
|
||||
private const float MAX_RANDOM_SHAKE_ANGLE_RANGE = 240f;
|
||||
|
||||
private float nowAngle;
|
||||
private float nowAngle;
|
||||
|
||||
private float nowTime;
|
||||
private float nowTime;
|
||||
|
||||
private float totalTime;
|
||||
private float totalTime;
|
||||
|
||||
private float wiggleSegmentTime;
|
||||
private float wiggleSegmentTime;
|
||||
|
||||
private int totalWiggleCount = 1;
|
||||
private int totalWiggleCount = 1;
|
||||
|
||||
private int nowWiggleCount;
|
||||
private int nowWiggleCount;
|
||||
|
||||
private Vector3 wiggleScale = Vector3.zero;
|
||||
private Vector3 wiggleScale = Vector3.zero;
|
||||
|
||||
private Vector3 wiggleNormal = Vector3.zero;
|
||||
private Vector3 wiggleNormal = Vector3.zero;
|
||||
|
||||
private Vector3 nowWigglePoint = Vector3.zero;
|
||||
private Vector3 nowWigglePoint = Vector3.zero;
|
||||
|
||||
private Vector3 nextWigglePoint = Vector3.zero;
|
||||
private Vector3 nextWigglePoint = Vector3.zero;
|
||||
|
||||
public bool isEnd => nowWiggleCount >= totalWiggleCount;
|
||||
public bool isEnd => nowWiggleCount >= totalWiggleCount;
|
||||
|
||||
public Wiggler(Vector3 normal, float initTotalTime, int initWiggleCount, Vector3 initWiggleScale)
|
||||
{
|
||||
totalTime = Mathf.Max(initTotalTime, 0f);
|
||||
totalWiggleCount = Mathf.Max(initWiggleCount, 1);
|
||||
wiggleScale = initWiggleScale;
|
||||
wiggleNormal = normal.normalized;
|
||||
InitializeGeneralParams();
|
||||
}
|
||||
public Wiggler(Vector3 normal, float initTotalTime, int initWiggleCount, Vector3 initWiggleScale) {
|
||||
totalTime = Mathf.Max(initTotalTime, 0f);
|
||||
totalWiggleCount = Mathf.Max(initWiggleCount, 1);
|
||||
wiggleScale = initWiggleScale;
|
||||
wiggleNormal = normal.normalized;
|
||||
InitializeGeneralParams();
|
||||
}
|
||||
|
||||
public Wiggler(Vector3 normal, WiggleTemplate template)
|
||||
{
|
||||
float num = 0f;
|
||||
int num2 = 1;
|
||||
Vector3 zero = Vector3.zero;
|
||||
switch (template)
|
||||
{
|
||||
default:
|
||||
num = 0.15f;
|
||||
num2 = 4;
|
||||
zero = new Vector3(0.015f, 0.015f);
|
||||
break;
|
||||
case WiggleTemplate.WIGGLE_TYPE_SMALL:
|
||||
num = 0.2f;
|
||||
num2 = 5;
|
||||
zero = new Vector3(0.03f, 0.03f);
|
||||
break;
|
||||
case WiggleTemplate.WIGGLE_TYPE_MIDDLE:
|
||||
num = 0.3f;
|
||||
num2 = 7;
|
||||
zero = new Vector3(0.1f, 0.1f);
|
||||
break;
|
||||
case WiggleTemplate.WIGGLE_TYPE_BIG:
|
||||
num = 0.5f;
|
||||
num2 = 10;
|
||||
zero = new Vector3(0.1f, 0.1f);
|
||||
break;
|
||||
}
|
||||
totalTime = Mathf.Max(num, 0f);
|
||||
totalWiggleCount = Mathf.Max(num2, 1);
|
||||
wiggleScale = zero;
|
||||
wiggleNormal = normal.normalized;
|
||||
InitializeGeneralParams();
|
||||
}
|
||||
public Wiggler(Vector3 normal, WiggleTemplate template) {
|
||||
float num = 0f;
|
||||
int num2 = 1;
|
||||
Vector3 zero = Vector3.zero;
|
||||
switch (template) {
|
||||
default:
|
||||
num = 0.15f;
|
||||
num2 = 4;
|
||||
zero = new Vector3(0.015f, 0.015f);
|
||||
break;
|
||||
case WiggleTemplate.WIGGLE_TYPE_SMALL:
|
||||
num = 0.2f;
|
||||
num2 = 5;
|
||||
zero = new Vector3(0.03f, 0.03f);
|
||||
break;
|
||||
case WiggleTemplate.WIGGLE_TYPE_MIDDLE:
|
||||
num = 0.3f;
|
||||
num2 = 7;
|
||||
zero = new Vector3(0.1f, 0.1f);
|
||||
break;
|
||||
case WiggleTemplate.WIGGLE_TYPE_BIG:
|
||||
num = 0.5f;
|
||||
num2 = 10;
|
||||
zero = new Vector3(0.1f, 0.1f);
|
||||
break;
|
||||
}
|
||||
totalTime = Mathf.Max(num, 0f);
|
||||
totalWiggleCount = Mathf.Max(num2, 1);
|
||||
wiggleScale = zero;
|
||||
wiggleNormal = normal.normalized;
|
||||
InitializeGeneralParams();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
nowWiggleCount++;
|
||||
SetNextWigglePoint(nowWiggleCount);
|
||||
nowTime = 0f;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
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) {
|
||||
nowWiggleCount++;
|
||||
SetNextWigglePoint(nowWiggleCount);
|
||||
nowTime = 0f;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void InitializeGeneralParams()
|
||||
{
|
||||
nowTime = 0f;
|
||||
wiggleSegmentTime = totalTime / (float)totalWiggleCount;
|
||||
nowWiggleCount = 0;
|
||||
SetNextWigglePoint(nowWiggleCount);
|
||||
}
|
||||
private void InitializeGeneralParams() {
|
||||
nowTime = 0f;
|
||||
wiggleSegmentTime = totalTime / (float)totalWiggleCount;
|
||||
nowWiggleCount = 0;
|
||||
SetNextWigglePoint(nowWiggleCount);
|
||||
}
|
||||
|
||||
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));
|
||||
nowAngle = angle;
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
nowAngle = angle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,24 +20,24 @@ internal class NetworkingPeer : LoadBalancingPeer, IPhotonPeerListener
|
|||
public const string NameServerHttp = "http://ns.exitgamescloud.com:80/photon/n";
|
||||
|
||||
private static readonly Dictionary<ConnectionProtocol, int> ProtocolToNameServerPort = new Dictionary<ConnectionProtocol, int>
|
||||
{
|
||||
{
|
||||
ConnectionProtocol.Udp,
|
||||
5058
|
||||
},
|
||||
{
|
||||
ConnectionProtocol.Tcp,
|
||||
4533
|
||||
},
|
||||
{
|
||||
ConnectionProtocol.WebSocket,
|
||||
9093
|
||||
},
|
||||
{
|
||||
ConnectionProtocol.WebSocketSecure,
|
||||
19093
|
||||
}
|
||||
};
|
||||
{
|
||||
{
|
||||
ConnectionProtocol.Udp,
|
||||
5058
|
||||
},
|
||||
{
|
||||
ConnectionProtocol.Tcp,
|
||||
4533
|
||||
},
|
||||
{
|
||||
ConnectionProtocol.WebSocket,
|
||||
9093
|
||||
},
|
||||
{
|
||||
ConnectionProtocol.WebSocketSecure,
|
||||
19093
|
||||
}
|
||||
};
|
||||
|
||||
public bool IsInitialConnect;
|
||||
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class TwilightMagicSphere : MonoBehaviour
|
||||
{
|
||||
private float angle;
|
||||
public class TwilightMagicSphere : MonoBehaviour {
|
||||
private float angle;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
}
|
||||
private void Start() {
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
angle += 60f * Time.deltaTime;
|
||||
base.transform.rotation = Quaternion.AngleAxis(angle, Vector3.up);
|
||||
}
|
||||
private void Update() {
|
||||
angle += 60f * Time.deltaTime;
|
||||
|
||||
transform.rotation = Quaternion.AngleAxis(angle, Vector3.up);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class TwilightMagicSphereNormal : MonoBehaviour
|
||||
{
|
||||
private float angle;
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,19 +2,18 @@ using Fie.Enemies;
|
|||
using System;
|
||||
|
||||
[Serializable]
|
||||
public class ValueList
|
||||
{
|
||||
public FieObjectEnemies _enemy;
|
||||
public class ValueList {
|
||||
public FieObjectEnemies _enemy;
|
||||
|
||||
public int _spawnableCapForEasy;
|
||||
public int _spawnableCapForEasy;
|
||||
|
||||
public int _spawnableCapForNormal;
|
||||
public int _spawnableCapForNormal;
|
||||
|
||||
public int _spawnableCapForHard;
|
||||
public int _spawnableCapForHard;
|
||||
|
||||
public int _spawnableCapForVeryHard;
|
||||
public int _spawnableCapForVeryHard;
|
||||
|
||||
public int _spawnableCapForNightmare;
|
||||
public int _spawnableCapForNightmare;
|
||||
|
||||
public int _spawnableCapForChaos;
|
||||
public int _spawnableCapForChaos;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue