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>
eu = 0, /// Country region codes for the remote cloud server
us = 1, /// </summary>
asia = 2, public enum CloudRegionCode {
jp = 3, // Europe
au = 5, eu = 0,
usw = 6, // United States
sa = 7, us = 1,
cae = 8, // Asia
kr = 9, asia = 2,
@in = 10, // Japone
none = 4 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; using Fie.Object;
namespace Fie.AI namespace Fie.AI {
{ public class FieAIControllerBase : FieInputControllerBase {
public class FieAIControllerBase : FieInputControllerBase }
{
}
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -1,14 +1,23 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Fie.AI namespace Fie.AI {
{ /// <summary>
public interface FieAITaskInterface /// An AI task that a character can perform. Called to handle movement/targetting/etc.
{ /// </summary>
bool TaskExec(FieAITaskController manager); 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();
}
} }

View file

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

View file

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

View file

@ -2,49 +2,40 @@ using Fie.Object;
using Fie.Ponies.Twilight; using Fie.Ponies.Twilight;
using UnityEngine; using UnityEngine;
namespace Fie.AI namespace Fie.AI {
{ /// <summary>
public class FieAITaskTwilightSummonArrow : FieAITaskTwilightBase /// Summons a magic bold
{ /// </summary>
private bool _isEnd; public class FieAITaskTwilightSummonArrow : FieAITaskTwilightBase {
private bool _isEnd;
public override void Initialize(FieAITaskController manager) public override void Initialize(FieAITaskController manager) {
{ _isEnd = false;
_isEnd = false; manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent;
manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent; manager.ownerCharacter.damageSystem.damagedEvent += HealthSystem_damagedEvent;
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.staggerEvent -= healthSystem_staggerEvent; manager.ownerCharacter.damageSystem.damagedEvent -= HealthSystem_damagedEvent;
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;
nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100; _isEnd = true;
_isEnd = true; }
}
private void healthSystem_staggerEvent(FieDamage damageObject) private void healthSystem_staggerEvent(FieDamage damageObject) {
{ nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100;
nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100; _isEnd = true;
_isEnd = true; }
}
public override bool Task(FieAITaskController manager) public override bool Task(FieAITaskController manager) {
{ if (!_isEnd && manager.ownerCharacter.detector.lockonTargetObject != null) {
if (_isEnd) manager.ownerCharacter.RequestToChangeState<FieStateMachineTwilightSummonArrow>(Vector3.zero, 0, FieGameCharacter.StateMachineType.Attack);
{ }
return true;
} return true;
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 Fie.Scene;
using UnityEngine; using UnityEngine;
namespace Fie.Core namespace Fie.Core {
{ /// <summary>
public class FieBootstrap : MonoBehaviour /// Entry-point for Fie. Everything starts here.
{ /// </summary>
private static bool _isBootedFromBootStrap; public class FieBootstrap : MonoBehaviour {
public static bool isBootedFromBootStrap { get; private set; };
public static bool isBootedFromBootStrap => _isBootedFromBootStrap; /// <summary>
/// Starts the game. Loads the title screen.
private void Start() /// </summary>
{ private void Start() {
FieManagerFactory.I.StartUp(); FieManagerFactory.I.StartUp();
FieManagerBehaviour<FieSceneManager>.I.LoadScene(new FieSceneTitle(), allowSceneActivation: true, FieFaderManager.FadeType.OUT_TO_WHITE, FieFaderManager.FadeType.IN_FROM_WHITE, 1.5f); FieManagerBehaviour<FieSceneManager>.I.LoadScene(new FieSceneTitle(), allowSceneActivation: true,
_isBootedFromBootStrap = true; FieFaderManager.FadeType.OUT_TO_WHITE,
FieManagerBehaviour<FieAudioManager>.I.ChangeMixerVolume(0f, 0.5f, FieAudioManager.FieAudioMixerType.BGM, FieAudioManager.FieAudioMixerType.Voice, FieAudioManager.FieAudioMixerType.SE); 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); UnityEngine.Object.Destroy(base.gameObject);
} }
} }

View file

@ -5,63 +5,60 @@ using GameDataEditor;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace Fie.DebugUtility namespace Fie.DebugUtility {
{ public class FieDebugGameSceneBoot : MonoBehaviour {
public class FieDebugGameSceneBoot : MonoBehaviour [Range(1f, 3f)]
{ [SerializeField]
[Range(1f, 3f)] private int playerNum = 1;
[SerializeField]
private int playerNum = 1;
[SerializeField] [SerializeField]
private List<FieGameCharacter> _debugCharacters = new List<FieGameCharacter>(); private List<FieGameCharacter> _debugCharacters = new List<FieGameCharacter>();
[SerializeField] [SerializeField]
private List<FieGameCharacter.IntelligenceType> _debugCharactersIntelligenceTypes = new List<FieGameCharacter.IntelligenceType>(); private List<FieGameCharacter.IntelligenceType> _debugCharactersIntelligenceTypes = new List<FieGameCharacter.IntelligenceType>();
[SerializeField] [SerializeField]
private List<string> _debugCharactersNames = new List<string>(); private List<string> _debugCharactersNames = new List<string>();
[SerializeField] [SerializeField]
private List<FieConstValues.FieSkill> _debugSkills = new List<FieConstValues.FieSkill>(); private List<FieConstValues.FieSkill> _debugSkills = new List<FieConstValues.FieSkill>();
private void Awake() private void Awake() {
{ if (!FieBootstrap.isBootedFromBootStrap
if (!FieBootstrap.isBootedFromBootStrap && _debugCharacters.Count == _debugCharactersIntelligenceTypes.Count && _debugCharactersIntelligenceTypes.Count == _debugCharactersNames.Count && _debugCharacters.Count == _debugCharactersNames.Count) && _debugCharacters.Count == _debugCharactersIntelligenceTypes.Count
{ && _debugCharactersIntelligenceTypes.Count == _debugCharactersNames.Count
PhotonNetwork.offlineMode = true; && _debugCharacters.Count == _debugCharactersNames.Count) {
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 Start() PhotonNetwork.offlineMode = true;
{ PhotonNetwork.InstantiateInRoomOnly = false;
FieManagerBehaviour<FieInGameStateManager>.I.StartUp();
} 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();
}
}
} }

View file

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

View file

@ -1,36 +1,31 @@
using Fie.Object; using Fie.Object;
namespace Fie.Enemies namespace Fie.Enemies {
{ public class FieEnemiesHoovesRacesAnimationContainer : FieEnemiesAnimationContainer {
public class FieEnemiesHoovesRacesAnimationContainer : FieEnemiesAnimationContainer public enum HoovesRacesAnimTrack {
{ HORN = 2,
public enum HoovesRacesAnimTrack MAX_HOOVES_RACES_TRACK
{ }
HORN = 2,
MAX_HOOVES_RACES_TRACK
}
public enum HoovesRacesAnimList public enum HoovesRacesAnimList {
{ WALK = 1,
WALK = 1, GALLOP,
GALLOP, STAGGER,
STAGGER, STAGGER_AIR,
STAGGER_AIR, STAGGER_FALL,
STAGGER_FALL, STAGGER_FALL_RECOVER,
STAGGER_FALL_RECOVER, DEAD,
DEAD, MAX_HOOVES_RACES_ANIMATION
MAX_HOOVES_RACES_ANIMATION }
}
public FieEnemiesHoovesRacesAnimationContainer() public FieEnemiesHoovesRacesAnimationContainer() {
{ addAnimationData(1, new FieSkeletonAnimationObject(0, "walk"));
addAnimationData(1, new FieSkeletonAnimationObject(0, "walk")); addAnimationData(2, new FieSkeletonAnimationObject(0, "gallop"));
addAnimationData(2, new FieSkeletonAnimationObject(0, "gallop")); addAnimationData(3, new FieSkeletonAnimationObject(0, "stagger"));
addAnimationData(3, new FieSkeletonAnimationObject(0, "stagger")); addAnimationData(4, new FieSkeletonAnimationObject(0, "stagger_air"));
addAnimationData(4, new FieSkeletonAnimationObject(0, "stagger_air")); addAnimationData(5, new FieSkeletonAnimationObject(0, "stagger_fall"));
addAnimationData(5, new FieSkeletonAnimationObject(0, "stagger_fall")); addAnimationData(6, new FieSkeletonAnimationObject(0, "stagger_fall_recover"));
addAnimationData(6, new FieSkeletonAnimationObject(0, "stagger_fall_recover")); addAnimationData(7, new FieSkeletonAnimationObject(0, "dead"));
addAnimationData(7, new FieSkeletonAnimationObject(0, "dead")); }
} }
}
} }

View file

@ -5,6 +5,9 @@ using UnityEngine.UI;
namespace Fie.Fader namespace Fie.Fader
{ {
/// <summary>
/// Fader used to white out the screen whilst the game is loading.
/// </summary>
public class FieFader : MonoBehaviour public class FieFader : MonoBehaviour
{ {
[SerializeField] [SerializeField]
@ -13,52 +16,61 @@ namespace Fie.Fader
[SerializeField] [SerializeField]
private Image faderPlaneObject; private Image faderPlaneObject;
/// <summary>
/// The loading icon that appears in the lower right corner.
/// </summary>
[SerializeField] [SerializeField]
private SkeletonGraphic _loadingIcon; private SkeletonGraphic _loadingIcon;
private Tweener<TweenTypesInOutSine> faderTweener = new Tweener<TweenTypesInOutSine>(); private Tweener<TweenTypesInOutSine> faderTweener = new Tweener<TweenTypesInOutSine>();
/// <summary>
/// True if the loading screen is currently visible.
/// </summary>
private bool isDrawFader; private bool isDrawFader;
public void Initialize() public void Initialize() {
{
faderCameraRootObject.transform.gameObject.SetActive(value: false); faderCameraRootObject.transform.gameObject.SetActive(value: false);
} }
public void HideFader() public void HideFader() {
{
isDrawFader = false; isDrawFader = false;
faderCameraRootObject.transform.gameObject.SetActive(value: 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; isDrawFader = true;
faderTweener.InitTweener(time, startColor, endColor); faderTweener.InitTweener(time, startColor, endColor);
faderCameraRootObject.transform.gameObject.SetActive(value: true); 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(); return faderTweener == null || faderTweener.IsEnd();
} }
private void Update() /// <summary>
{ /// Draws the loading screen. Currently just a plain white background.
if (isDrawFader) /// </summary>
{ private void Update() {
if (isDrawFader) {
Color color = faderTweener.UpdateParameterVec4(Time.deltaTime); Color color = faderTweener.UpdateParameterVec4(Time.deltaTime);
faderPlaneObject.color = color; faderPlaneObject.color = color;
_loadingIcon.color = new Color(1f, 1f, 1f, color.a); _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 System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace Fie.Footstep namespace Fie.Footstep {
{ /// <summary>
public class FieFootstepMaterial : MonoBehaviour /// Plays the footstep animations created as players or enemies move around.
{ /// </summary>
public class FieFootstepMaterial : MonoBehaviour {
[SerializeField] [SerializeField]
private float _audioVolume = 0.5f; private float _audioVolume = 0.5f;
[SerializeField] [SerializeField]
private List<AudioClip> _audioClips = new List<AudioClip>(); private List<AudioClip> _audioClips = new List<AudioClip>();
/// <summary>
/// The particle material to spawn under an entity's hooves as they walk.
/// </summary>
[SerializeField] [SerializeField]
private Material _footStepParticleMaterial; 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>(); 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; public List<AudioClip> audioClips => _audioClips;
private void Awake() private void Awake() {
{ foreach (AudioClip audioClip in _audioClips) {
foreach (AudioClip audioClip in _audioClips) _lottery.AddItem(audioClip); // add each audio clip to the lottery
{
_lottery.AddItem(audioClip);
} }
} }
public void playFootstepAudio(FieFootstepPlayer player) /// <summary>
{ /// Attempts to play an audio clip for the given footstep player.
if (!(player == null) && _lottery.IsExecutable()) /// Accepts nulls.
{ /// </summary>
public void playFootstepAudio(FieFootstepPlayer player) {
if (!(player == null) && _lottery.IsExecutable()) {
AudioClip audioClip = _lottery.Lot(); AudioClip audioClip = _lottery.Lot();
if (!(audioClip == null))
{ if (!(audioClip == null)) {
player.SetMaterial(_footStepParticleMaterial); player.SetMaterial(_footStepParticleMaterial);
player.audioSource.pitch = player.pitchOffset; player.audioSource.pitch = player.pitchOffset;
player.audioSource.PlayOneShot(audioClip, _audioVolume); player.audioSource.PlayOneShot(audioClip, _audioVolume);
player.EmitFootstepParticle(audioClip.length); player.EmitFootstepParticle(audioClip.length);
} }
} }

View file

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

View file

@ -1,41 +1,45 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace Fie.Object namespace Fie.Object {
{
public abstract class FieAnimationContainerBase
{
public enum BaseAnimTrack
{
MOTION,
EMOTION,
MAX_BASE_TRACK
}
public enum BaseAnimList public abstract class FieAnimationContainerBase {
{ public enum BaseAnimTrack {
IDLE, MOTION,
MAX_BASE_ANIMATION 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() private Dictionary<int, FieSkeletonAnimationObject> animationList = new Dictionary<int, FieSkeletonAnimationObject>();
{
return animationList;
}
public FieSkeletonAnimationObject getAnimation(int animationId) /// <summary>
{ /// Gets the list of all animations registered to this container.
if (animationList.ContainsKey(animationId)) /// </summary>
{ public Dictionary<int, FieSkeletonAnimationObject> getAnimationList() {
return null; return animationList;
} }
return animationList[animationId];
}
public void addAnimationData(int animationID, FieSkeletonAnimationObject animationObject) /// <summary>
{ /// Gets the skeleton animation for the provided animation id.
animationList.Add(animationID, animationObject); /// 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);
}
}
} }

View file

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

View file

@ -1,122 +1,117 @@
using UnityEngine; using UnityEngine;
namespace Fie.Utility namespace Fie.Utility {
{ public class Wiggler {
public class Wiggler public enum WiggleTemplate {
{ WIGGLE_TYPE_MINIMUM,
public enum WiggleTemplate WIGGLE_TYPE_SMALL,
{ WIGGLE_TYPE_MIDDLE,
WIGGLE_TYPE_MINIMUM, WIGGLE_TYPE_BIG
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) public Wiggler(Vector3 normal, float initTotalTime, int initWiggleCount, Vector3 initWiggleScale) {
{ totalTime = Mathf.Max(initTotalTime, 0f);
totalTime = Mathf.Max(initTotalTime, 0f); totalWiggleCount = Mathf.Max(initWiggleCount, 1);
totalWiggleCount = Mathf.Max(initWiggleCount, 1); wiggleScale = initWiggleScale;
wiggleScale = initWiggleScale; wiggleNormal = normal.normalized;
wiggleNormal = normal.normalized; InitializeGeneralParams();
InitializeGeneralParams(); }
}
public Wiggler(Vector3 normal, WiggleTemplate template) public Wiggler(Vector3 normal, WiggleTemplate template) {
{ float num = 0f;
float num = 0f; int num2 = 1;
int num2 = 1; Vector3 zero = Vector3.zero;
Vector3 zero = Vector3.zero; switch (template) {
switch (template) default:
{ num = 0.15f;
default: num2 = 4;
num = 0.15f; zero = new Vector3(0.015f, 0.015f);
num2 = 4; break;
zero = new Vector3(0.015f, 0.015f); case WiggleTemplate.WIGGLE_TYPE_SMALL:
break; num = 0.2f;
case WiggleTemplate.WIGGLE_TYPE_SMALL: num2 = 5;
num = 0.2f; zero = new Vector3(0.03f, 0.03f);
num2 = 5; break;
zero = new Vector3(0.03f, 0.03f); case WiggleTemplate.WIGGLE_TYPE_MIDDLE:
break; num = 0.3f;
case WiggleTemplate.WIGGLE_TYPE_MIDDLE: num2 = 7;
num = 0.3f; zero = new Vector3(0.1f, 0.1f);
num2 = 7; break;
zero = new Vector3(0.1f, 0.1f); case WiggleTemplate.WIGGLE_TYPE_BIG:
break; num = 0.5f;
case WiggleTemplate.WIGGLE_TYPE_BIG: num2 = 10;
num = 0.5f; zero = new Vector3(0.1f, 0.1f);
num2 = 10; break;
zero = new Vector3(0.1f, 0.1f); }
break; totalTime = Mathf.Max(num, 0f);
} totalWiggleCount = Mathf.Max(num2, 1);
totalTime = Mathf.Max(num, 0f); wiggleScale = zero;
totalWiggleCount = Mathf.Max(num2, 1); wiggleNormal = normal.normalized;
wiggleScale = zero; InitializeGeneralParams();
wiggleNormal = normal.normalized; }
InitializeGeneralParams();
}
public Vector3 UpdateWiggler(float updateTime) public Vector3 UpdateWiggler(float updateTime) {
{ if (nowTime >= totalTime) {
if (nowTime >= totalTime) return Vector3.zero;
{ }
return Vector3.zero; Vector3 result = (!(wiggleSegmentTime > 0f)) ? Vector3.zero : Vector3.Lerp(nowWigglePoint, nextWigglePoint, Mathf.Min(nowTime / wiggleSegmentTime, 1f));
} nowTime += updateTime;
Vector3 result = (!(wiggleSegmentTime > 0f)) ? Vector3.zero : Vector3.Lerp(nowWigglePoint, nextWigglePoint, Mathf.Min(nowTime / wiggleSegmentTime, 1f)); if (nowTime > wiggleSegmentTime && nowWiggleCount < totalWiggleCount) {
nowTime += updateTime; nowWiggleCount++;
if (nowTime > wiggleSegmentTime && nowWiggleCount < totalWiggleCount) SetNextWigglePoint(nowWiggleCount);
{ nowTime = 0f;
nowWiggleCount++; }
SetNextWigglePoint(nowWiggleCount); return result;
nowTime = 0f; }
}
return result;
}
private void InitializeGeneralParams() private void InitializeGeneralParams() {
{ nowTime = 0f;
nowTime = 0f; wiggleSegmentTime = totalTime / (float)totalWiggleCount;
wiggleSegmentTime = totalTime / (float)totalWiggleCount; nowWiggleCount = 0;
nowWiggleCount = 0; SetNextWigglePoint(nowWiggleCount);
SetNextWigglePoint(nowWiggleCount); }
}
private void SetNextWigglePoint(int count) private void SetNextWigglePoint(int count) {
{ nowWigglePoint = new Vector3(nextWigglePoint.x, nextWigglePoint.y);
nowWigglePoint = new Vector3(nextWigglePoint.x, nextWigglePoint.y);
float num = ((float)totalWiggleCount - (float)count) / (float)totalWiggleCount; float num = ((float)totalWiggleCount - (float)count) / (float)totalWiggleCount;
float angle = nowAngle + Random.Range(120f, 240f); float angle = nowAngle + Random.Range(120f, 240f);
Quaternion rotation = Quaternion.AngleAxis(angle, wiggleNormal);
Vector3 vector = rotation * Vector3.up; Quaternion rotation = Quaternion.AngleAxis(angle, wiggleNormal);
vector.Normalize();
nextWigglePoint = new Vector3(wiggleScale.x * (vector.x * num), wiggleScale.y * (vector.y * num)); Vector3 vector = rotation * Vector3.up;
nowAngle = angle;
} vector.Normalize();
}
nextWigglePoint = new Vector3(wiggleScale.x * vector.x * num, wiggleScale.y * vector.y * num);
nowAngle = angle;
}
}
} }

View file

@ -20,24 +20,24 @@ internal class NetworkingPeer : LoadBalancingPeer, IPhotonPeerListener
public const string NameServerHttp = "http://ns.exitgamescloud.com:80/photon/n"; public const string NameServerHttp = "http://ns.exitgamescloud.com:80/photon/n";
private static readonly Dictionary<ConnectionProtocol, int> ProtocolToNameServerPort = new Dictionary<ConnectionProtocol, int> private static readonly Dictionary<ConnectionProtocol, int> ProtocolToNameServerPort = new Dictionary<ConnectionProtocol, int>
{ {
{ {
ConnectionProtocol.Udp, ConnectionProtocol.Udp,
5058 5058
}, },
{ {
ConnectionProtocol.Tcp, ConnectionProtocol.Tcp,
4533 4533
}, },
{ {
ConnectionProtocol.WebSocket, ConnectionProtocol.WebSocket,
9093 9093
}, },
{ {
ConnectionProtocol.WebSocketSecure, ConnectionProtocol.WebSocketSecure,
19093 19093
} }
}; };
public bool IsInitialConnect; public bool IsInitialConnect;

View file

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

View file

@ -2,19 +2,18 @@ using Fie.Enemies;
using System; using System;
[Serializable] [Serializable]
public class ValueList public class ValueList {
{ public FieObjectEnemies _enemy;
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;
} }