Decompiled source code

This commit is contained in:
Sollace 2018-11-20 21:10:49 +02:00
parent 21ae2ce4ac
commit be31d50780
624 changed files with 59453 additions and 0 deletions

14
src/CloudRegionCode.cs Normal file
View file

@ -0,0 +1,14 @@
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
}

16
src/CloudRegionFlag.cs Normal file
View file

@ -0,0 +1,16 @@
using System;
[Flags]
public enum CloudRegionFlag
{
eu = 0x1,
us = 0x2,
asia = 0x4,
jp = 0x8,
au = 0x10,
usw = 0x20,
sa = 0x40,
cae = 0x80,
kr = 0x100,
@in = 0x200
}

View file

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

View file

@ -0,0 +1,99 @@
using Fie.Object;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Fie.AI
{
public class FieAIHateController : FieAIControllerBase
{
private float MAXIMUM_STACKED_HATE = 6f;
private Dictionary<int, IEnumerator> _hateCorutine = new Dictionary<int, IEnumerator>();
private Dictionary<int, float> _hateList = new Dictionary<int, float>();
private void Start()
{
_ownerCharacter.damageSystem.damagedEvent += delegate(FieGameCharacter attacker, FieDamage damage)
{
if (!(attacker == null) && damage != null && PhotonNetwork.isMasterClient)
{
AddHate(attacker, damage.hate);
}
};
}
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 Update()
{
updateLockonTargetByHate();
}
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);
}
}
}
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*/;
}
}
}

View file

@ -0,0 +1,64 @@
using Fie.Object;
using Fie.Ponies.Applejack;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskApplejackBackstep : FieAITaskBase
{
private enum StepState
{
STATE_PREPARE,
STATE_STEP
}
private const float ATTACK_DISTANCE = 15f;
private bool _isEndState;
private StepState _stepState;
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;
}
}
}

View file

@ -0,0 +1,35 @@
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;
}
}
}

View file

@ -0,0 +1,85 @@
using Fie.Manager;
using Fie.Object;
using Fie.Ponies;
using Fie.Ponies.Applejack;
using UnityEngine;
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 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;
}
}
}

View file

@ -0,0 +1,65 @@
using Fie.Object;
using Fie.Ponies;
using Fie.Ponies.Applejack;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskApplejackJump : FieAITaskBase
{
public const float JUMPING_MAXIMUM_TIME = 3f;
public const float JUMPING_THRESHOLD_TIME = 0.3f;
private float _lifeCount;
private float _jumpCount;
private bool _isJump;
public override void Initialize(FieAITaskController manager)
{
_lifeCount = 0f;
_jumpCount = 0f;
_isJump = false;
}
public override bool Task(FieAITaskController manager)
{
_lifeCount += Time.deltaTime;
if (_lifeCount >= 3f)
{
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
if (_isJump)
{
if (manager.ownerCharacter.abilitiesContainer.GetCooltime<FieStateMachineApplejackStomp>() <= 0f && manager.ownerCharacter.abilitiesContainer.GetCooltime<FieStateMachineApplejackRope>() <= 0f)
{
nextStateWeightList[typeof(FieAITaskApplejackRope)] = 100;
nextStateWeightList[typeof(FieAITaskApplejackStomp)] = 100;
}
else
{
nextStateWeightList[typeof(FieAITaskApplejackMelee)] = 100;
}
return true;
}
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesJump>(Vector3.up, 1f, FieGameCharacter.StateMachineType.Base);
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine is FieStateMachineApplejackFlying))
{
return true;
}
_jumpCount += Time.deltaTime;
if (_jumpCount > 0.3f)
{
_isJump = true;
}
return false;
}
}
}

View file

@ -0,0 +1,63 @@
using Fie.Object;
using Fie.Ponies;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskApplejackMelee : FieAITaskBase
{
public const float MELEE_TIME_MAX = 3f;
public const float MELEE_TIME_MIN = 1.5f;
private bool _isEnd;
private float _lifeCount;
private float _meleeCount;
public override void Initialize(FieAITaskController manager)
{
_isEnd = false;
_lifeCount = 0f;
_meleeCount = Random.Range(1.5f, 3f);
manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent;
}
public override void Terminate(FieAITaskController manager)
{
manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent;
}
private void healthSystem_staggerEvent(FieDamage damageObject)
{
nextStateWeightList[typeof(FieAITaskApplejackBackstep)] = 100;
_isEnd = true;
}
public override bool Task(FieAITaskController manager)
{
if (_isEnd)
{
return true;
}
_lifeCount += Time.deltaTime;
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.position);
if (num > 45f)
{
nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100;
return true;
}
if (_lifeCount >= _meleeCount)
{
return true;
}
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesBaseAttack>(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack);
return false;
}
}
}

View file

@ -0,0 +1,60 @@
using Fie.Object;
using Fie.Ponies;
using Fie.Ponies.Applejack;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskApplejackRope : FieAITaskBase
{
private bool _isAssigned;
private bool _isEnd;
public override void Initialize(FieAITaskController manager)
{
_isAssigned = false;
_isEnd = false;
manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent;
}
public override void Terminate(FieAITaskController manager)
{
manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent;
}
private void healthSystem_staggerEvent(FieDamage damageObject)
{
nextStateWeightList[typeof(FieAITaskApplejackBackstep)] = 100;
_isEnd = true;
}
public override bool Task(FieAITaskController manager)
{
if (_isEnd)
{
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
if (!_isAssigned)
{
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesAbilitySlot1>(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack);
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine is FieStateMachineApplejackRopeAction) && !(currentStateMachine is FieStateMachineApplejackRopeActionAir))
{
return true;
}
currentStateMachine.stateChangeEvent += delegate
{
nextStateWeightList[typeof(FieAITaskApplejackMelee)] = 100;
_isEnd = true;
};
_isAssigned = true;
}
return false;
}
}
}

View file

@ -0,0 +1,60 @@
using Fie.Object;
using Fie.Ponies;
using Fie.Ponies.Applejack;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskApplejackStomp : FieAITaskBase
{
private bool _isAssigned;
private bool _isEnd;
public override void Initialize(FieAITaskController manager)
{
_isAssigned = false;
_isEnd = false;
manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent;
}
public override void Terminate(FieAITaskController manager)
{
manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent;
}
private void healthSystem_staggerEvent(FieDamage damageObject)
{
nextStateWeightList[typeof(FieAITaskApplejackBackstep)] = 100;
_isEnd = true;
}
public override bool Task(FieAITaskController manager)
{
if (_isEnd)
{
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
if (!_isAssigned)
{
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesAbilitySlot3>(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack);
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine is FieStateMachineApplejackStompAction))
{
return true;
}
currentStateMachine.stateChangeEvent += delegate
{
nextStateWeightList[typeof(FieAITaskApplejackBackstep)] = 100;
_isEnd = true;
};
_isAssigned = true;
}
return false;
}
}
}

View file

@ -0,0 +1,58 @@
using Fie.Object;
using Fie.Ponies;
using Fie.Ponies.Applejack;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskApplejackYeehaw : FieAITaskBase
{
private bool _isAssigned;
private bool _isEnd;
public override void Initialize(FieAITaskController manager)
{
_isAssigned = false;
_isEnd = false;
manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent;
}
public override void Terminate(FieAITaskController manager)
{
manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent;
}
private void healthSystem_staggerEvent(FieDamage damageObject)
{
nextStateWeightList[typeof(FieAITaskApplejackBackstep)] = 100;
_isEnd = true;
}
public override bool Task(FieAITaskController manager)
{
if (_isEnd)
{
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
if (!_isAssigned)
{
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesAbilitySlot2>(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack);
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (currentStateMachine is FieStateMachineApplejackYeehawAction)
{
currentStateMachine.stateChangeEvent += delegate
{
_isEnd = true;
};
_isAssigned = true;
}
}
return false;
}
}
}

View file

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Fie.AI
{
public abstract class FieAITaskBase : FieAITaskInterface
{
protected delegate bool TaskDelegate(FieAITaskController manager);
protected float currentTime;
public Dictionary<Type, int> nextStateWeightList = new Dictionary<Type, int>();
protected event TaskDelegate taskEvent;
public FieAITaskBase()
{
taskEvent += Task;
}
public virtual bool TaskExec(FieAITaskController manager)
{
if (this.taskEvent == null)
{
return true;
}
currentTime += Time.deltaTime;
return this.taskEvent(manager);
}
public virtual void Initialize(FieAITaskController manager)
{
}
public virtual void Terminate(FieAITaskController manager)
{
}
public abstract bool Task(FieAITaskController manager);
public Dictionary<Type, int> GetWeight()
{
return nextStateWeightList;
}
}
}

View file

@ -0,0 +1,124 @@
using Fie.Enemies.HoovesRaces.ChangelingAlpha;
using Fie.Object;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskChangelingAlphaCharge : FieAITaskBase
{
private enum MeleeState
{
STATE_PREPARE,
STATE_MELEE
}
private const float HORMING_SEC_MAX = 2f;
private const float HORMING_SEC_MIN = 1.5f;
private const float ATTACK_DISTANCE = 2.75f;
public float _currentHormingCount;
private bool _isFirstCheck = true;
private bool _isEndState;
private MeleeState _meleeState;
public override void Initialize(FieAITaskController manager)
{
_currentHormingCount = 0f;
_isFirstCheck = true;
_isEndState = false;
_meleeState = MeleeState.STATE_PREPARE;
if (manager.ownerCharacter != null)
{
manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent;
}
}
public override void Terminate(FieAITaskController manager)
{
if (manager.ownerCharacter != null)
{
manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent;
}
}
private void healthSystem_staggerEvent(FieDamage damageObject)
{
nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100;
_isEndState = true;
}
public override bool Task(FieAITaskController manager)
{
if (_isEndState)
{
return true;
}
_currentHormingCount += Time.deltaTime;
if (!(manager.ownerCharacter.detector.lockonTargetObject != null))
{
return true;
}
switch (_meleeState)
{
case MeleeState.STATE_PREPARE:
{
float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.transform.position);
if (num > 2.75f)
{
Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.transform.position - manager.ownerCharacter.transform.position;
vector.y = vector.z;
vector.z = 0f;
manager.ownerCharacter.RequestToChangeState<FieStateMachineChangelingAlphaCharge>(vector.normalized, 1f, FieGameCharacter.StateMachineType.Base);
}
else if (_isFirstCheck)
{
Vector3 vector2 = manager.ownerCharacter.detector.lockonTargetObject.transform.position - manager.ownerCharacter.transform.position;
vector2.y = vector2.z;
vector2.z = 0f;
manager.ownerCharacter.RequestToChangeState<FieStateMachineChangelingAlphaZeroDistanceCharge>(vector2.normalized, 1f, FieGameCharacter.StateMachineType.Base);
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine is FieStateMachineChangelingAlphaZeroDistanceCharge))
{
return true;
}
currentStateMachine.stateChangeEvent += delegate
{
nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100;
_isEndState = true;
};
_meleeState = MeleeState.STATE_MELEE;
}
else
{
manager.ownerCharacter.RequestToChangeState<FieStateMachineChangelingAlphaChargeFinish>(Vector3.zero, 1f, FieGameCharacter.StateMachineType.Base);
FieStateMachineInterface currentStateMachine2 = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine2 is FieStateMachineChangelingAlphaChargeFinish))
{
return true;
}
currentStateMachine2.stateChangeEvent += delegate
{
nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100;
_isEndState = true;
};
_meleeState = MeleeState.STATE_MELEE;
}
_isFirstCheck = false;
break;
}
case MeleeState.STATE_MELEE:
if (_isEndState)
{
return true;
}
break;
}
return false;
}
}
}

View file

@ -0,0 +1,32 @@
using Fie.Enemies.HoovesRaces;
using Fie.Object;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskChangelingAlphaIdle : FieAITaskBase
{
public override bool Task(FieAITaskController manager)
{
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return false;
}
FieAITaskController.FieAIFrontAndBackPoint frontAndBackPoint = manager.GetFrontAndBackPoint();
if (frontAndBackPoint.backDistance > 0f)
{
nextStateWeightList[typeof(FieAITaskEnemiesHoovesRacesEvadeBackWall)] = 100;
return true;
}
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (currentStateMachine is FieStateMachineEnemiesHoovesRacesStagger)
{
nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100;
return true;
}
nextStateWeightList[typeof(FieAITaskChangelingAlphaShout)] = (int)Mathf.Max(2000f * manager.ownerCharacter.healthStats.nowHelthAndShieldRatePerMax, 1000f);
nextStateWeightList[typeof(FieAITaskFlightlingAlphaShot)] = (int)Mathf.Max(1000f * (1f - manager.ownerCharacter.healthStats.nowHelthAndShieldRatePerMax), 400f);
return true;
}
}
}

View file

@ -0,0 +1,85 @@
using Fie.Enemies.HoovesRaces.ChangelingAlpha;
using Fie.Object;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskChangelingAlphaShout : FieAITaskBase
{
private enum ShoutState
{
PREPARE,
CONCENTRATE,
DO,
DELAY
}
private const float SHOUT_TIME = 0.8f;
private float timeCount;
private ShoutState _state;
private bool _isEndState;
public override void Initialize(FieAITaskController manager)
{
timeCount = 0f;
_state = ShoutState.PREPARE;
_isEndState = false;
if (manager.ownerCharacter != null)
{
manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent;
}
}
public override void Terminate(FieAITaskController manager)
{
if (manager.ownerCharacter != null)
{
manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent;
}
}
private void healthSystem_staggerEvent(FieDamage damageObject)
{
nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100;
_isEndState = true;
}
public override bool Task(FieAITaskController manager)
{
timeCount += Time.deltaTime;
if (_isEndState)
{
return true;
}
if (!(manager.ownerCharacter != null))
{
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
switch (_state)
{
case ShoutState.PREPARE:
manager.ownerCharacter.RequestToChangeState<FieStateMachineChangelingAlphaShout>(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base);
_state = ShoutState.CONCENTRATE;
break;
case ShoutState.CONCENTRATE:
if (!(timeCount >= 0.8f))
{
break;
}
_state = ShoutState.DO;
goto case ShoutState.DO;
case ShoutState.DO:
nextStateWeightList[typeof(FieAITaskChangelingAlphaCharge)] = 100;
return true;
}
return false;
}
}
}

View file

@ -0,0 +1,60 @@
using Fie.Enemies.HoovesRaces.Changeling;
using Fie.Object;
namespace Fie.AI
{
public class FieAITaskChangelingBackstep : FieAITaskBase
{
private enum StepState
{
STATE_PREPARE,
STATE_STEP
}
private const float ATTACK_DISTANCE = 1.5f;
public const float EXECUTABLE_INTERVAL = 0.5f;
private bool _isEndState;
private StepState _stepState;
public override void Initialize(FieAITaskController manager)
{
_isEndState = false;
_stepState = StepState.STATE_PREPARE;
}
public override bool Task(FieAITaskController manager)
{
if (manager.getExecutedTaskInterval(typeof(FieAITaskChangelingBackstep)) < 0.5f)
{
return true;
}
switch (_stepState)
{
case StepState.STATE_PREPARE:
{
manager.ownerCharacter.RequestToChangeState<FieStateMachineChangelingBackstep>(manager.ownerCharacter.flipDirectionVector, 1f, FieGameCharacter.StateMachineType.Base);
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (currentStateMachine is FieStateMachineChangelingBackstep)
{
currentStateMachine.stateChangeEvent += delegate
{
_isEndState = true;
};
_stepState = StepState.STATE_STEP;
}
break;
}
case StepState.STATE_STEP:
if (_isEndState)
{
return true;
}
break;
}
return false;
}
}
}

View file

@ -0,0 +1,24 @@
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskChangelingIdle : FieAITaskBase
{
public override bool Task(FieAITaskController manager)
{
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return false;
}
FieAITaskController.FieAIFrontAndBackPoint frontAndBackPoint = manager.GetFrontAndBackPoint();
if (frontAndBackPoint.backDistance > 0f)
{
nextStateWeightList[typeof(FieAITaskEnemiesHoovesRacesEvadeBackWall)] = 100;
return true;
}
nextStateWeightList[typeof(FieAITaskChangelingMelee)] = (int)Mathf.Max(1000f * manager.ownerCharacter.healthStats.nowHelthAndShieldRatePerMax, 400f);
nextStateWeightList[typeof(FieAITaskChangelingShoot)] = (int)Mathf.Max(1000f * (1f - manager.ownerCharacter.healthStats.nowHelthAndShieldRatePerMax), 400f);
return true;
}
}
}

View file

@ -0,0 +1,133 @@
using Fie.Enemies.HoovesRaces;
using Fie.Enemies.HoovesRaces.Changeling;
using Fie.Object;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskChangelingMelee : FieAITaskBase
{
private enum MeleeState
{
STATE_PREPARE,
STATE_MELEE
}
private const float HORMING_SEC_MAX = 2f;
private const float HORMING_SEC_MIN = 1.5f;
private const float SHOOT_THLESHOLD_HEIGHT = 1.5f;
public const float VORTEX_DISTANCE = 2f;
public const float ATTACK_DISTANCE = 2.5f;
public float _hormingCount;
public float _currentHormingCount;
private bool _isFirstCheck = true;
private bool _isEndState;
private MeleeState _meleeState;
public override void Initialize(FieAITaskController manager)
{
_currentHormingCount = 0f;
_isFirstCheck = true;
_isEndState = false;
_meleeState = MeleeState.STATE_PREPARE;
_hormingCount = Random.Range(1.5f, 2f);
}
public override bool Task(FieAITaskController manager)
{
_currentHormingCount += Time.deltaTime;
if (manager.ownerCharacter.groundState != 0)
{
return true;
}
if (_currentHormingCount > _hormingCount)
{
nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100;
return true;
}
if (!(manager.ownerCharacter.detector.lockonTargetObject != null))
{
return true;
}
switch (_meleeState)
{
case MeleeState.STATE_PREPARE:
{
float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.transform.position);
if (num > 2.5f)
{
Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.transform.position - manager.ownerCharacter.transform.position;
vector.y = vector.z;
vector.z = 0f;
manager.ownerCharacter.RequestToChangeState<FieStateMachineEnemiesHoovesRacesMove>(vector.normalized, 1f, FieGameCharacter.StateMachineType.Base);
Vector3 position = manager.ownerCharacter.detector.lockonTargetObject.transform.position;
float y = position.y;
Vector3 position2 = manager.ownerCharacter.position;
if (Mathf.Abs(y - position2.y) > 1.5f && manager.getExecutedTaskInterval(typeof(FieAITaskChangelingShoot)) > 1f)
{
manager.ResetQueueTask();
if (num < 2.5f)
{
manager.AddQueueTask<FieAITaskChangelingBackstep>();
}
manager.AddQueueTask<FieAITaskChangelingShoot>();
_isEndState = true;
return true;
}
}
else if (num < 2f && _isFirstCheck)
{
Vector3 vector2 = manager.ownerCharacter.detector.lockonTargetObject.transform.position - manager.ownerCharacter.transform.position;
vector2.y = vector2.z;
vector2.z = 0f;
manager.ownerCharacter.RequestToChangeState<FieStateMachineChangelingVortex>(vector2.normalized, 1f, FieGameCharacter.StateMachineType.Base);
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine is FieStateMachineChangelingVortex))
{
return true;
}
currentStateMachine.stateChangeEvent += delegate
{
nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100;
_isEndState = true;
};
_meleeState = MeleeState.STATE_MELEE;
}
else
{
manager.ownerCharacter.RequestToChangeState<FieStateMachineChangelingMelee>(Vector3.zero, 1f, FieGameCharacter.StateMachineType.Base);
FieStateMachineInterface currentStateMachine2 = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine2 is FieStateMachineChangelingMelee))
{
return true;
}
currentStateMachine2.stateChangeEvent += delegate
{
nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100;
_isEndState = true;
};
_meleeState = MeleeState.STATE_MELEE;
}
_isFirstCheck = false;
break;
}
case MeleeState.STATE_MELEE:
if (_isEndState)
{
return true;
}
break;
}
return false;
}
}
}

View file

@ -0,0 +1,135 @@
using Fie.Enemies.HoovesRaces;
using Fie.Enemies.HoovesRaces.Changeling;
using Fie.Object;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskChangelingShoot : FieAITaskBase
{
private enum ShootState
{
STATE_RANGE_CALIBRATION,
STATE_PREPARE,
STATE_SHOOT
}
private const int SHOT_COUNT_MIN = 2;
private const int SHOT_COUNT_MAX = 2;
private const float RUNAWAY_SEC_MAX = 2f;
private const float RUNAWAY_SEC_MIN = 1.5f;
public const float SHOOT_DISTANCE = 2.5f;
public const float EXECUTABLE_INTERVAL = 1f;
private int _maxShotCount;
private int _shotCount;
private bool _isEndState;
public float _runAwayCount;
public float _currentRunAwayCount;
private ShootState _shootState;
public FieAITaskChangelingShoot()
{
_maxShotCount = Random.Range(2, 3);
}
public override void Initialize(FieAITaskController manager)
{
_maxShotCount = 0;
_shotCount = 0;
_isEndState = false;
_currentRunAwayCount = 0f;
_shootState = ShootState.STATE_RANGE_CALIBRATION;
_runAwayCount = Random.Range(1.5f, 2f);
}
public override bool Task(FieAITaskController manager)
{
if (manager.ownerCharacter.groundState != 0)
{
return true;
}
if (manager.getExecutedTaskInterval(typeof(FieAITaskChangelingShoot)) < 1f)
{
manager.AddQueueTask<FieAITaskChangelingBackstep>();
return true;
}
if (!(manager.ownerCharacter.detector.lockonTargetObject != null))
{
return true;
}
switch (_shootState)
{
case ShootState.STATE_RANGE_CALIBRATION:
{
float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.transform.position);
if (num < 2.5f)
{
_currentRunAwayCount += Time.deltaTime;
if (_currentRunAwayCount > _runAwayCount)
{
manager.AddQueueTask<FieAITaskChangelingBackstep>();
manager.AddQueueTask<FieAITaskChangelingMelee>();
return true;
}
Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.transform.position - manager.ownerCharacter.transform.position;
vector.y = (vector.z = 0f);
vector *= -1f;
vector.Normalize();
if (vector.y > 0.5f)
{
vector.y = 0.5f;
vector.Normalize();
}
manager.ownerCharacter.RequestToChangeState<FieStateMachineEnemiesHoovesRacesMove>(vector, 1f, FieGameCharacter.StateMachineType.Base);
}
else
{
_shootState = ShootState.STATE_PREPARE;
}
break;
}
case ShootState.STATE_PREPARE:
{
manager.ownerCharacter.RequestToChangeState<FieStateMachineChangelingShoot>(Vector3.zero, 1f, FieGameCharacter.StateMachineType.Base);
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine is FieStateMachineChangelingShoot))
{
return true;
}
currentStateMachine.stateChangeEvent += delegate
{
_shotCount++;
if (_shotCount < _maxShotCount)
{
_shootState = ShootState.STATE_PREPARE;
}
else
{
_isEndState = true;
}
};
_shootState = ShootState.STATE_SHOOT;
break;
}
case ShootState.STATE_SHOOT:
if (_isEndState)
{
return true;
}
break;
}
return false;
}
}
}

View file

@ -0,0 +1,37 @@
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskChangelingWait : FieAITaskBase
{
private const float EXECUTABLE_INTERVAL = 5f;
public const float WAIT_SEC_MAX = 1f;
public const float WAIT_SEC_MIN = 0.5f;
public float _waitCount;
public float _currentWaitCount;
public override void Initialize(FieAITaskController manager)
{
_currentWaitCount = 0f;
_waitCount = Random.Range(0.5f, 1f);
}
public override bool Task(FieAITaskController manager)
{
if (manager.getExecutedTaskInterval(typeof(FieAITaskChangelingWait)) < 5f)
{
return true;
}
_currentWaitCount += Time.deltaTime;
if (_currentWaitCount >= _waitCount)
{
return true;
}
return false;
}
}
}

View file

@ -0,0 +1,10 @@
namespace Fie.AI
{
public class FieAITaskCommonIdle : FieAITaskBase
{
public override bool Task(FieAITaskController manager)
{
return true;
}
}
}

View file

@ -0,0 +1,163 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskController : FieAIControllerBase
{
public struct FieAIFrontAndBackPoint
{
public float frontDistance;
public float backDistance;
public Vector3 frontPoint;
public Vector3 backPoint;
}
public Dictionary<Type, float> taskExecuteTimeList = new Dictionary<Type, float>();
private Dictionary<Type, FieAITaskBase> taskCache = new Dictionary<Type, FieAITaskBase>();
private Queue<FieAITaskBase> preQueueTaskList = new Queue<FieAITaskBase>();
private FieAITaskBase currentTask;
public void Start()
{
currentTask = getStartAI();
}
public void Update()
{
if (!(base.ownerCharacter == null) && PhotonNetwork.isMasterClient && currentTask.TaskExec(this))
{
currentTask.Terminate(this);
taskExecuteTimeList[currentTask.GetType()] = Time.time;
if (preQueueTaskList.Count > 0)
{
currentTask = preQueueTaskList.Dequeue();
}
else
{
currentTask = getNextTask(currentTask.GetWeight());
}
if (currentTask != null)
{
currentTask.nextStateWeightList.Clear();
currentTask.Initialize(this);
}
}
}
public void resetTask()
{
currentTask = getStartAI();
}
private FieAITaskBase getTaskInstanceFromCache(Type type)
{
if (!taskCache.ContainsKey(type))
{
FieAITaskBase fieAITaskBase = Activator.CreateInstance(type) as FieAITaskBase;
if (fieAITaskBase == null || !fieAITaskBase.GetType().IsSubclassOf(typeof(FieAITaskBase)))
{
return null;
}
taskCache[type] = fieAITaskBase;
}
return taskCache[type];
}
private FieAITaskBase getNextTask(Dictionary<Type, int> weightList)
{
if (weightList.Count == 1)
{
using (Dictionary<Type, int>.Enumerator enumerator = weightList.GetEnumerator())
{
if (enumerator.MoveNext())
{
KeyValuePair<Type, int> current = enumerator.Current;
if (current.Key.IsSubclassOf(typeof(FieAITaskBase)))
{
return getTaskInstanceFromCache(current.Key);
}
}
}
}
else if (weightList.Count > 1)
{
int num = 0;
foreach (KeyValuePair<Type, int> weight in weightList)
{
num += weight.Value;
}
if (num > 0)
{
int num2 = UnityEngine.Random.Range(0, num);
int num3 = 1;
foreach (KeyValuePair<Type, int> weight2 in weightList)
{
num3 += weight2.Value;
if (num2 <= num3 - 1)
{
if (!weight2.Key.IsSubclassOf(typeof(FieAITaskBase)))
{
break;
}
return getTaskInstanceFromCache(weight2.Key);
}
}
}
}
return getStartAI();
}
private FieAITaskBase getStartAI()
{
return getTaskInstanceFromCache(base.ownerCharacter.getDefaultAITask());
}
public float getExecutedTaskInterval(Type taskType)
{
if (!taskExecuteTimeList.ContainsKey(taskType))
{
return 3.40282347E+38f;
}
return Time.time - taskExecuteTimeList[taskType];
}
public void ResetQueueTask()
{
preQueueTaskList.Clear();
}
public void AddQueueTask<T>() where T : FieAITaskBase
{
preQueueTaskList.Enqueue(getTaskInstanceFromCache(typeof(T)));
}
public FieAIFrontAndBackPoint GetFrontAndBackPoint(float rayLength = 2f)
{
FieAIFrontAndBackPoint result = default(FieAIFrontAndBackPoint);
if (base.ownerCharacter == null)
{
return result;
}
int layerMask = 1049088;
if (Physics.Raycast(base.ownerCharacter.centerTransform.position, base.ownerCharacter.flipDirectionVector, out RaycastHit hitInfo, rayLength, layerMask))
{
result.frontPoint = hitInfo.point;
result.frontDistance = Vector3.Distance(hitInfo.point, base.ownerCharacter.centerTransform.position);
}
if (Physics.Raycast(base.ownerCharacter.centerTransform.position, -base.ownerCharacter.flipDirectionVector, out hitInfo, rayLength, layerMask))
{
result.backPoint = hitInfo.point;
result.backDistance = Vector3.Distance(hitInfo.point, base.ownerCharacter.centerTransform.position);
}
return result;
}
}
}

View file

@ -0,0 +1,42 @@
using Fie.Enemies.HoovesRaces;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskEnemiesHoovesRacesEvadeBackWall : FieAITaskBase
{
public bool _isEnd;
public Vector3 _backPoint;
public Vector3 _directionalVec;
public override void Initialize(FieAITaskController manager)
{
_isEnd = false;
FieAITaskController.FieAIFrontAndBackPoint frontAndBackPoint = manager.GetFrontAndBackPoint();
_backPoint = frontAndBackPoint.backPoint;
if (frontAndBackPoint.backDistance <= 0f)
{
_isEnd = true;
}
_directionalVec = manager.ownerCharacter.centerTransform.position - _backPoint;
_directionalVec.y = (_directionalVec.z = 0f);
_directionalVec.Normalize();
}
public override bool Task(FieAITaskController manager)
{
if (manager.ownerCharacter.detector.lockonTargetObject == null || manager.ownerCharacter.groundState != 0 || _isEnd)
{
return true;
}
manager.ownerCharacter.RequestToChangeState<FieStateMachineEnemiesHoovesRacesMove>(_directionalVec, 1f, FieGameCharacter.StateMachineType.Base);
if (Vector3.Distance(manager.ownerCharacter.centerTransform.position, _backPoint) > 2f)
{
return true;
}
return false;
}
}
}

View file

@ -0,0 +1,89 @@
using Fie.Enemies.HoovesRaces.ChangelingAlpha;
using Fie.Object;
using System;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskFlightlingAlphaShot : FieAITaskBase
{
private enum ShotState
{
PREPARE,
CONCENTRATE,
DO,
DELAY
}
private const float CONCENTRATE_TIME = 2f;
private const float SHOOTING_DELAY = 1.25f;
private float _timeCount;
private ShotState _state;
private bool _isEndState;
public override void Initialize(FieAITaskController manager)
{
_timeCount = 0f;
_state = ShotState.PREPARE;
_isEndState = false;
}
public override bool Task(FieAITaskController manager)
{
_timeCount += Time.deltaTime;
if (_isEndState)
{
return true;
}
if (!(manager.ownerCharacter != null))
{
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
switch (_state)
{
case ShotState.PREPARE:
{
manager.ownerCharacter.RequestToChangeState<FieStateMachineChangelingAlphaConcentration>(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base);
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (currentStateMachine is FieStateMachineChangelingAlphaConcentration)
{
currentStateMachine.stateChangeEvent += delegate(Type fromType, Type toType)
{
if (toType != typeof(FieStateMachineChangelingAlphaShoot))
{
nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100;
_isEndState = true;
}
};
}
if (!(_timeCount >= 2f))
{
break;
}
_state = ShotState.DO;
goto case ShotState.DO;
}
case ShotState.DO:
manager.ownerCharacter.RequestToChangeState<FieStateMachineChangelingAlphaShoot>(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base);
_timeCount = 0f;
_state = ShotState.DELAY;
break;
case ShotState.DELAY:
if (_timeCount >= 1.25f)
{
return true;
}
break;
}
return false;
}
}
}

View file

@ -0,0 +1,116 @@
using Fie.Enemies.HoovesRaces.Flightling;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskFlightlingFly : FieAITaskBase
{
private enum FlightState
{
PREPARE,
SET_ARTITUDE,
DO
}
public const float HORMING_DISTANCE = 4f;
private const int FLY_COUNT = 2;
private const float MAXIMUM_FLYING_COUNT = 3f;
private const float FLYING_DURATION = 0.75f;
private const float FLY_VECTOR_RANGE_X_MAX = 0.5f;
private const float FLY_VECTOR_RANGE_X_MIN = 0.1f;
private float _lifeCount;
private int _flyingCount;
private bool _isEndState;
private FlightState _state;
public override void Initialize(FieAITaskController manager)
{
_lifeCount = 0f;
_flyingCount = 0;
_isEndState = false;
_state = FlightState.PREPARE;
}
public override bool Task(FieAITaskController manager)
{
_lifeCount += Time.deltaTime;
if (_lifeCount > 3f)
{
return true;
}
if (!(manager.ownerCharacter != null))
{
return true;
}
switch (_state)
{
case FlightState.PREPARE:
manager.ownerCharacter.RequestToChangeState<FieStateMachineFlightlingFly>(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Base);
_state = FlightState.SET_ARTITUDE;
break;
case FlightState.SET_ARTITUDE:
{
if (_flyingCount >= 2)
{
nextStateWeightList[typeof(FieAITaskFlightlingShot)] = 100;
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.transform.position);
if (num > 4f && manager.ownerCharacter.groundState != 0)
{
nextStateWeightList[typeof(FieAITaskFlightlingFlyMove)] = 100;
return true;
}
FieStateMachineFlightlingFly fieStateMachineFlightlingFly2 = manager.ownerCharacter.getStateMachine().getCurrentStateMachine() as FieStateMachineFlightlingFly;
if (fieStateMachineFlightlingFly2 == null)
{
return true;
}
Vector3 vector = Vector3.down;
if (manager.ownerCharacter.groundState != 0)
{
float num2 = Random.Range(0.1f, 0.5f);
if (Random.Range(0, 100) >= 50)
{
num2 *= -1f;
}
vector += new Vector3(num2, 0f, 0f);
}
vector.Normalize();
Vector3 vector2 = fieStateMachineFlightlingFly2.calcArtitude(manager.ownerCharacter, vector);
if (!(vector2 != Vector3.zero))
{
return true;
}
fieStateMachineFlightlingFly2.setNextPosition(manager.ownerCharacter.position, vector2, 0.75f);
_flyingCount++;
_state = FlightState.DO;
break;
}
case FlightState.DO:
{
FieStateMachineFlightlingFly fieStateMachineFlightlingFly = manager.ownerCharacter.getStateMachine().getCurrentStateMachine() as FieStateMachineFlightlingFly;
if (fieStateMachineFlightlingFly != null && fieStateMachineFlightlingFly.isEndMoving())
{
_state = FlightState.SET_ARTITUDE;
}
break;
}
}
return false;
}
}
}

View file

@ -0,0 +1,43 @@
using Fie.Enemies.HoovesRaces.Flightling;
using Fie.Object;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskFlightlingFlyMove : FieAITaskBase
{
private enum FlightState
{
PREPARE,
SET_ARTITUDE,
DO
}
public override bool Task(FieAITaskController manager)
{
if (!(manager.ownerCharacter != null))
{
return true;
}
if (manager.ownerCharacter.groundState == FieObjectGroundState.Grounding)
{
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.transform.position);
if (!(num >= 4f))
{
nextStateWeightList[typeof(FieAITaskFlightlingFly)] = 100;
return true;
}
Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.transform.position - manager.ownerCharacter.transform.position;
vector.y = vector.z;
vector.z = 0f;
manager.ownerCharacter.RequestToChangeState<FieStateMachineFlightlingFlyMove>(vector.normalized, 1f, FieGameCharacter.StateMachineType.Base);
return false;
}
}
}

View file

@ -0,0 +1,30 @@
using Fie.Enemies.HoovesRaces;
using Fie.Object;
namespace Fie.AI
{
public class FieAITaskFlightlingIdle : FieAITaskBase
{
public override bool Task(FieAITaskController manager)
{
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return false;
}
FieAITaskController.FieAIFrontAndBackPoint frontAndBackPoint = manager.GetFrontAndBackPoint();
if (frontAndBackPoint.backDistance > 0f)
{
nextStateWeightList[typeof(FieAITaskEnemiesHoovesRacesEvadeBackWall)] = 100;
return true;
}
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (currentStateMachine is FieStateMachineEnemiesHoovesRacesStagger)
{
nextStateWeightList[typeof(FieAITaskChangelingBackstep)] = 100;
return true;
}
nextStateWeightList[typeof(FieAITaskFlightlingFly)] = 100;
return true;
}
}
}

View file

@ -0,0 +1,62 @@
using Fie.Enemies.HoovesRaces.Flightling;
using Fie.Object;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskFlightlingShot : FieAITaskBase
{
private enum ShotState
{
PREPARE,
CONCENTRATE,
DO
}
private const float CONCENTRATE_TIME = 1.5f;
private float timeCount;
private ShotState _state;
public override void Initialize(FieAITaskController manager)
{
timeCount = 0f;
_state = ShotState.PREPARE;
}
public override bool Task(FieAITaskController manager)
{
timeCount += Time.deltaTime;
if (!(manager.ownerCharacter != null))
{
return true;
}
if (manager.ownerCharacter.groundState == FieObjectGroundState.Grounding)
{
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
switch (_state)
{
case ShotState.PREPARE:
manager.ownerCharacter.RequestToChangeState<FieStateMachineFlightlingConcentration>(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base);
_state = ShotState.CONCENTRATE;
break;
case ShotState.CONCENTRATE:
if (timeCount >= 1.5f)
{
_state = ShotState.DO;
}
break;
case ShotState.DO:
manager.ownerCharacter.RequestToChangeState<FieStateMachineFlightlingShoot>(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base);
return true;
}
return false;
}
}
}

View file

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
namespace Fie.AI
{
public interface FieAITaskInterface
{
bool TaskExec(FieAITaskController manager);
bool Task(FieAITaskController manager);
Dictionary<Type, int> GetWeight();
}
}

View file

@ -0,0 +1,29 @@
using Fie.Manager;
using Fie.Object;
using Fie.Ponies;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskPoniesOwnerTracking : FieAITaskBase
{
public override bool Task(FieAITaskController manager)
{
if (FieManagerBehaviour<FieUserManager>.I.gameOwnerCharacter == null)
{
return true;
}
float num = Vector3.Distance(manager.ownerCharacter.transform.position, FieManagerBehaviour<FieUserManager>.I.gameOwnerCharacter.transform.position);
if (!(num > 2.5f))
{
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesIdle>(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Base);
return true;
}
Vector3 vector = FieManagerBehaviour<FieUserManager>.I.gameOwnerCharacter.transform.position - manager.ownerCharacter.transform.position;
vector.y = vector.z;
vector.z = 0f;
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesGallop>(vector.normalized, 1f, FieGameCharacter.StateMachineType.Base);
return false;
}
}
}

View file

@ -0,0 +1,35 @@
using Fie.Manager;
using Fie.Ponies;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskPoniesRescue : FieAITaskBase
{
private FieGameCharacter injuryCharacter;
public override void Initialize(FieAITaskController manager)
{
injuryCharacter = (injuryCharacter = FieManagerBehaviour<FieInGameCharacterStatusManager>.I.GetNearbyInjuryAllyCharacter(manager.ownerCharacter));
}
public override bool Task(FieAITaskController manager)
{
if (injuryCharacter == null)
{
return true;
}
float num = Vector3.Distance(manager.ownerCharacter.transform.position, injuryCharacter.transform.position);
if (!(num > 2.5f))
{
(manager.ownerCharacter as FiePonies).TryToRevive();
return true;
}
Vector3 vector = FieManagerBehaviour<FieUserManager>.I.gameOwnerCharacter.transform.position - manager.ownerCharacter.transform.position;
vector.y = vector.z;
vector.z = 0f;
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesGallop>(vector.normalized, 1f, FieGameCharacter.StateMachineType.Base);
return false;
}
}
}

View file

@ -0,0 +1,62 @@
using Fie.Enemies.HoovesRaces.QueenChrysalis;
using Fie.Object;
namespace Fie.AI
{
public class FieAITaskQueenChrysalisAirRaid : FieAITaskBase
{
private enum AirRaidState
{
START,
ATTACKING
}
private const float CONCENTRATE_TIME = 2f;
private const float SHOOTING_DELAY = 1.25f;
private AirRaidState _state;
private bool _isEndState;
public override void Initialize(FieAITaskController manager)
{
_isEndState = false;
_state = AirRaidState.START;
}
public override bool Task(FieAITaskController manager)
{
if (_isEndState)
{
return true;
}
if (!(manager.ownerCharacter != null))
{
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
switch (_state)
{
case AirRaidState.START:
manager.ownerCharacter.RequestToChangeState<FieStateMachineQueenChrysalisAirRiadPrepare>(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base);
_state = AirRaidState.ATTACKING;
break;
case AirRaidState.ATTACKING:
{
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine is FieStateMachineQueenChrysalisAirRiadPrepare) && !(currentStateMachine is FieStateMachineQueenChrysalisAirRiadAttacking) && !(currentStateMachine is FieStateMachineQueenChrysalisAirRaidFinished))
{
nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100;
_isEndState = true;
}
break;
}
}
return false;
}
}
}

View file

@ -0,0 +1,61 @@
using Fie.Enemies.HoovesRaces.QueenChrysalis;
using Fie.Object;
namespace Fie.AI
{
public class FieAITaskQueenChrysalisCrucible : FieAITaskBase
{
private enum CrucibleState
{
START,
DOING
}
private const float CONCENTRATE_TIME = 2f;
private const float SHOOTING_DELAY = 1.25f;
private CrucibleState _state;
private bool _isEndState;
public override void Initialize(FieAITaskController manager)
{
_isEndState = false;
_state = CrucibleState.START;
}
public override bool Task(FieAITaskController manager)
{
if (_isEndState)
{
return true;
}
if (!(manager.ownerCharacter != null))
{
return true;
}
switch (_state)
{
case CrucibleState.START:
{
manager.ownerCharacter.RequestToChangeState<FieStateMachineQueenChrysalisCrucible>(manager.ownerCharacter.flipDirectionVector, 1f, FieGameCharacter.StateMachineType.Base);
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (currentStateMachine is FieStateMachineQueenChrysalisCrucible)
{
currentStateMachine.stateChangeEvent += delegate
{
_isEndState = true;
};
}
else
{
_isEndState = true;
}
break;
}
}
return false;
}
}
}

View file

@ -0,0 +1,54 @@
using Fie.Enemies.HoovesRaces.QueenChrysalis;
using Fie.Object;
namespace Fie.AI
{
public class FieAITaskQueenChrysalisDoubleSlash : FieAITaskBase
{
private enum MeleeState
{
STATE_PREPARE,
STATE_MELEE
}
private bool _isEndState;
private MeleeState _meleeState;
public override void Initialize(FieAITaskController manager)
{
_isEndState = true;
_meleeState = MeleeState.STATE_PREPARE;
}
public override bool Task(FieAITaskController manager)
{
if (!(manager.ownerCharacter.detector.lockonTargetObject != null))
{
return true;
}
switch (_meleeState)
{
case MeleeState.STATE_PREPARE:
{
manager.ownerCharacter.RequestToChangeState<FieStateMachineQueenChrysalisDoubleSlash>(manager.ownerCharacter.flipDirectionVector, 1f, FieGameCharacter.StateMachineType.Base);
FieStateMachineInterface currentStateMachine2 = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
_meleeState = MeleeState.STATE_MELEE;
break;
}
case MeleeState.STATE_MELEE:
{
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine is FieStateMachineQueenChrysalisDoubleSlash))
{
nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100;
_isEndState = true;
return true;
}
break;
}
}
return false;
}
}
}

View file

@ -0,0 +1,78 @@
using Fie.Enemies.HoovesRaces.QueenChrysalis;
using Fie.Object;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskQueenChrysalisIdle : FieAITaskBase
{
public override bool Task(FieAITaskController manager)
{
FieQueenChrysalis fieQueenChrysalis = manager.ownerCharacter as FieQueenChrysalis;
if (fieQueenChrysalis == null)
{
return true;
}
if (fieQueenChrysalis.canAbleToCallMinion)
{
nextStateWeightList[typeof(FieAITaskQueenChrysallisCallingMinion)] = 100;
return true;
}
if (manager.ownerCharacter.groundState == FieObjectGroundState.Flying)
{
nextStateWeightList[typeof(FieAITaskQueenChrysalisAirRaid)] = 100;
if (fieQueenChrysalis.detector.lockonTargetObject != null)
{
float num = Vector3.Distance(fieQueenChrysalis.detector.lockonTargetObject.centerTransform.position, fieQueenChrysalis.centerTransform.position);
if (num < 1.25f)
{
nextStateWeightList[typeof(FieAITaskQueenChrysalisDoubleSlash)] = 500;
}
else
{
nextStateWeightList[typeof(FieAITaskQueenChrysalisDoubleSlash)] = 100;
}
}
}
else
{
FieAITaskController.FieAIFrontAndBackPoint frontAndBackPoint = manager.GetFrontAndBackPoint();
if (frontAndBackPoint.backDistance > 0f)
{
nextStateWeightList[typeof(FieAITaskQueenChrysalisTeleportation)] = 100;
return true;
}
if (fieQueenChrysalis.detector.lockonTargetObject != null)
{
float num2 = Vector3.Distance(fieQueenChrysalis.detector.lockonTargetObject.centerTransform.position, fieQueenChrysalis.centerTransform.position);
if (num2 > 5f)
{
nextStateWeightList[typeof(FieAITaskQueenChrysalisTeleportation)] = 100;
return true;
}
if (num2 > 3f)
{
nextStateWeightList[typeof(FieAITaskQueenChrysalisTeleportation)] = 200;
nextStateWeightList[typeof(FieAITaskQueenChrysalisShot)] = 200;
nextStateWeightList[typeof(FieAITaskQueenChrysalisDoubleSlash)] = 100;
nextStateWeightList[typeof(FieAITaskQueenChrysalisCrucible)] = 250;
nextStateWeightList[typeof(FieAITaskQueenChrysalisIgnite)] = 200;
}
else
{
nextStateWeightList[typeof(FieAITaskQueenChrysalisTeleportation)] = 50;
nextStateWeightList[typeof(FieAITaskQueenChrysalisShot)] = 50;
nextStateWeightList[typeof(FieAITaskQueenChrysalisDoubleSlash)] = 400;
nextStateWeightList[typeof(FieAITaskQueenChrysalisCrucible)] = 200;
nextStateWeightList[typeof(FieAITaskQueenChrysalisIgnite)] = 150;
}
}
}
if (fieQueenChrysalis.healthStats.shield <= 0f)
{
nextStateWeightList[typeof(FieAITaskQueenChrysalisMeteoShower)] = 50 + (int)(100f * (fieQueenChrysalis.healthStats.hitPoint / fieQueenChrysalis.healthStats.maxHitPoint));
}
return true;
}
}
}

View file

@ -0,0 +1,68 @@
using Fie.Enemies.HoovesRaces.QueenChrysalis;
using Fie.Object;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskQueenChrysalisIgnite : FieAITaskBase
{
private enum IgniteState
{
IGNITE,
IGNITE_ATTACKING,
DELAY
}
private const float CONCENTRATE_TIME = 2f;
private const float SHOOTING_DELAY = 1.25f;
private float timeCount;
private IgniteState _state;
private bool _isEndState;
public override void Initialize(FieAITaskController manager)
{
timeCount = 0f;
_state = IgniteState.IGNITE;
_isEndState = false;
}
public override bool Task(FieAITaskController manager)
{
timeCount += Time.deltaTime;
if (_isEndState)
{
return true;
}
if (!(manager.ownerCharacter != null))
{
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
switch (_state)
{
case IgniteState.IGNITE:
manager.ownerCharacter.RequestToChangeState<FieStateMachineQueenChrysalisIgniteStart>(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base);
_state = IgniteState.IGNITE_ATTACKING;
break;
case IgniteState.IGNITE_ATTACKING:
{
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine is FieStateMachineQueenChrysalisIgniteStart) && !(currentStateMachine is FieStateMachineQueenChrysalisIgnitePrepare) && !(currentStateMachine is FieStateMachineQueenChrysalisIgniteFailed) && !(currentStateMachine is FieStateMachineQueenChrysalisIgniteSucceed))
{
nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100;
_isEndState = true;
}
break;
}
}
return false;
}
}
}

View file

@ -0,0 +1,63 @@
using Fie.Enemies.HoovesRaces.QueenChrysalis;
using Fie.Object;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskQueenChrysalisMeteoShower : FieAITaskBase
{
private enum ShotState
{
PREPARE,
ATTACKING
}
private float timeCount;
private ShotState _state;
private bool _isEndState;
public override void Initialize(FieAITaskController manager)
{
timeCount = 0f;
_state = ShotState.PREPARE;
_isEndState = false;
}
public override bool Task(FieAITaskController manager)
{
timeCount += Time.deltaTime;
if (_isEndState)
{
return true;
}
if (!(manager.ownerCharacter != null))
{
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
switch (_state)
{
case ShotState.PREPARE:
manager.ownerCharacter.RequestToChangeState<FieStateMachineQueenChrysalisMeteorShowerPrepare>(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base);
_state = ShotState.ATTACKING;
break;
case ShotState.ATTACKING:
{
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine is FieStateMachineQueenChrysalisMeteorShowerPrepare) && !(currentStateMachine is FieStateMachineQueenChrysalisMeteorShowerAttacking) && !(currentStateMachine is FieStateMachineQueenChrysalisMeteorShowerFinished))
{
nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100;
_isEndState = true;
}
break;
}
}
return false;
}
}
}

View file

@ -0,0 +1,78 @@
using Fie.Enemies.HoovesRaces.QueenChrysalis;
using Fie.Object;
using System;
namespace Fie.AI
{
public class FieAITaskQueenChrysalisShot : FieAITaskBase
{
private enum ShotState
{
SHOOT,
SHOOTING,
DELAY
}
private const float CONCENTRATE_TIME = 2f;
private const float SHOOTING_DELAY = 1.25f;
private ShotState _state;
private bool _isEndState;
public override void Initialize(FieAITaskController manager)
{
_state = ShotState.SHOOT;
_isEndState = false;
}
public override bool Task(FieAITaskController manager)
{
if (_isEndState)
{
return true;
}
if (!(manager.ownerCharacter != null))
{
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
switch (_state)
{
case ShotState.SHOOT:
{
manager.ownerCharacter.RequestToChangeState<FieStateMachineQueenChrysalisHormingShot>(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base);
FieStateMachineInterface currentStateMachine2 = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (currentStateMachine2 is FieStateMachineQueenChrysalisHormingShot)
{
currentStateMachine2.stateChangeEvent += delegate(Type fromType, Type toType)
{
if (toType != typeof(FieStateMachineQueenChrysalisPenetrateShot))
{
nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100;
_isEndState = true;
}
};
}
_state = ShotState.SHOOTING;
break;
}
case ShotState.SHOOTING:
{
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine is FieStateMachineQueenChrysalisHormingShot) && !(currentStateMachine is FieStateMachineQueenChrysalisPenetrateShot))
{
nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100;
_isEndState = true;
}
break;
}
}
return false;
}
}
}

View file

@ -0,0 +1,74 @@
using Fie.Enemies.HoovesRaces.QueenChrysalis;
using Fie.Object;
namespace Fie.AI
{
public class FieAITaskQueenChrysalisTeleportation : FieAITaskBase
{
private enum TeleportationState
{
TLEREPORT,
TELEPORTING,
DELAY
}
private const float CONCENTRATE_TIME = 2f;
private const float SHOOTING_DELAY = 1.25f;
private TeleportationState _state;
private bool _isEndState;
public override void Initialize(FieAITaskController manager)
{
_state = TeleportationState.TLEREPORT;
_isEndState = false;
}
public override bool Task(FieAITaskController manager)
{
if (_isEndState)
{
return true;
}
if (!(manager.ownerCharacter != null))
{
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
switch (_state)
{
case TeleportationState.TLEREPORT:
{
manager.ownerCharacter.RequestToChangeState<FieStateMachineQueenChrysalisTeleportation>(manager.ownerCharacter.flipDirectionVector, 0f, FieGameCharacter.StateMachineType.Base);
FieStateMachineInterface currentStateMachine2 = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (currentStateMachine2 is FieStateMachineQueenChrysalisTeleportation)
{
currentStateMachine2.stateChangeEvent += delegate
{
nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100;
_isEndState = true;
};
}
_state = TeleportationState.TELEPORTING;
break;
}
case TeleportationState.TELEPORTING:
{
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine is FieStateMachineQueenChrysalisTeleportation))
{
nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100;
_isEndState = true;
}
break;
}
}
return false;
}
}
}

View file

@ -0,0 +1,54 @@
using Fie.Enemies.HoovesRaces.QueenChrysalis;
using Fie.Object;
namespace Fie.AI
{
public class FieAITaskQueenChrysallisCallingMinion : FieAITaskBase
{
private enum CallingState
{
CALLING_PREPARE,
CALLING
}
private bool _isEndState;
private CallingState _meleeState;
public override void Initialize(FieAITaskController manager)
{
_isEndState = true;
_meleeState = CallingState.CALLING_PREPARE;
}
public override bool Task(FieAITaskController manager)
{
if (!(manager.ownerCharacter.detector.lockonTargetObject != null))
{
return true;
}
switch (_meleeState)
{
case CallingState.CALLING_PREPARE:
{
manager.ownerCharacter.RequestToChangeState<FieStateMachineQueenChrysalisCallingMinion>(manager.ownerCharacter.flipDirectionVector, 1f, FieGameCharacter.StateMachineType.Base);
FieStateMachineInterface currentStateMachine2 = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
_meleeState = CallingState.CALLING;
break;
}
case CallingState.CALLING:
{
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine is FieStateMachineQueenChrysalisCallingMinion))
{
nextStateWeightList[typeof(FieAITaskQueenChrysalisIdle)] = 100;
_isEndState = true;
return true;
}
break;
}
}
return false;
}
}
}

View file

@ -0,0 +1,61 @@
using Fie.Object;
using Fie.Ponies;
using Fie.Ponies.RainbowDash;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskRainbowDashDoublePayback : FieAITaskBase
{
private bool _isAssigned;
private bool _isEnd;
public override void Initialize(FieAITaskController manager)
{
_isAssigned = false;
_isEnd = false;
manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent;
}
public override void Terminate(FieAITaskController manager)
{
manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent;
}
private void healthSystem_staggerEvent(FieDamage damageObject)
{
nextStateWeightList[typeof(FieAITaskRainbowDashEnemyEvade)] = 100;
_isEnd = true;
}
public override bool Task(FieAITaskController manager)
{
if (_isEnd)
{
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
if (!_isAssigned)
{
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesAbilitySlot1>(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack);
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine is FieStateMachineRainbowDashDoublePaybackPrepareOnGround) && !(currentStateMachine is FieStateMachineRainbowDashDoublePaybackPrepareMidAir))
{
return true;
}
currentStateMachine.stateChangeEvent += delegate
{
nextStateWeightList[typeof(FieAITaskRainbowDashEvasion)] = 100;
nextStateWeightList[typeof(FieAITaskRainbowDashRainblow)] = 100;
_isEnd = true;
};
_isAssigned = true;
}
return false;
}
}
}

View file

@ -0,0 +1,37 @@
using Fie.Ponies;
using Fie.Ponies.RainbowDash;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskRainbowDashEnemyEvade : 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 < 3f))
{
if (manager.ownerCharacter.abilitiesContainer.GetCooltime<FieStateMachineRainbowDashDoublePayback>() <= 0f)
{
nextStateWeightList[typeof(FieAITaskRainbowDashDoublePayback)] = 100;
return true;
}
if (manager.ownerCharacter.abilitiesContainer.GetCooltime<FieStateMachineRainbowDashRainblow>() <= 0f)
{
nextStateWeightList[typeof(FieAITaskRainbowDashRainblow)] = 100;
return true;
}
return true;
}
Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.centerTransform.position - manager.ownerCharacter.transform.position;
vector.y = vector.z;
vector.z = 0f;
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesGallop>(-vector.normalized, 1f, FieGameCharacter.StateMachineType.Base);
return false;
}
}
}

View file

@ -0,0 +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;
}
}
}

View file

@ -0,0 +1,64 @@
using Fie.Object;
using Fie.Ponies.RainbowDash;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskRainbowDashEvasion : FieAITaskBase
{
private enum StepState
{
STATE_PREPARE,
STATE_STEP
}
private const float ATTACK_DISTANCE = 15f;
private bool _isEndState;
private StepState _stepState;
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<FieStateMachineRainbowDashEvasion>(directionalVec, 1f, FieGameCharacter.StateMachineType.Base);
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (currentStateMachine is FieStateMachineRainbowDashEvasion || currentStateMachine is FieStateMachineRainbowDashEvasionBack || currentStateMachine is FieStateMachineRainbowDashEvasionFront || currentStateMachine is FieStateMachineRainbowDashEvasionUp || currentStateMachine is FieStateMachineRainbowDashEvasionDown)
{
currentStateMachine.stateChangeEvent += delegate
{
_isEndState = true;
};
_stepState = StepState.STATE_STEP;
}
else
{
_isEndState = true;
}
break;
}
case StepState.STATE_STEP:
if (_isEndState)
{
return true;
}
break;
}
return false;
}
}
}

View file

@ -0,0 +1,95 @@
using Fie.Manager;
using Fie.Object;
using Fie.Ponies.RainbowDash;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskRainbowDashIdle : 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 bool Task(FieAITaskController manager)
{
FieRainbowDash fieRainbowDash = manager.ownerCharacter as FieRainbowDash;
if (fieRainbowDash.damageSystem.isDead)
{
if (fieRainbowDash.friendshipStats.getCurrentFriendshipPoint() >= 3)
{
fieRainbowDash.TryToRevive();
}
return true;
}
if (injuryCharacter != null && fieRainbowDash.friendshipStats.getCurrentFriendshipPoint() >= 2)
{
nextStateWeightList[typeof(FieAITaskPoniesRescue)] = 100;
return true;
}
float num = Vector3.Distance(fieRainbowDash.transform.position, FieManagerBehaviour<FieUserManager>.I.gameOwnerCharacter.transform.position);
if (fieRainbowDash.detector.lockonTargetObject == null)
{
if (num > 2.5f)
{
nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100;
return true;
}
return false;
}
float num2 = Vector3.Distance(fieRainbowDash.transform.position, fieRainbowDash.detector.lockonTargetObject.position);
if (num2 > 4.5f)
{
nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100;
return true;
}
if (fieRainbowDash.abilitiesContainer.GetCooltime<FieStateMachineRainbowDashDoublePayback>() <= 0f)
{
nextStateWeightList[typeof(FieAITaskRainbowDashDoublePayback)] = 500;
}
if (fieRainbowDash.abilitiesContainer.GetCooltime<FieStateMachineRainbowDashRainblow>() <= 0f)
{
nextStateWeightList[typeof(FieAITaskRainbowDashRainblow)] = 500;
}
if (num2 > 2.5f)
{
if (fieRainbowDash.healthStats.shield > 0f)
{
nextStateWeightList[typeof(FieAITaskRainbowDashEnemyTracking)] = 500;
}
else
{
nextStateWeightList[typeof(FieAITaskRainbowDashEnemyEvade)] = 500;
}
if (fieRainbowDash.awesomeCount > 0)
{
nextStateWeightList[typeof(FieAITaskRainbowDashOmniSmash)] = 200 * fieRainbowDash.awesomeCount;
}
return true;
}
if (fieRainbowDash.healthStats.shield <= 0f)
{
nextStateWeightList[typeof(FieAITaskRainbowDashEnemyEvade)] = 500;
return true;
}
nextStateWeightList[typeof(FieAITaskRainbowDashEvasion)] = 200;
if (fieRainbowDash.groundState == FieObjectGroundState.Grounding)
{
nextStateWeightList[typeof(FieAITaskRainbowDashJump)] = 200;
}
nextStateWeightList[typeof(FieAITaskRainbowDashMelee)] = 200;
return true;
}
}
}

View file

@ -0,0 +1,51 @@
using Fie.Object;
using Fie.Ponies;
using Fie.Ponies.RainbowDash;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskRainbowDashJump : FieAITaskBase
{
public const float JUMPING_MAXIMUM_TIME = 3f;
public const float JUMPING_THRESHOLD_TIME = 0.3f;
private float _lifeCount;
private float _jumpCount;
private bool _isJump;
public override void Initialize(FieAITaskController manager)
{
_lifeCount = 0f;
_jumpCount = 0f;
_isJump = false;
}
public override bool Task(FieAITaskController manager)
{
_lifeCount += Time.deltaTime;
if (_lifeCount >= 3f)
{
return true;
}
if (_isJump)
{
return true;
}
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesJump>(Vector3.up, 1f, FieGameCharacter.StateMachineType.Base);
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (currentStateMachine is FieStateMachineRainbowDashFlying)
{
_jumpCount += Time.deltaTime;
if (_jumpCount > 0.3f)
{
_isJump = true;
}
}
return false;
}
}
}

View file

@ -0,0 +1,63 @@
using Fie.Object;
using Fie.Ponies;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskRainbowDashMelee : FieAITaskBase
{
public const float MELEE_TIME_MAX = 1.5f;
public const float MELEE_TIME_MIN = 0.5f;
private bool _isEnd;
private float _lifeCount;
private float _meleeCount;
public override void Initialize(FieAITaskController manager)
{
_isEnd = false;
_lifeCount = 0f;
_meleeCount = Random.Range(0.5f, 1.5f);
manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent;
}
public override void Terminate(FieAITaskController manager)
{
manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent;
}
private void healthSystem_staggerEvent(FieDamage damageObject)
{
nextStateWeightList[typeof(FieAITaskRainbowDashEvasion)] = 100;
_isEnd = true;
}
public override bool Task(FieAITaskController manager)
{
if (_isEnd)
{
return true;
}
_lifeCount += Time.deltaTime;
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.position);
if (num > 45f)
{
nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100;
return true;
}
if (_lifeCount >= _meleeCount)
{
return true;
}
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesBaseAttack>(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack);
return false;
}
}
}

View file

@ -0,0 +1,67 @@
using Fie.Object;
using Fie.Ponies;
using Fie.Ponies.RainbowDash;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskRainbowDashOmniSmash : FieAITaskBase
{
private bool _isAssigned;
private bool _isEnd;
public override void Initialize(FieAITaskController manager)
{
_isAssigned = false;
_isEnd = false;
manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent;
}
public override void Terminate(FieAITaskController manager)
{
manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent;
}
private void healthSystem_staggerEvent(FieDamage damageObject)
{
nextStateWeightList[typeof(FieAITaskRainbowDashEnemyEvade)] = 100;
_isEnd = true;
}
public override bool Task(FieAITaskController manager)
{
if (_isEnd)
{
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
FieRainbowDash fieRainbowDash = manager.ownerCharacter as FieRainbowDash;
if (fieRainbowDash == null)
{
return true;
}
if (!_isAssigned)
{
if (fieRainbowDash.awesomeCount <= 0)
{
return true;
}
fieRainbowDash.RequestToChangeState<FieStateMachinePoniesAbilitySlot3>(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack);
_isAssigned = true;
}
else
{
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine is FieStateMachineRainbowDashOmniSmash) && !(currentStateMachine is FieStateMachineRainbowDashOmniSmashFinish) && !(currentStateMachine is FieStateMachineRainbowDashOmniSmashLoop) && !(currentStateMachine is FieStateMachineRainbowDashOmniSmashStart))
{
return true;
}
}
return false;
}
}
}

View file

@ -0,0 +1,60 @@
using Fie.Object;
using Fie.Ponies;
using Fie.Ponies.RainbowDash;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskRainbowDashRainblow : FieAITaskBase
{
private bool _isAssigned;
private bool _isEnd;
public override void Initialize(FieAITaskController manager)
{
_isAssigned = false;
_isEnd = false;
manager.ownerCharacter.damageSystem.staggerEvent += healthSystem_staggerEvent;
}
public override void Terminate(FieAITaskController manager)
{
manager.ownerCharacter.damageSystem.staggerEvent -= healthSystem_staggerEvent;
}
private void healthSystem_staggerEvent(FieDamage damageObject)
{
nextStateWeightList[typeof(FieAITaskRainbowDashEnemyEvade)] = 100;
_isEnd = true;
}
public override bool Task(FieAITaskController manager)
{
if (_isEnd)
{
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
if (!_isAssigned)
{
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesAbilitySlot2>(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack);
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine is FieStateMachineRainbowDashRainblow) && !(currentStateMachine is FieStateMachineRainbowDashRainblowCloack))
{
return true;
}
currentStateMachine.stateChangeEvent += delegate
{
nextStateWeightList[typeof(FieAITaskRainbowDashMelee)] = 100;
_isEnd = true;
};
_isAssigned = true;
}
return false;
}
}
}

View file

@ -0,0 +1,21 @@
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;
}
}
}

View file

@ -0,0 +1,79 @@
using Fie.Object;
using Fie.Ponies;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskTwilightBaseShot : FieAITaskTwilightBase
{
public const float SHOOTING_TIME_MAX = 1.5f;
public const float SHOOTING_TIME_MIN = 0.5f;
private bool _isEnd;
private float _lifeCount;
private float _meleeCount;
public override void Initialize(FieAITaskController manager)
{
_isEnd = false;
_lifeCount = 0f;
_meleeCount = Random.Range(0.5f, 1.5f);
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_staggerEvent(FieDamage damageObject)
{
nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100;
_isEnd = true;
}
public override bool Task(FieAITaskController manager)
{
if (_isEnd)
{
return true;
}
_lifeCount += Time.deltaTime;
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
float num = Vector3.Distance(manager.ownerCharacter.transform.position, manager.ownerCharacter.detector.lockonTargetObject.position);
if (num > 4.5f)
{
nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100;
return true;
}
if (_lifeCount >= _meleeCount)
{
return true;
}
if (manager.ownerCharacter.healthStats.shield <= 0f)
{
return true;
}
if (AdjustDirectionByBasicMovement(manager))
{
return false;
}
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesBaseAttack>(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack);
return false;
}
}
}

View file

@ -0,0 +1,44 @@
using Fie.Ponies;
using Fie.Ponies.Twilight;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskTwilightEnemyEvade : FieAITaskTwilightBase
{
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);
FieAITaskController.FieAIFrontAndBackPoint frontAndBackPoint = manager.GetFrontAndBackPoint(3f);
bool flag = false;
Vector3 vector = manager.ownerCharacter.detector.lockonTargetObject.centerTransform.position - manager.ownerCharacter.transform.position;
vector.y = vector.z;
vector.z = 0f;
if (num < 1.5f)
{
if (Random.Range(0, 100) > 50)
{
flag = ((byte)((flag ? 1 : 0) | 1) != 0);
}
if (frontAndBackPoint.backDistance > 0f)
{
flag = ((byte)((flag ? 1 : 0) | 1) != 0);
}
manager.ownerCharacter.RequestToChangeState<FieStateMachineTwilightTeleportation>((!flag) ? (-vector) : vector, 1f, FieGameCharacter.StateMachineType.Base);
}
else if (num < 3f)
{
if (frontAndBackPoint.backDistance > 0f)
{
flag = ((byte)((flag ? 1 : 0) | 1) != 0);
}
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesGallop>((!flag) ? (-vector) : vector, 1f, FieGameCharacter.StateMachineType.Base);
}
return true;
}
}
}

View file

@ -0,0 +1,50 @@
using Fie.Object;
using Fie.Ponies.Twilight;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskTwilightForceField : 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 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_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<FieStateMachineTwilightForceField>(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack);
return true;
}
}
}

View file

@ -0,0 +1,90 @@
using Fie.Manager;
using Fie.Object;
using Fie.Ponies.Twilight;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskTwilightIdle : FieAITaskTwilightBase
{
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 bool Task(FieAITaskController manager)
{
FieTwilight fieTwilight = manager.ownerCharacter as FieTwilight;
if (fieTwilight.damageSystem.isDead)
{
if (fieTwilight.friendshipStats.getCurrentFriendshipPoint() >= 3)
{
fieTwilight.TryToRevive();
}
return true;
}
if (injuryCharacter != null && fieTwilight.friendshipStats.getCurrentFriendshipPoint() >= 2)
{
nextStateWeightList[typeof(FieAITaskPoniesRescue)] = 100;
return true;
}
float num = Vector3.Distance(fieTwilight.transform.position, FieManagerBehaviour<FieUserManager>.I.gameOwnerCharacter.transform.position);
if (fieTwilight.detector.lockonTargetObject == null)
{
if (num > 2.5f)
{
nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100;
return true;
}
return false;
}
float num2 = Vector3.Distance(fieTwilight.transform.position, fieTwilight.detector.lockonTargetObject.position);
if (num2 > 4.5f)
{
nextStateWeightList[typeof(FieAITaskPoniesOwnerTracking)] = 100;
return true;
}
if (num2 > 2.5f)
{
if (manager.ownerCharacter.groundState != FieObjectGroundState.Flying)
{
nextStateWeightList[typeof(FieAITaskTwilightJump)] = 500;
}
if (fieTwilight.abilitiesContainer.GetCooltime<FieStateMachineTwilightSparklyCannon>() <= 0f)
{
nextStateWeightList[typeof(FieStateMachineTwilightSparklyCannon)] = 100;
}
if (fieTwilight.abilitiesContainer.GetCooltime<FieStateMachineTwilightSummonArrow>() <= 0f)
{
nextStateWeightList[typeof(FieAITaskTwilightSummonArrow)] = 100;
}
if (fieTwilight.abilitiesContainer.GetCooltime<FieStateMachineTwilightForceField>() <= 0f)
{
nextStateWeightList[typeof(FieAITaskTwilightForceField)] = 100;
}
if (fieTwilight.healthStats.shield > fieTwilight.healthStats.maxShield * 0.3f)
{
nextStateWeightList[typeof(FieAITaskTwilightBaseShot)] = 100;
}
else
{
nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100;
}
return true;
}
nextStateWeightList.Clear();
nextStateWeightList[typeof(FieAITaskTwilightEnemyEvade)] = 100;
return true;
}
}
}

View file

@ -0,0 +1,60 @@
using Fie.Object;
using Fie.Ponies;
using Fie.Ponies.Twilight;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskTwilightJump : FieAITaskBase
{
public const float JUMPING_MAXIMUM_TIME = 3f;
public const float JUMPING_THRESHOLD_TIME = 0.3f;
private float _lifeCount;
private float _jumpCount;
private bool _isJump;
public override void Initialize(FieAITaskController manager)
{
_lifeCount = 0f;
_jumpCount = 0f;
_isJump = false;
}
public override bool Task(FieAITaskController manager)
{
if (manager.ownerCharacter.groundState == FieObjectGroundState.Flying)
{
return true;
}
_lifeCount += Time.deltaTime;
if (_lifeCount >= 3f)
{
return true;
}
if (manager.ownerCharacter.detector.lockonTargetObject == null)
{
return true;
}
if (_isJump)
{
return true;
}
manager.ownerCharacter.RequestToChangeState<FieStateMachinePoniesJump>(Vector3.up, 1f, FieGameCharacter.StateMachineType.Base);
FieStateMachineInterface currentStateMachine = manager.ownerCharacter.getStateMachine().getCurrentStateMachine();
if (!(currentStateMachine is FieStateMachineTwilightFlying))
{
return true;
}
_jumpCount += Time.deltaTime;
if (_jumpCount > 0.3f)
{
_isJump = true;
}
return false;
}
}
}

View file

@ -0,0 +1,54 @@
using Fie.Object;
using Fie.Ponies.Twilight;
using UnityEngine;
namespace Fie.AI
{
public class FieAITaskTwilightShinyArrow : 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 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_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;
}
if (AdjustDirectionByBasicMovement(manager))
{
return false;
}
manager.ownerCharacter.RequestToChangeState<FieStateMachineTwilightShinyArrow>(Vector3.zero, 0f, FieGameCharacter.StateMachineType.Attack);
return true;
}
}
}

View file

@ -0,0 +1,50 @@
using Fie.Object;
using Fie.Ponies.Twilight;
using UnityEngine;
namespace Fie.AI
{
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 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_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;
}
}
}

View file

@ -0,0 +1,311 @@
using AmplifyBloom;
using Fie.Manager;
using Fie.PostEffect;
using System;
using UnityEngine;
using UnityEngine.PostProcessing;
using UnityStandardAssets.ImageEffects;
namespace Fie.Camera
{
[RequireComponent(typeof(UnityEngine.Camera))]
public abstract class FieCameraBase : MonoBehaviour
{
public PostProcessingProfile PostProcessingProfileForLev2;
public PostProcessingProfile PostProcessingProfileForLev3;
public PostProcessingProfile PostProcessingProfileForLev4;
public PostProcessingProfile PostProcessingProfileForLev5;
private FieGameCharacter _cameraOwner;
private UnityEngine.Camera _camera;
public UnityEngine.Camera camera => _camera;
public FieGameCharacter cameraOwner
{
get
{
if (_cameraOwner == null)
{
_cameraOwner = FieManagerBehaviour<FieUserManager>.I.gameOwnerCharacter;
}
return _cameraOwner;
}
}
protected virtual void Awake()
{
_camera = GetComponent<UnityEngine.Camera>();
if (_camera == null)
{
throw new Exception("this component require UnityEngine.Camera. but didn't.");
}
}
protected virtual void Start()
{
CalibratePostEffects();
}
public void CalibratePostEffects()
{
int qualityLevel = QualitySettings.GetQualityLevel();
PostProcessingBehaviour component = GetComponent<PostProcessingBehaviour>();
AmplifyBloomEffect component2 = GetComponent<AmplifyBloomEffect>();
UltimateBloom component3 = GetComponent<UltimateBloom>();
SSREffect component4 = GetComponent<SSREffect>();
PKFxRenderingPlugin component5 = GetComponent<PKFxRenderingPlugin>();
SunShafts component6 = GetComponent<SunShafts>();
SEGI component7 = GetComponent<SEGI>();
VolumetricFog component8 = GetComponent<VolumetricFog>();
FieCommandBufferReflection component9 = GetComponent<FieCommandBufferReflection>();
switch (qualityLevel)
{
default:
if (component != null)
{
component.enabled = false;
}
if (component2 != null)
{
component2.enabled = false;
}
if (component3 != null)
{
component3.enabled = false;
}
if (component4 != null)
{
component4.enabled = false;
}
if (component5 != null)
{
component5.m_EnableDistortion = false;
}
if (component5 != null)
{
component5.m_EnableSoftParticles = false;
}
if (component6 != null)
{
component6.enabled = false;
}
if (component7 != null)
{
component7.enabled = false;
}
if (component8 != null)
{
component8.enabled = false;
}
if (component9 != null)
{
component9.enabled = false;
}
Shader.globalMaximumLOD = 800;
break;
case 1:
if (component2 != null)
{
component2.enabled = false;
}
if (component3 != null)
{
component3.enabled = false;
}
if (component4 != null)
{
component4.enabled = false;
}
if (component5 != null)
{
component5.m_EnableDistortion = false;
}
if (component5 != null)
{
component5.m_EnableSoftParticles = false;
}
if (component6 != null)
{
component6.enabled = true;
}
if (component7 != null)
{
component7.enabled = false;
}
if (component8 != null)
{
component8.enabled = false;
}
if (component9 != null)
{
component9.enabled = false;
}
if (component != null)
{
component.profile = PostProcessingProfileForLev2;
}
Shader.globalMaximumLOD = 800;
break;
case 2:
if (component2 != null)
{
component2.enabled = true;
}
if (component3 != null)
{
component3.enabled = true;
}
if (component4 != null)
{
component4.enabled = false;
}
if (component5 != null)
{
component5.m_EnableDistortion = true;
}
if (component5 != null)
{
component5.m_EnableSoftParticles = true;
}
if (component6 != null)
{
component6.enabled = true;
}
if (component7 != null)
{
component7.enabled = false;
}
if (component != null)
{
component.profile = PostProcessingProfileForLev3;
}
if (component8 != null)
{
component8.enabled = false;
}
if (component9 != null)
{
component9.enabled = true;
}
if (component2 != null)
{
component2.BloomDownsampleCount = 3;
}
Shader.globalMaximumLOD = 1500;
break;
case 3:
if (component2 != null)
{
component2.enabled = true;
}
if (component3 != null)
{
component3.enabled = true;
}
if (component4 != null)
{
component4.enabled = true;
}
if (component5 != null)
{
component5.m_EnableDistortion = true;
}
if (component5 != null)
{
component5.m_EnableSoftParticles = true;
}
if (component6 != null)
{
component6.enabled = true;
}
if (component7 != null)
{
component7.enabled = false;
}
if (component != null)
{
component.profile = PostProcessingProfileForLev4;
}
if (component8 != null)
{
component8.enabled = true;
}
if (component9 != null)
{
component9.enabled = true;
}
if (component2 != null)
{
component2.BloomDownsampleCount = 5;
}
Shader.globalMaximumLOD = 1500;
break;
case 4:
if (component2 != null)
{
component2.enabled = true;
}
if (component3 != null)
{
component3.enabled = true;
}
if (component4 != null)
{
component4.enabled = true;
}
if (component5 != null)
{
component5.m_EnableDistortion = true;
}
if (component5 != null)
{
component5.m_EnableSoftParticles = true;
}
if (component6 != null)
{
component6.enabled = true;
}
if (component7 != null)
{
component7.enabled = true;
}
if (component != null)
{
component.profile = PostProcessingProfileForLev5;
}
if (component8 != null)
{
component8.enabled = true;
}
if (component9 != null)
{
component9.enabled = true;
}
if (component2 != null)
{
component2.BloomDownsampleCount = 5;
}
Shader.globalMaximumLOD = 1500;
break;
}
}
public virtual void setCameraOwner(FieGameCharacter owner)
{
if (!(owner == null))
{
_cameraOwner = owner;
}
}
public bool isCameraOwner(FieGameCharacter character)
{
return character.GetInstanceID() == _cameraOwner.GetInstanceID();
}
}
}

View file

@ -0,0 +1,72 @@
using Fie.Utility;
using UnityEngine;
namespace Fie.Camera
{
public class FieCameraOffset
{
public struct FieCameraOffsetParam
{
public Vector3 position;
public Vector3 angle;
public float fov;
public FieCameraOffsetParam(Vector3 position, Vector3 angle, float v)
{
this.position = position;
this.angle = angle;
fov = v;
}
public static FieCameraOffsetParam operator *(FieCameraOffsetParam a, float b)
{
return new FieCameraOffsetParam(a.position * b, a.angle * b, a.fov * b);
}
}
private Tweener<TweenTypesInOutSine> _startTweener = new Tweener<TweenTypesInOutSine>();
private Tweener<TweenTypesInOutSine> _endTweener = new Tweener<TweenTypesInOutSine>();
private FieCameraOffsetParam _offset;
private float stayDuration;
public FieCameraOffset(FieCameraOffsetParam offset, float startDuration, float stayDuration, float endDuration)
{
_offset = offset;
_startTweener.InitTweener(startDuration, 0f, 1f);
_endTweener.InitTweener(endDuration, 1f, 0f);
this.stayDuration = stayDuration;
}
public bool isEnd()
{
if (_startTweener.IsEnd() && _endTweener.IsEnd())
{
return true;
}
return false;
}
public FieCameraOffsetParam updateParams(float deltaTime)
{
if (!_startTweener.IsEnd())
{
return _offset * _startTweener.UpdateParameterFloat(deltaTime);
}
if (stayDuration > 0f)
{
stayDuration -= deltaTime;
return _offset * 1f;
}
if (!_endTweener.IsEnd())
{
return _offset * _endTweener.UpdateParameterFloat(deltaTime);
}
return _offset * 0f;
}
}
}

View file

@ -0,0 +1,316 @@
using CinemaDirector;
using Colorful;
using Fie.Manager;
using Fie.Utility;
using UnityEngine;
namespace Fie.Camera
{
public class FieGameCamera : FieCameraBase
{
private const float CALC_MAXHP_RATE = 0.6f;
private const float MAX_GRAYSCALE_AMOUNT = 0.4f;
private const float MAX_VIGNETTE = 20f;
private const float MAX_CHROMATIC = -20f;
private const float MAX_DRY_LEVEL = -1000f;
private const float MAX_DECAY_TIME = 2f;
private const float MAX_DECAY_RATIO = 1f;
private const float MAX_ROOM_HF = -1000f;
private const float MAX_ROOM_LF = -500f;
private const float MAX_REVERB_LEVEL = 100f;
private const float MAX_REVERB_DELAY = 0.1f;
private float _maxHp;
private float _currentHp;
private float _currentAnimatinoHp;
private Tweener<TweenTypesInOutSine> _transitionAlphaTweener = new Tweener<TweenTypesInOutSine>();
private Tweener<TweenTypesOutSine> _damageTweener = new Tweener<TweenTypesOutSine>();
public Quaternion nowCameraTargetRotation = Quaternion.identity;
public Quaternion lastCameraTargetRotation = Quaternion.identity;
public Quaternion beforeTaskChangedTargetRotation = Quaternion.identity;
public Vector3 nowCameraTargetPos = Vector3.zero;
public Vector3 lastCameraTargetPos = Vector3.zero;
public Vector3 beforeTaskChangedTargetPos = Vector3.zero;
public Vector3 tagetMakerScreenPos = Vector3.zero;
private float _initCameraFov;
private float _lastCameraFov;
private float _transitionAlpha = 1f;
private Vector3 _wiggleRange = Vector3.zero;
private Wiggler _cameraWiggler;
private FieCameraOffset _cameraOffset;
private FieCameraOffset.FieCameraOffsetParam currentOffsetParam = default(FieCameraOffset.FieCameraOffsetParam);
private FieGameCameraTaskBase nowTaskObject;
[SerializeField]
private Grayscale _colorCorrectionEffect;
[SerializeField]
private ContrastVignette _vignetteEffect;
[SerializeField]
private AudioReverbFilter _reverbFilter;
[SerializeField]
private bool _isEnableDOF = true;
public Cutscene _mainCameraCutScene;
public float transitionAlpha
{
get
{
if (_transitionAlphaTweener == null || _transitionAlphaTweener.IsEnd())
{
return 1f;
}
return _transitionAlpha;
}
private set
{
_transitionAlpha = value;
}
}
protected override void Awake()
{
base.Awake();
base.camera.transparencySortMode = TransparencySortMode.Orthographic;
_cameraWiggler = new Wiggler(Vector3.zero, 0f, 1, Vector3.zero);
_transitionAlphaTweener.InitTweener(0.1f, 0f, 1f);
_lastCameraFov = (_initCameraFov = base.camera.fieldOfView);
InitTargetMakerScreenPos();
}
protected override void Start()
{
FiePostProcessContainer[] array = UnityEngine.Object.FindObjectsOfType<FiePostProcessContainer>();
if (array != null || array.Length > 0)
{
FiePostProcessContainer[] array2 = array;
foreach (FiePostProcessContainer fiePostProcessContainer in array2)
{
fiePostProcessContainer.AttachPostProcessEffect(base.gameObject);
}
}
base.Start();
if (array != null || array.Length > 0)
{
FiePostProcessContainer[] array3 = array;
foreach (FiePostProcessContainer fiePostProcessContainer2 in array3)
{
fiePostProcessContainer2.PostHook(base.gameObject);
}
}
FieManagerBehaviour<FieInGameStateManager>.I.RetryEvent += I_RetryEvent;
}
private void I_RetryEvent()
{
SetCameraTask<FieGameCameraTaskStop>();
}
public void InitTargetMakerScreenPos()
{
tagetMakerScreenPos = new Vector3((float)Screen.width * 0.5f, (float)Screen.height * 0.5f, 0f);
}
public void AddTargetMakerScreenPos(Vector3 additionalScreenVector)
{
SetTargetMakerScreenPos(tagetMakerScreenPos + additionalScreenVector);
}
public void SetTargetMakerScreenPos(Vector3 newScreenPosition)
{
tagetMakerScreenPos.x = Mathf.Clamp(newScreenPosition.x, (float)Screen.width * 0.05f, (float)Screen.width * 0.95f);
tagetMakerScreenPos.y = Mathf.Clamp(newScreenPosition.y, (float)Screen.height * 0.1f, (float)Screen.height * 0.9f);
}
public override void setCameraOwner(FieGameCharacter owner)
{
base.setCameraOwner(owner);
if (base.cameraOwner != null)
{
base.cameraOwner.detector.targetChangedEvent += Detector_targetChangeEvent;
base.cameraOwner.detector.completelyMissedEvent += Detector_completelyMissedEvent;
_currentHp = (_currentAnimatinoHp = base.cameraOwner.healthStats.hitPoint);
_maxHp = base.cameraOwner.healthStats.maxHitPoint;
}
}
private void OnDestroy()
{
if (base.cameraOwner != null)
{
base.cameraOwner.detector.targetChangedEvent -= Detector_targetChangeEvent;
base.cameraOwner.detector.completelyMissedEvent -= Detector_completelyMissedEvent;
}
}
public void SetCameraTask<T>(float transitionTime = 0f) where T : FieGameCameraTaskBase, new()
{
if (nowTaskObject == null)
{
lastCameraTargetPos = (nowCameraTargetPos = base.transform.position);
lastCameraTargetRotation = (nowCameraTargetRotation = base.transform.rotation);
}
else
{
nowTaskObject.Terminate(this);
}
nowTaskObject = new T();
nowTaskObject.Initialize(this);
if (transitionTime > 0f)
{
_transitionAlphaTweener.InitTweener(transitionTime, 0f, 1f);
}
beforeTaskChangedTargetPos = lastCameraTargetPos;
beforeTaskChangedTargetRotation = lastCameraTargetRotation;
}
public FieGameCameraTaskBase GetCameraTask()
{
return nowTaskObject;
}
private void Detector_targetChangeEvent(FieGameCharacter fromCharacter, FieGameCharacter toCharacter)
{
if (nowTaskObject != null)
{
nowTaskObject.TargetChanged(this, fromCharacter, toCharacter);
}
}
private void Detector_completelyMissedEvent(FieGameCharacter targetCharacter)
{
if (nowTaskObject != null)
{
nowTaskObject.TargetChanged(this, null, null);
}
}
private void LateUpdate()
{
if (nowTaskObject != null)
{
nowTaskObject.CameraUpdate(this);
if (_currentHp != base.cameraOwner.healthStats.hitPoint)
{
_damageTweener.InitTweener(0.5f, _currentHp, base.cameraOwner.healthStats.hitPoint);
_currentHp = base.cameraOwner.healthStats.hitPoint;
}
if (!_damageTweener.IsEnd())
{
setDamageEffect(_damageTweener.UpdateParameterFloat(Time.deltaTime), _maxHp);
}
if (_cameraWiggler != null)
{
_wiggleRange = _cameraWiggler.UpdateWiggler(Time.deltaTime);
}
if (!_transitionAlphaTweener.IsEnd())
{
transitionAlpha = _transitionAlphaTweener.UpdateParameterFloat(Time.deltaTime);
}
lastCameraTargetPos = Vector3.Lerp(beforeTaskChangedTargetPos, nowCameraTargetPos, transitionAlpha);
lastCameraTargetRotation = Quaternion.Lerp(beforeTaskChangedTargetRotation, nowCameraTargetRotation, transitionAlpha);
if (_cameraOffset != null)
{
updateCameraOffset(_cameraOffset);
}
base.transform.position = lastCameraTargetPos + _wiggleRange + currentOffsetParam.position;
base.transform.rotation = lastCameraTargetRotation * Quaternion.Euler(currentOffsetParam.angle);
base.camera.fieldOfView = _lastCameraFov + currentOffsetParam.fov;
}
}
private void updateCameraOffset(FieCameraOffset offset)
{
if (!offset.isEnd())
{
currentOffsetParam = offset.updateParams(Time.deltaTime);
}
}
private void setDamageEffect(float nowHp, float maxHp)
{
if (!(maxHp <= 0f))
{
float num = Mathf.Max(0f, nowHp - (maxHp - nowHp) * 1f);
float num2 = Mathf.Min(num / maxHp, 1f);
if (_colorCorrectionEffect != null)
{
_colorCorrectionEffect.Amount = 0.4f - 0.4f * num2;
}
if (_vignetteEffect != null)
{
_vignetteEffect.Darkness = 20f - 20f * num2;
}
if (_reverbFilter != null)
{
_reverbFilter.dryLevel = -1000f - -1000f * num2;
_reverbFilter.decayTime = 2f - 2f * num2;
_reverbFilter.decayHFRatio = 1f - 1f * num2;
_reverbFilter.roomHF = 1000f * num2;
_reverbFilter.roomLF = 500f * num2;
_reverbFilter.reverbLevel = 100f - 100f * num2;
_reverbFilter.reverbDelay = 0.1f - 0.1f * num2;
}
}
}
public void setWiggler(Wiggler.WiggleTemplate template)
{
_cameraWiggler = new Wiggler(base.transform.rotation * Vector3.forward, template);
}
public void setWiggler(float totalTime, int wiggleCount, Vector3 wiggleScale)
{
_cameraWiggler = new Wiggler(base.transform.rotation * Vector3.forward, totalTime, wiggleCount, wiggleScale);
}
public void setOffsetTransition(FieGameCharacter callCharacter, FieCameraOffset offset, bool isOwnerOnly = true)
{
if (!(callCharacter == null) && offset != null && (!isOwnerOnly || isCameraOwner(callCharacter)))
{
_cameraOffset = offset;
}
}
public bool existsTargetEnemy()
{
if (base.cameraOwner.detector.lockonTargetObject != null)
{
return true;
}
return false;
}
}
}

View file

@ -0,0 +1,38 @@
using Colorful;
using Fie.LevelObject;
using UnityEngine;
namespace Fie.Camera
{
public class FieGameCameraEverfreeVignette : MonoBehaviour
{
[SerializeField]
private float maximumVignetteDistance = 20f;
[SerializeField]
private float minimumVignetteDistance = 10f;
private FastVignette _vignette;
private FieGameCamera _gameCmaera;
private FieLevelObjectGlowInsect _insect;
private void Start()
{
_vignette = base.gameObject.GetComponent<FastVignette>();
_gameCmaera = base.gameObject.GetComponent<FieGameCamera>();
_insect = UnityEngine.Object.FindObjectOfType<FieLevelObjectGlowInsect>();
}
private void Update()
{
if (!(_vignette == null) && !(_gameCmaera == null) && !(_gameCmaera.cameraOwner == null))
{
Vector3 vector = _gameCmaera.camera.WorldToScreenPoint(_gameCmaera.cameraOwner.centerTransform.position);
_vignette.Center = new Vector2(vector.x / (float)Screen.width, vector.y / (float)Screen.height);
_vignette.Darkness = 100f * Mathf.Clamp((Vector3.Distance(_gameCmaera.cameraOwner.centerTransform.position, _insect.transform.position) - minimumVignetteDistance) / maximumVignetteDistance, 0f, 1f);
}
}
}
}

View file

@ -0,0 +1,23 @@
namespace Fie.Camera
{
public abstract class FieGameCameraTaskBase
{
public virtual void Initialize(FieGameCamera gameCamera)
{
}
public virtual void Terminate(FieGameCamera gameCamera)
{
}
public virtual void TargetChanged(FieGameCamera gameCamera, FieGameCharacter fromCharacter, FieGameCharacter toCharacter)
{
}
public virtual void TargetMissed(FieGameCamera gameCamera)
{
}
public abstract void CameraUpdate(FieGameCamera gameCamera);
}
}

View file

@ -0,0 +1,55 @@
using Fie.Manager;
using UnityEngine;
namespace Fie.Camera
{
public class FieGameCameraTaskHorming : FieGameCameraTaskBase
{
private Vector3 _hormingAncher = Vector3.zero;
private float latestHormingDistance;
private float targetHightOffset;
private const float CAMERA_UPPER_DIRECTION_OFFSET_ANGLE_X = -4.5f;
public override void Initialize(FieGameCamera gameCamera)
{
_hormingAncher = gameCamera.nowCameraTargetPos;
}
public override void TargetChanged(FieGameCamera gameCamera, FieGameCharacter fromCharacter, FieGameCharacter toCharacter)
{
gameCamera.SetCameraTask<FieGameCameraTaskLockOn>(0.75f);
}
public override void CameraUpdate(FieGameCamera gameCamera)
{
if (!(gameCamera.cameraOwner == null))
{
Vector3 defaultCameraOffset = FieManagerBehaviour<FieGameCameraManager>.I.getDefaultCameraOffset();
Vector3 groundPosition = gameCamera.cameraOwner.groundPosition;
float x = groundPosition.x + defaultCameraOffset.x;
Vector3 groundPosition2 = gameCamera.cameraOwner.groundPosition;
float y = groundPosition2.y + defaultCameraOffset.y;
Vector3 groundPosition3 = gameCamera.cameraOwner.groundPosition;
gameCamera.nowCameraTargetPos = new Vector3(x, y, groundPosition3.z + defaultCameraOffset.z);
Vector3 groundPosition4 = gameCamera.cameraOwner.groundPosition;
Vector3 a = new Vector3(0f, groundPosition4.y, 0f);
Vector3 position = gameCamera.cameraOwner.transform.position;
float b = -4.5f * Vector3.Distance(a, new Vector3(0f, position.y, 0f));
targetHightOffset = Mathf.Lerp(targetHightOffset, b, 1f * Time.deltaTime);
gameCamera.nowCameraTargetRotation = Quaternion.Euler(FieManagerBehaviour<FieGameCameraManager>.I.getDefaultCameraRotation() + new Vector3(targetHightOffset, 0f, 0f));
float num = Vector3.Distance(new Vector3(_hormingAncher.x, gameCamera.nowCameraTargetPos.y, gameCamera.nowCameraTargetPos.z), gameCamera.nowCameraTargetPos);
if (num < latestHormingDistance)
{
gameCamera.SetCameraTask<FieGameCameraTaskStop>(1f);
}
else
{
latestHormingDistance = num;
}
}
}
}
}

View file

@ -0,0 +1,108 @@
using Fie.Manager;
using UnityEngine;
namespace Fie.Camera
{
public class FieGameCameraTaskLockOn : FieGameCameraTaskBase
{
public const float DEFAULT_LOCKON_TRASITION_TIME = 0.75f;
private const float MAXIMUM_LOCKON_DISTANCE = 6f;
private Vector3 _hormingAncher = Vector3.zero;
private float latestHormingDistance;
private float targetHightOffset;
public bool isCameraHorming = true;
private const float CAMERA_UPPER_DIRECTION_OFFSET_ANGLE_X = -4.5f;
public override void Initialize(FieGameCamera gameCamera)
{
_hormingAncher = gameCamera.nowCameraTargetPos;
}
public override void Terminate(FieGameCamera gameCamera)
{
gameCamera.InitTargetMakerScreenPos();
}
public override void TargetChanged(FieGameCamera gameCamera, FieGameCharacter fromCharacter, FieGameCharacter toCharacter)
{
if (isCameraHorming)
{
gameCamera.SetCameraTask<FieGameCameraTaskLockOn>(0.75f);
}
}
public override void TargetMissed(FieGameCamera gameCamera)
{
gameCamera.SetCameraTask<FieGameCameraTaskStop>(1f);
}
public override void CameraUpdate(FieGameCamera gameCamera)
{
if (!(gameCamera.cameraOwner == null))
{
if (isCameraHorming)
{
if (gameCamera.cameraOwner.detector.lockonTargetObject == null || gameCamera.cameraOwner.detector.lockonTargetObject.transform == null)
{
gameCamera.SetCameraTask<FieGameCameraTaskStop>(1f);
}
else
{
float num = 0f;
float num2 = Vector3.Distance(gameCamera.cameraOwner.detector.lockonTargetObject.centerTransform.position, gameCamera.cameraOwner.centerTransform.position);
if (num2 > 6f)
{
num = Mathf.Min((num2 - 6f) * 1f, 2f);
}
Vector3 vector = Vector3.Lerp(gameCamera.cameraOwner.transform.position, gameCamera.cameraOwner.detector.lockonTargetObject.position, 0.5f);
Vector3 defaultCameraOffset = FieManagerBehaviour<FieGameCameraManager>.I.getDefaultCameraOffset();
Vector3 nowCameraTargetPos = gameCamera.nowCameraTargetPos;
float x = vector.x + defaultCameraOffset.x;
Vector3 groundPosition = gameCamera.cameraOwner.groundPosition;
float y = groundPosition.y + defaultCameraOffset.y;
Vector3 groundPosition2 = gameCamera.cameraOwner.groundPosition;
gameCamera.nowCameraTargetPos = Vector3.Lerp(nowCameraTargetPos, new Vector3(x, y, groundPosition2.z + defaultCameraOffset.z - num), 3f * Time.deltaTime);
gameCamera.tagetMakerScreenPos = gameCamera.camera.WorldToScreenPoint(gameCamera.cameraOwner.detector.lockonTargetObject.centerTransform.position);
Vector3 groundPosition3 = gameCamera.cameraOwner.groundPosition;
Vector3 a = new Vector3(0f, groundPosition3.y, 0f);
Vector3 position = gameCamera.cameraOwner.transform.position;
float b = -4.5f * Vector3.Distance(a, new Vector3(0f, position.y, 0f));
targetHightOffset = Mathf.Lerp(targetHightOffset, b, 1f * Time.deltaTime);
gameCamera.nowCameraTargetRotation = Quaternion.Euler(FieManagerBehaviour<FieGameCameraManager>.I.getDefaultCameraRotation() + new Vector3(targetHightOffset, 0f, 0f));
}
}
else
{
Vector3 vector2 = gameCamera.camera.ScreenToWorldPoint(gameCamera.tagetMakerScreenPos);
Vector3 position2 = gameCamera.cameraOwner.transform.position;
vector2.z = position2.z;
float num3 = 0f;
float num4 = Vector3.Distance(vector2, gameCamera.cameraOwner.centerTransform.position);
if (num4 > 6f)
{
num3 = Mathf.Min((num4 - 6f) * 1f, 4f);
}
Vector3 vector3 = Vector3.Lerp(gameCamera.cameraOwner.transform.position, vector2, 0.5f);
Vector3 defaultCameraOffset2 = FieManagerBehaviour<FieGameCameraManager>.I.getDefaultCameraOffset();
Vector3 nowCameraTargetPos2 = gameCamera.nowCameraTargetPos;
float x2 = vector3.x + defaultCameraOffset2.x;
Vector3 groundPosition4 = gameCamera.cameraOwner.groundPosition;
float y2 = groundPosition4.y + defaultCameraOffset2.y;
Vector3 groundPosition5 = gameCamera.cameraOwner.groundPosition;
gameCamera.nowCameraTargetPos = Vector3.Lerp(nowCameraTargetPos2, new Vector3(x2, y2, groundPosition5.z + defaultCameraOffset2.z - num3), 4f * Time.deltaTime);
Vector3 groundPosition6 = gameCamera.cameraOwner.groundPosition;
float b2 = -4.5f * Vector3.Distance(new Vector3(0f, groundPosition6.y, 0f), new Vector3(0f, vector2.y, 0f));
targetHightOffset = Mathf.Lerp(targetHightOffset, b2, 2f * Time.deltaTime);
gameCamera.nowCameraTargetRotation = Quaternion.Euler(FieManagerBehaviour<FieGameCameraManager>.I.getDefaultCameraRotation() + new Vector3(targetHightOffset * 0.5f, 0f, 0f));
float num5 = latestHormingDistance = Vector3.Distance(new Vector3(_hormingAncher.x, gameCamera.nowCameraTargetPos.y, gameCamera.nowCameraTargetPos.z), gameCamera.nowCameraTargetPos);
}
}
}
}
}

View file

@ -0,0 +1,84 @@
using Fie.Manager;
using UnityEngine;
namespace Fie.Camera
{
public class FieGameCameraTaskStop : FieGameCameraTaskBase
{
private const float CAMERA_MAX_HORIZONTAL_DISTANCE = 3.5f;
private const float CAMERA_MAX_FORWARD_DISTANCE = 7f;
private const float CAMERA_MAX_VIRTICAL_DISTANCE = 1.5f;
private const float CAMERA_UPPER_DIRECTION_OFFSET_ANGLE_X = -4.5f;
private Vector3 initedPos = Vector3.zero;
private Quaternion initedRotation = Quaternion.identity;
private float targetHightOffset;
public override void Initialize(FieGameCamera gameCamera)
{
Vector3 defaultCameraOffset = FieManagerBehaviour<FieGameCameraManager>.I.getDefaultCameraOffset();
Vector3 defaultCameraRotation = FieManagerBehaviour<FieGameCameraManager>.I.getDefaultCameraRotation();
if (gameCamera.cameraOwner != null)
{
Vector3 groundPosition = gameCamera.cameraOwner.groundPosition;
float x = groundPosition.x + defaultCameraOffset.x;
Vector3 groundPosition2 = gameCamera.cameraOwner.groundPosition;
float y = groundPosition2.y + defaultCameraOffset.y;
Vector3 groundPosition3 = gameCamera.cameraOwner.groundPosition;
gameCamera.nowCameraTargetPos = new Vector3(x, y, groundPosition3.z + defaultCameraOffset.z);
gameCamera.nowCameraTargetRotation = Quaternion.Euler(defaultCameraRotation);
}
initedPos = gameCamera.nowCameraTargetPos;
initedRotation = gameCamera.nowCameraTargetRotation;
}
public override void TargetChanged(FieGameCamera gameCamera, FieGameCharacter fromCharacter, FieGameCharacter toCharacter)
{
gameCamera.SetCameraTask<FieGameCameraTaskLockOn>(0.75f);
}
public override void CameraUpdate(FieGameCamera gameCamera)
{
if (!(gameCamera.cameraOwner == null))
{
Vector3 a = new Vector3(gameCamera.nowCameraTargetPos.x, 0f, 0f);
Vector3 groundPosition = gameCamera.cameraOwner.groundPosition;
float num = Vector3.Distance(a, new Vector3(groundPosition.x, 0f, 0f));
Vector3 a2 = new Vector3(0f, 0f, gameCamera.nowCameraTargetPos.z);
Vector3 groundPosition2 = gameCamera.cameraOwner.groundPosition;
float num2 = Vector3.Distance(a2, new Vector3(0f, 0f, groundPosition2.z));
if (num > 3.5f || num2 > 7f)
{
gameCamera.SetCameraTask<FieGameCameraTaskHorming>(1f);
}
else
{
Vector3 vector = gameCamera.camera.WorldToScreenPoint(gameCamera.cameraOwner.guiPointTransform.position);
if (vector.x <= 0f || vector.y <= 0f || vector.x > (float)Screen.width || vector.y > (float)Screen.height)
{
gameCamera.SetCameraTask<FieGameCameraTaskHorming>(1f);
}
else
{
Vector3 defaultCameraOffset = FieManagerBehaviour<FieGameCameraManager>.I.getDefaultCameraOffset();
Vector3 nowCameraTargetPos = gameCamera.nowCameraTargetPos;
float x = initedPos.x;
Vector3 groundPosition3 = gameCamera.cameraOwner.groundPosition;
gameCamera.nowCameraTargetPos = Vector3.Lerp(nowCameraTargetPos, new Vector3(x, groundPosition3.y + defaultCameraOffset.y, initedPos.z), 0.5f * Time.deltaTime);
Vector3 groundPosition4 = gameCamera.cameraOwner.groundPosition;
Vector3 a3 = new Vector3(0f, groundPosition4.y, 0f);
Vector3 position = gameCamera.cameraOwner.transform.position;
float b = -4.5f * Vector3.Distance(a3, new Vector3(0f, position.y, 0f));
targetHightOffset = Mathf.Lerp(targetHightOffset, b, 1f * Time.deltaTime);
gameCamera.nowCameraTargetRotation = Quaternion.Euler(FieManagerBehaviour<FieGameCameraManager>.I.getDefaultCameraRotation() + new Vector3(targetHightOffset, 0f, 0f));
}
}
}
}
}
}

View file

@ -0,0 +1,81 @@
using Fie.Utility;
using System.Collections;
using UnityEngine;
namespace Fie.Camera
{
[RequireComponent(typeof(UnityEngine.Camera))]
public class FieSkillTreeCamera : MonoBehaviour
{
private Matrix4x4 ortho;
private Matrix4x4 perspective;
public float fov = 60f;
public float near = 0.3f;
public float far = 1000f;
public float orthographicSize = 50f;
private float aspect;
private bool orthoOn;
private Tweener<TweenTypesInOutSine> _transitionTweener = new Tweener<TweenTypesInOutSine>();
private UnityEngine.Camera _camera;
public UnityEngine.Camera camera => _camera;
public void Awake()
{
_camera = base.gameObject.GetComponent<UnityEngine.Camera>();
aspect = (float)Screen.width / (float)Screen.height;
perspective = _camera.projectionMatrix;
ortho = Matrix4x4.Ortho((0f - orthographicSize) * aspect, orthographicSize * aspect, 0f - orthographicSize, orthographicSize, near, far);
orthoOn = false;
}
public void SetViewMode(bool isOrtho)
{
if (isOrtho)
{
BlendToMatrix(ortho, 0.5f);
}
else
{
BlendToMatrix(perspective, 1f);
}
}
public static Matrix4x4 MatrixLerp(Matrix4x4 from, Matrix4x4 to, float time)
{
Matrix4x4 result = default(Matrix4x4);
for (int i = 0; i < 16; i++)
{
result[i] = Mathf.Lerp(from[i], to[i], time);
}
return result;
}
private IEnumerator LerpFromTo(Matrix4x4 src, Matrix4x4 dest, float duration)
{
_transitionTweener.InitTweener(duration, 0f, 1f);
if (!_transitionTweener.IsEnd())
{
_camera.projectionMatrix = MatrixLerp(src, dest, _transitionTweener.UpdateParameterFloat(Time.deltaTime));
yield return (object)1;
/*Error: Unable to find new state assignment for yield return*/;
}
_camera.projectionMatrix = dest;
}
public Coroutine BlendToMatrix(Matrix4x4 targetMatrix, float duration)
{
StopAllCoroutines();
return StartCoroutine(LerpFromTo(_camera.projectionMatrix, targetMatrix, duration));
}
}
}

View file

@ -0,0 +1,6 @@
namespace Fie.Camera
{
public sealed class FieTitleCamera : FieCameraBase
{
}
}

View file

@ -0,0 +1,91 @@
using UnityEngine;
namespace Fie.Camera
{
public class FieUICamera : FieCameraBase
{
public delegate void ScreenResizeEvent();
private int _latestWidth;
private int _latestHeight;
private FieGameCamera _gameCamera;
private Vector3 leftTopInWorldPosition;
private Vector3 leftBottomInWorldPosition;
private Vector3 rightTopInWorldPosition;
private Vector3 rightBottomInWorldPosition;
private float _screenHeight;
private float _screenWidth;
private float _uiWorldHeight;
private float _uiWorldWidth;
public event ScreenResizeEvent screenResizeEvent;
protected override void Start()
{
base.Start();
InitializeUICameraResolution();
}
private void LateUpdate()
{
if (Screen.height != _latestHeight || Screen.width != _latestWidth)
{
InitializeUICameraResolution();
}
}
private void InitializeUICameraResolution()
{
_screenHeight = (float)Screen.height;
_screenWidth = (float)Screen.width;
leftBottomInWorldPosition = base.camera.ScreenToWorldPoint(Vector3.zero);
leftTopInWorldPosition = base.camera.ScreenToWorldPoint(new Vector3(0f, _screenHeight));
rightBottomInWorldPosition = base.camera.ScreenToWorldPoint(new Vector3(_screenWidth, 0f));
rightTopInWorldPosition = base.camera.ScreenToWorldPoint(new Vector3(_screenWidth, _screenHeight));
_uiWorldHeight = Vector3.Distance(leftBottomInWorldPosition, leftTopInWorldPosition);
_uiWorldWidth = Vector3.Distance(leftBottomInWorldPosition, rightBottomInWorldPosition);
_latestHeight = Screen.height;
_latestWidth = Screen.width;
if (this.screenResizeEvent != null)
{
this.screenResizeEvent();
}
}
public void setGameCamera(FieGameCamera gameChamera)
{
_gameCamera = gameChamera;
}
public Vector3 getPositionInUICameraWorld(Vector3 inGamePosition)
{
if (_gameCamera == null)
{
Debug.Log("game camera didn't assign to ui camera.");
return Vector3.zero;
}
Vector3 vector = _gameCamera.camera.WorldToScreenPoint(inGamePosition);
return new Vector3(leftBottomInWorldPosition.x + _uiWorldWidth * (vector.x / _screenWidth), leftBottomInWorldPosition.y + _uiWorldHeight * (vector.y / _screenHeight));
}
public bool isOnScreen(Vector3 worldPosition, ref Vector3 screenPosition)
{
screenPosition = _gameCamera.camera.WorldToScreenPoint(worldPosition);
if (screenPosition.x < 0f || screenPosition.x > (float)Screen.width || screenPosition.y < 0f || screenPosition.y > (float)Screen.height)
{
return false;
}
return true;
}
}
}

View file

@ -0,0 +1,22 @@
using Fie.Manager;
using Fie.Scene;
using UnityEngine;
namespace Fie.Core
{
public class FieBootstrap : MonoBehaviour
{
private static bool _isBootedFromBootStrap;
public static bool isBootedFromBootStrap => _isBootedFromBootStrap;
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);
UnityEngine.Object.Destroy(base.gameObject);
}
}
}

View file

@ -0,0 +1,67 @@
using Fie.Core;
using Fie.Manager;
using Fie.Scene;
using GameDataEditor;
using System.Collections.Generic;
using UnityEngine;
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.IntelligenceType> _debugCharactersIntelligenceTypes = new List<FieGameCharacter.IntelligenceType>();
[SerializeField]
private List<string> _debugCharactersNames = new List<string>();
[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 Start()
{
FieManagerBehaviour<FieInGameStateManager>.I.StartUp();
}
}
}

View file

@ -0,0 +1,133 @@
using Fie.AI;
using Fie.Manager;
using Fie.Object;
using GameDataEditor;
using System;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.Changeling
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Changeling/Changeling")]
public class FieChangeling : FieEnemiesHoovesRaces
{
public override Type getDefaultAttackState()
{
return typeof(FieStateMachineChangelingBaseAttack);
}
protected new void Awake()
{
base.Awake();
base.animationManager = new FieSkeletonAnimationController(base.skeletonUtility, new FieChangelingAnimationContainer());
base.damageSystem.deathEvent += delegate
{
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingForcesDeadEffect>(base.centerTransform, Vector3.zero, null);
UnbindFromDetecter();
if (PhotonNetwork.isMasterClient)
{
PhotonNetwork.Destroy(base.photonView);
}
};
base.damageSystem.addStatusEffectCallback<FieStatusEffectsRiftEntity>(ApplyStatusEffect_ChangelingsCommonRift);
base.damageSystem.addStatusEffectCallback<FieStatusEffectsPullEntity>(ApplyStatusEffect_ChangelingsCommonPull);
PreAssignEmittableObject<FieEmitObjectChangelingBite>();
PreAssignEmittableObject<FieEmitObjectChangelingShot>();
PreAssignEmittableObject<FieEmitObjectChangelingHitEffectSmall>();
PreAssignEmittableObject<FieEmitObjectChangelingBiteHitEffect>();
PreAssignEmittableObject<FieEmitObjectChangelingVortex>();
PreAssignEmittableObject<FieEmitObjectChangelingForcesArrivalParticleEffect>();
PreAssignEmittableObject<FieEmitObjectChangelingForcesArrivalFireEffect>();
PreAssignEmittableObject<FieEmitObjectChangelingForcesDeadEffect>();
}
private void ApplyStatusEffect_ChangelingsCommonRift(FieStatusEffectEntityBase statusEffectObject, FieGameCharacter attacker, FieDamage damage)
{
if (damage.statusEffects.Count > 0)
{
foreach (FieStatusEffectEntityBase statusEffect in damage.statusEffects)
{
FieStatusEffectsRiftEntity fieStatusEffectsRiftEntity = statusEffect as FieStatusEffectsRiftEntity;
if (fieStatusEffectsRiftEntity != null && healthStats.stagger + damage.stagger >= healthStats.staggerResistance)
{
FieStateMachineEnemiesHoovesRacesRift fieStateMachineEnemiesHoovesRacesRift = setStateToStatheMachine(typeof(FieStateMachineEnemiesHoovesRacesRift), isForceSet: true, isDupulicate: true) as FieStateMachineEnemiesHoovesRacesRift;
if (fieStateMachineEnemiesHoovesRacesRift != null)
{
fieStateMachineEnemiesHoovesRacesRift.ResetMoveForce(fieStatusEffectsRiftEntity.resetMoveForce);
fieStateMachineEnemiesHoovesRacesRift.SetRiftForceRate(fieStatusEffectsRiftEntity.riftForceRate);
}
damage.stagger = 0f;
healthStats.stagger = 0f;
}
}
}
}
private void ApplyStatusEffect_ChangelingsCommonPull(FieStatusEffectEntityBase statusEffectObject, FieGameCharacter attacker, FieDamage damage)
{
if (damage.statusEffects.Count > 0)
{
foreach (FieStatusEffectEntityBase statusEffect in damage.statusEffects)
{
FieStatusEffectsPullEntity fieStatusEffectsPullEntity = statusEffect as FieStatusEffectsPullEntity;
if (fieStatusEffectsPullEntity != null)
{
FieStateMachineStatusEffectPull fieStateMachineStatusEffectPull = setStateToStatheMachine(typeof(FieStateMachineStatusEffectPull), isForceSet: true, isDupulicate: true) as FieStateMachineStatusEffectPull;
if (fieStateMachineStatusEffectPull != null)
{
fieStateMachineStatusEffectPull.setPullPoint(fieStatusEffectsPullEntity.pullPosition);
fieStateMachineStatusEffectPull.setDuration(fieStatusEffectsPullEntity.pullDuration);
}
damage.stagger = 0f;
}
}
}
}
protected new void Start()
{
base.Start();
base.isEnableAutoFlip = false;
base.animationManager.SetAnimation(0, isLoop: true);
}
public override string getDefaultName()
{
return FieLocalizeUtility.GetConstantText(GDEItemKeys.ConstantTextList_ENEMY_NAME_CHANGELING);
}
public override FieConstValues.FieGameCharacter getGameCharacterID()
{
return FieConstValues.FieGameCharacter.CHANGELING;
}
public override Type getDefaultAITask()
{
return typeof(FieAITaskChangelingIdle);
}
public virtual int getBackStepAnimationID()
{
return 13;
}
public virtual int getArrivalAnimationID()
{
return 15;
}
public override void RequestArrivalState()
{
RequestToChangeState<FieStateMachineChangelingArrival>(Vector3.zero, 0f, StateMachineType.Base);
}
public override GDEEnemyTableData GetEnemyMasterData()
{
return FieMasterData<GDEEnemyTableData>.I.GetMasterData(GDEItemKeys.EnemyTable_ENEMY_TABLE_CHANGELING);
}
public override FieConstValues.FieEnemy GetEnemyMasterDataID()
{
return FieConstValues.FieEnemy.ENEMY_TABLE_CHANGELING;
}
}
}

View file

@ -0,0 +1,34 @@
using Fie.Object;
namespace Fie.Enemies.HoovesRaces.Changeling
{
public class FieChangelingAnimationContainer : FieEnemiesHoovesRacesAnimationContainer
{
public enum ChangelingAnimationList
{
JUMP = 8,
JUMP_LANDING,
FALL,
MELEE,
SHOOT,
BACK_STEP,
VORTEX,
ARRIVAL,
EMOTION_NORMAL,
MAX_CHANGELING_ANIMATION
}
public FieChangelingAnimationContainer()
{
addAnimationData(8, new FieSkeletonAnimationObject(0, "jump_idle"));
addAnimationData(9, new FieSkeletonAnimationObject(0, "jump_end_shallow"));
addAnimationData(10, new FieSkeletonAnimationObject(0, "fall"));
addAnimationData(11, new FieSkeletonAnimationObject(0, "melee"));
addAnimationData(12, new FieSkeletonAnimationObject(0, "shoot"));
addAnimationData(13, new FieSkeletonAnimationObject(0, "backstep"));
addAnimationData(14, new FieSkeletonAnimationObject(0, "vortex"));
addAnimationData(15, new FieSkeletonAnimationObject(0, "arrival"));
addAnimationData(16, new FieSkeletonAnimationObject(1, "emotion_normal"));
}
}
}

View file

@ -0,0 +1,51 @@
using Fie.Manager;
using Fie.Object;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.Changeling
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Changeling/Power/ChangelingBite")]
public class FieEmitObjectChangelingBite : FieEmittableObjectBase
{
[SerializeField]
private float CHANGELING_BITE_DURATION = 0.4f;
[SerializeField]
private float CHANGELING_BITE_DAMAGE_DURATION = 0.3f;
private float _lifeTimeCount;
private bool _isEndTrail;
private bool _isEndUpdate;
public void Update()
{
if (!_isEndUpdate)
{
_lifeTimeCount += Time.deltaTime;
if (_lifeTimeCount >= CHANGELING_BITE_DURATION)
{
_isEndUpdate = true;
destoryEmitObject();
}
if (initTransform != null)
{
base.transform.position = initTransform.position;
}
}
}
private void OnTriggerEnter(Collider collider)
{
if (!_isEndUpdate && !(_lifeTimeCount > CHANGELING_BITE_DAMAGE_DURATION) && collider.gameObject.tag == getHostileTagString())
{
FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject());
if (x != null)
{
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingBiteHitEffect>(base.transform, Vector3.zero);
}
}
}
}
}

View file

@ -0,0 +1,15 @@
using Fie.Object;
namespace Fie.Enemies.HoovesRaces.Changeling
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Changeling/Power/ChangelingBiteHitEffect")]
public class FieEmitObjectChangelingBiteHitEffect : FieEmittableObjectBase
{
private const float DURATION = 1f;
public override void awakeEmitObject()
{
destoryEmitObject(1f);
}
}
}

View file

@ -0,0 +1,15 @@
using Fie.Object;
namespace Fie.Enemies.HoovesRaces.Changeling
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Changeling/Power/ChangelingHitEffectSmall")]
public class FieEmitObjectChangelingHitEffectSmall : FieEmittableObjectBase
{
private const float DURATION = 1f;
public override void awakeEmitObject()
{
destoryEmitObject(1f);
}
}
}

View file

@ -0,0 +1,115 @@
using Fie.Manager;
using Fie.Object;
using Fie.Utility;
using PigeonCoopToolkit.Effects.Trails;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.Changeling
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Changeling/Power/ChangelingShot")]
public class FieEmitObjectChangelingShot : FieEmittableObjectBase
{
[SerializeField]
private float CHANGELING_SINGLE_SHOT_DURATION = 2f;
[SerializeField]
private float CHANGELING_SINGLE_SHOT_VELOCITY_MAX = 2f;
[SerializeField]
private float CHANGELING_SINGLE_SHOT_VELOCITY_ACCEL_TIME = 2f;
[SerializeField]
private float CHANGELING_SINGLE_SHOT_DESTORY_DURATION = 0.7f;
[SerializeField]
private GameObject cilinder;
[SerializeField]
private SmoothTrail trail;
private const float HORMING_DISTANCE_MAX = 10f;
private Tweener<TweenTypesInSine> _velocityTweener = new Tweener<TweenTypesInSine>();
private Tweener<TweenTypesOutSine> _scaleTweener = new Tweener<TweenTypesOutSine>();
private Vector3 _velocityVec = Vector3.zero;
private Vector3 _scale = Vector3.zero;
private Vector3 _additionalVelocity = Vector3.zero;
private Vector3 _initDirectionalVec = Vector3.zero;
private float _lifeTimeCount;
private bool _isEndUpdate;
private Vector3 _initEffectModelScale = Vector3.zero;
public void Awake()
{
_initEffectModelScale = cilinder.transform.localScale;
}
public override void awakeEmitObject()
{
_velocityTweener.InitTweener(CHANGELING_SINGLE_SHOT_VELOCITY_ACCEL_TIME, 0f, CHANGELING_SINGLE_SHOT_VELOCITY_MAX);
_scaleTweener.InitTweener(CHANGELING_SINGLE_SHOT_VELOCITY_ACCEL_TIME, Vector3.zero, Vector3.one);
_initDirectionalVec = directionalVec;
if (targetTransform != null)
{
_initDirectionalVec = (targetTransform.position - base.transform.position).normalized;
}
directionalVec = _initDirectionalVec;
cilinder.transform.localScale = _initEffectModelScale;
trail.ClearSystem(emitState: true);
}
public void setAdditionalVelocity(Vector3 additionalVelocity)
{
_additionalVelocity = additionalVelocity;
}
public void Update()
{
if (!_isEndUpdate)
{
Vector3 vector = directionalVec * _velocityTweener.UpdateParameterFloat(Time.deltaTime);
base.transform.position += vector;
base.transform.localScale = _scaleTweener.UpdateParameterVec3(Time.deltaTime);
_lifeTimeCount += Time.deltaTime;
if (_lifeTimeCount >= CHANGELING_SINGLE_SHOT_DURATION)
{
destoryEmitObject(CHANGELING_SINGLE_SHOT_DESTORY_DURATION);
trail.Emit = false;
trail.ClearSystem(emitState: false);
cilinder.transform.localScale = Vector3.zero;
_isEndUpdate = true;
}
base.transform.rotation = Quaternion.LookRotation(vector);
}
}
private void OnTriggerEnter(Collider collider)
{
if (!_isEndUpdate && (collider.gameObject.tag == getHostileTagString() || collider.gameObject.tag == "Floor"))
{
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingHitEffectSmall>(base.transform, Vector3.zero);
addDamageToCollisionCharacter(collider, getDefaultDamageObject());
trail.Emit = false;
destoryEmitObject(CHANGELING_SINGLE_SHOT_DESTORY_DURATION);
cilinder.transform.localScale = Vector3.zero;
_isEndUpdate = true;
}
}
private void OnDisable()
{
if (trail != null)
{
trail.ClearSystem(emitState: false);
}
}
}
}

View file

@ -0,0 +1,54 @@
using Fie.Manager;
using Fie.Object;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.Changeling
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Changeling/Power/ChangelingVortex")]
public class FieEmitObjectChangelingVortex : FieEmittableObjectBase
{
[SerializeField]
private float VortexDuration = 1f;
[SerializeField]
private float VortexDamageDuration = 0.75f;
private float _lifeTimeCount;
private bool _isEndUpdate;
public void Update()
{
if (!_isEndUpdate)
{
_lifeTimeCount += Time.deltaTime;
if (_lifeTimeCount >= VortexDuration)
{
_isEndUpdate = true;
destoryEmitObject();
}
if (initTransform != null)
{
base.transform.position = initTransform.position;
}
}
}
private void OnTriggerEnter(Collider collider)
{
if (!_isEndUpdate && !(_lifeTimeCount > VortexDamageDuration) && collider.gameObject.tag == getHostileTagString())
{
FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject());
if (x != null)
{
Vector3 position = collider.ClosestPointOnBounds(base.transform.position);
FieEmitObjectChangelingBiteHitEffect fieEmitObjectChangelingBiteHitEffect = FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingBiteHitEffect>(base.transform, Vector3.zero);
if (fieEmitObjectChangelingBiteHitEffect != null)
{
fieEmitObjectChangelingBiteHitEffect.transform.position = position;
}
}
}
}
}
}

View file

@ -0,0 +1,97 @@
using Fie.Manager;
using Fie.Object;
using Fie.Utility;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.Changeling
{
public class FieStateMachineChangelingArrival : FieStateMachineGameCharacterBase
{
private enum ArrivalState
{
ARRIVAL_START,
ARRIVING,
ARRIVAL_END
}
private const float POSITION_INITIALIZE_TIME = 0.75f;
private Tweener<TweenTypesInSine> positionTweener = new Tweener<TweenTypesInSine>();
private ArrivalState _arrivalState;
private bool _isEnd;
private FieEmitObjectChangelingForcesArrivalParticleEffect _arriveEffect;
public override void initialize(FieGameCharacter gameCharacter)
{
if (!(gameCharacter == null))
{
gameCharacter.isEnableCollider = false;
gameCharacter.isEnableGravity = true;
gameCharacter.isEnableAutoFlip = false;
gameCharacter.skeletonUtility.skeletonRenderer.meshRenderer.enabled = false;
}
}
public override void terminate(FieGameCharacter gameCharacter)
{
if (!(gameCharacter == null))
{
gameCharacter.isEnableCollider = true;
gameCharacter.isEnableGravity = true;
gameCharacter.isEnableAutoFlip = true;
gameCharacter.skeletonUtility.skeletonRenderer.meshRenderer.enabled = true;
if (_arriveEffect != null)
{
_arriveEffect.StopEffect();
}
}
}
public override void updateState<T>(ref T gameCharacter)
{
if (!_isEnd && gameCharacter is FieChangeling)
{
FieChangeling fieChangeling = gameCharacter as FieChangeling;
if (!(fieChangeling == null))
{
switch (_arrivalState)
{
case ArrivalState.ARRIVAL_START:
_arrivalState = ArrivalState.ARRIVING;
fieChangeling.position += Vector3.up * 3f;
fieChangeling.groundState = FieObjectGroundState.Flying;
_arriveEffect = FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingForcesArrivalParticleEffect>(fieChangeling.centerTransform, Vector3.zero, null);
break;
case ArrivalState.ARRIVING:
if (fieChangeling.groundState == FieObjectGroundState.Grounding)
{
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingForcesArrivalFireEffect>(fieChangeling.transform, Vector3.zero, null);
_isEnd = true;
}
break;
}
}
}
}
public override bool isEnd()
{
return _isEnd;
}
public override Type getNextState()
{
return typeof(FieStateMachineCommonIdle);
}
public override List<Type> getAllowedStateList()
{
return new List<Type>();
}
}
}

View file

@ -0,0 +1,104 @@
using Fie.Object;
using Spine;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.Changeling
{
public class FieStateMachineChangelingBackstep : FieStateMachineGameCharacterBase
{
private enum StepState
{
STEP_START,
STEPPING
}
private StepState _stepState;
private bool _isEnd;
public override void initialize(FieGameCharacter gameCharacter)
{
FieChangeling fieChangeling = gameCharacter as FieChangeling;
if (!(fieChangeling == null))
{
autoFlipToEnemy(fieChangeling);
fieChangeling.isEnableAutoFlip = false;
}
}
public override void terminate(FieGameCharacter gameCharacter)
{
if (!(gameCharacter == null))
{
gameCharacter.isEnableAutoFlip = true;
gameCharacter.isEnableCollider = true;
gameCharacter.damageSystem.isEnableStaggerImmunity = false;
}
}
public override void updateState<T>(ref T gameCharacter)
{
if (gameCharacter is FieChangeling)
{
FieChangeling changeling = gameCharacter as FieChangeling;
if (_stepState == StepState.STEP_START)
{
if (changeling.groundState == FieObjectGroundState.Grounding)
{
TrackEntry trackEntry = changeling.animationManager.SetAnimation(changeling.getBackStepAnimationID(), isLoop: false, isForceSet: true);
if (trackEntry != null)
{
trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e)
{
if (e.Data.Name == "move")
{
Vector3 moveForce = changeling.flipDirectionVector * e.Float;
changeling.setMoveForce(moveForce, 0f, useRound: false);
}
if (e.Data.Name == "finished")
{
_isEnd = true;
}
if (e.Data.Name == "immunity")
{
changeling.isEnableCollider = (e.Int < 1);
changeling.damageSystem.isEnableStaggerImmunity = (e.Int >= 1);
}
};
trackEntry.Complete += delegate
{
_isEnd = true;
};
}
else
{
_isEnd = true;
}
}
else
{
_isEnd = true;
}
_stepState = StepState.STEPPING;
}
}
}
public override bool isEnd()
{
return _isEnd;
}
public override Type getNextState()
{
return typeof(FieStateMachineCommonIdle);
}
public override List<Type> getAllowedStateList()
{
return new List<Type>();
}
}
}

View file

@ -0,0 +1,27 @@
using Fie.Object;
using System;
namespace Fie.Enemies.HoovesRaces.Changeling
{
public class FieStateMachineChangelingBaseAttack : FieStateMachineGameCharacterBase
{
private bool _isEnd;
public override void updateState<T>(ref T gameCharacter)
{
if (gameCharacter is FieChangeling)
{
}
}
public override bool isEnd()
{
return _isEnd;
}
public override Type getNextState()
{
return typeof(FieStateMachineEnemiesAttackIdle);
}
}
}

View file

@ -0,0 +1,119 @@
using Fie.Manager;
using Fie.Object;
using Spine;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.Changeling
{
public class FieStateMachineChangelingMelee : FieStateMachineGameCharacterBase
{
private enum MeleeState
{
MELEE_START,
MELEE
}
private const float MELEE_HORMING_DISTANCE = 1f;
private const float MELEE_HORMING_DEFAULT_RATE = 0.5f;
private MeleeState _meleeState;
private bool _isEnd;
public override void initialize(FieGameCharacter gameCharacter)
{
FieChangeling fieChangeling = gameCharacter as FieChangeling;
if (!(fieChangeling == null))
{
autoFlipToEnemy(fieChangeling);
fieChangeling.isEnableAutoFlip = false;
}
}
public override void terminate(FieGameCharacter gameCharacter)
{
if (!(gameCharacter == null))
{
gameCharacter.isEnableAutoFlip = true;
}
}
public override void updateState<T>(ref T gameCharacter)
{
if (gameCharacter is FieChangeling)
{
FieChangeling changeling = gameCharacter as FieChangeling;
if (_meleeState == MeleeState.MELEE_START)
{
if (changeling.groundState == FieObjectGroundState.Grounding)
{
TrackEntry trackEntry = changeling.animationManager.SetAnimation(11, isLoop: false, isForceSet: true);
if (trackEntry != null)
{
trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e)
{
if (e.Data.Name == "move")
{
Vector3 a = changeling.flipDirectionVector;
Transform lockonEnemyTransform = changeling.detector.getLockonEnemyTransform();
float num = 0.5f;
if (lockonEnemyTransform != null)
{
Vector3 vector = lockonEnemyTransform.position - changeling.transform.position;
num = Mathf.Min(Mathf.Abs(vector.x) / 1f, 1f);
vector.Normalize();
a = vector;
vector.y = 0f;
}
Vector3 vector2 = a * (e.Float * num);
changeling.resetMoveForce();
changeling.setMoveForce(vector2, 0f, useRound: false);
changeling.setFlipByVector(vector2);
}
if (e.Data.Name == "fire")
{
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingBite>(changeling.mouthTransform, changeling.flipDirectionVector, null, changeling);
}
if (e.Data.Name == "finished")
{
_isEnd = true;
}
};
trackEntry.Complete += delegate
{
_isEnd = true;
};
}
else
{
_isEnd = true;
}
}
else
{
_isEnd = true;
}
_meleeState = MeleeState.MELEE;
}
}
}
public override bool isEnd()
{
return _isEnd;
}
public override Type getNextState()
{
return typeof(FieStateMachineCommonIdle);
}
public override List<Type> getAllowedStateList()
{
return new List<Type>();
}
}
}

View file

@ -0,0 +1,77 @@
using Fie.Manager;
using Fie.Object;
using Spine;
using System;
using System.Collections.Generic;
namespace Fie.Enemies.HoovesRaces.Changeling
{
public class FieStateMachineChangelingShoot : FieStateMachineGameCharacterBase
{
private enum ShootState
{
STATE_PREPARE,
STATE_SHOOT
}
private ShootState _shootState;
private bool _isEnd;
public override void initialize(FieGameCharacter gameCharacter)
{
gameCharacter.isEnableAutoFlip = false;
}
public override void updateState<T>(ref T gameCharacter)
{
FieChangeling changeling = gameCharacter as FieChangeling;
if (!(changeling == null))
{
if (changeling.detector.getLockonEnemyTransform() == null)
{
_isEnd = true;
}
else if (_shootState == ShootState.STATE_PREPARE)
{
TrackEntry trackEntry = changeling.animationManager.SetAnimation(12, isLoop: false, isForceSet: true);
if (trackEntry != null)
{
autoFlipToEnemy(changeling);
trackEntry.Event += delegate(AnimationState state, int trackIndex, Event e)
{
if (e.Data.Name == "fire")
{
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingShot>(changeling.hornTransform, changeling.flipDirectionVector, changeling.detector.getLockonEnemyTransform(isCenter: true), changeling);
}
};
trackEntry.Complete += delegate
{
_isEnd = true;
};
}
else
{
_isEnd = true;
}
_shootState = ShootState.STATE_SHOOT;
}
}
}
public override bool isEnd()
{
return _isEnd;
}
public override Type getNextState()
{
return typeof(FieStateMachineCommonIdle);
}
public override List<Type> getAllowedStateList()
{
return new List<Type>();
}
}
}

View file

@ -0,0 +1,96 @@
using Fie.Manager;
using Fie.Object;
using Spine;
using System;
using System.Collections.Generic;
namespace Fie.Enemies.HoovesRaces.Changeling
{
public class FieStateMachineChangelingVortex : FieStateMachineGameCharacterBase
{
private enum MeleeState
{
MELEE_START,
MELEE
}
private MeleeState _meleeState;
private bool _isEnd;
public override void initialize(FieGameCharacter gameCharacter)
{
FieChangeling fieChangeling = gameCharacter as FieChangeling;
if (!(fieChangeling == null))
{
autoFlipToEnemy(fieChangeling);
fieChangeling.isEnableAutoFlip = false;
}
}
public override void terminate(FieGameCharacter gameCharacter)
{
if (!(gameCharacter == null))
{
gameCharacter.isEnableAutoFlip = true;
}
}
public override void updateState<T>(ref T gameCharacter)
{
if (gameCharacter is FieChangeling)
{
FieChangeling changeling = gameCharacter as FieChangeling;
if (_meleeState == MeleeState.MELEE_START)
{
if (changeling.groundState == FieObjectGroundState.Grounding)
{
TrackEntry trackEntry = changeling.animationManager.SetAnimation(14, isLoop: false, isForceSet: true);
if (trackEntry != null)
{
trackEntry.Event += delegate(AnimationState state, int trackIndex, Event e)
{
if (e.Data.Name == "fire")
{
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingVortex>(changeling.transform, changeling.flipDirectionVector, null, changeling);
}
if (e.Data.Name == "finished")
{
_isEnd = true;
}
};
trackEntry.Complete += delegate
{
_isEnd = true;
};
}
else
{
_isEnd = true;
}
}
else
{
_isEnd = true;
}
_meleeState = MeleeState.MELEE;
}
}
}
public override bool isEnd()
{
return _isEnd;
}
public override Type getNextState()
{
return typeof(FieStateMachineCommonIdle);
}
public override List<Type> getAllowedStateList()
{
return new List<Type>();
}
}
}

View file

@ -0,0 +1,82 @@
using Fie.AI;
using Fie.Enemies.HoovesRaces.Changeling;
using Fie.Object;
using GameDataEditor;
using System;
namespace Fie.Enemies.HoovesRaces.ChangelingAlpha
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/ChangelingAlpha")]
public class FieChangelingAlpha : FieChangeling
{
protected new void Awake()
{
base.Awake();
base.animationManager = new FieSkeletonAnimationController(base.skeletonUtility, new FieChangelingAlphaAnimationContainer());
base.damageSystem.addStatusEffectCallback<FieStatusEffectsRiftEntity>(ApplyStatusEffect_ChangelingAlphaRift);
PreAssignEmittableObject<FieEmitObjectChangelingAlphaConcentration>();
PreAssignEmittableObject<FieEmitObjectChangelingAlphaShot>();
PreAssignEmittableObject<FieEmitObjectChangelingAlphaBurst>();
PreAssignEmittableObject<FieEmitObjectChangelingAlphaShout>();
PreAssignEmittableObject<FieEmitObjectChangelingAlphaChargeEffect>();
PreAssignEmittableObject<FieEmitObjectChangelingAlphaCharge>();
PreAssignEmittableObject<FieEmitObjectChangelingAlphaChargeFinish>();
PreAssignEmittableObject<FieEmitObjectChangelingAlphaHitEffect>();
PreAssignEmittableObject<FieEmitObjectChangelingAlphaReflectionShout>();
PreAssignEmittableObject<FieEmitObjectChangelingAlphaReflectionEffect>();
PreAssignEmittableObject<FieEmitObjectChangelingForcesArrivalParticleEffect>();
PreAssignEmittableObject<FieEmitObjectChangelingForcesArrivalFireEffect>();
PreAssignEmittableObject<FieEmitObjectChangelingForcesDeadEffect>();
}
private void ApplyStatusEffect_ChangelingAlphaRift(FieStatusEffectEntityBase statusEffectObject, FieGameCharacter attacker, FieDamage damage)
{
if (healthStats.stagger + damage.stagger >= healthStats.staggerResistance)
{
setStateToStatheMachine(typeof(FieStateMachineEnemiesHoovesRacesRift), isForceSet: true, isDupulicate: true);
damage.stagger = 0f;
healthStats.stagger = 0f;
}
}
public override string getDefaultName()
{
return FieLocalizeUtility.GetConstantText(GDEItemKeys.ConstantTextList_ENEMY_NAME_CHANGELING_ALPHA);
}
public override FieConstValues.FieGameCharacter getGameCharacterID()
{
return FieConstValues.FieGameCharacter.CHANGELING_ALPHA;
}
public override Type getDefaultAttackState()
{
return typeof(FieStateMachineChangelingBaseAttack);
}
public override Type getDefaultAITask()
{
return typeof(FieAITaskChangelingAlphaIdle);
}
public override int getBackStepAnimationID()
{
return 11;
}
public override int getArrivalAnimationID()
{
return 16;
}
public override GDEEnemyTableData GetEnemyMasterData()
{
return FieMasterData<GDEEnemyTableData>.I.GetMasterData(GDEItemKeys.EnemyTable_ENEMY_TABLE_CHANGELING_ALPHA);
}
public override FieConstValues.FieEnemy GetEnemyMasterDataID()
{
return FieConstValues.FieEnemy.ENEMY_TABLE_CHANGELING_ALPHA;
}
}
}

View file

@ -0,0 +1,36 @@
using Fie.Object;
namespace Fie.Enemies.HoovesRaces.ChangelingAlpha
{
public class FieChangelingAlphaAnimationContainer : FieEnemiesHoovesRacesAnimationContainer
{
public enum ChangelingAlphaAnimationList
{
SHOOT = 8,
SHOOT_CONCENTRATION,
MELEE,
BACK_STEP,
SHOUT,
CHARGE,
CHARGE_FINISH,
ZERO_DISTANCE_CHARGE,
ARRIVAL,
EMOTION_NORMAL,
MAX_CHANGELING_ALPHA_ANIMATION
}
public FieChangelingAlphaAnimationContainer()
{
addAnimationData(8, new FieSkeletonAnimationObject(0, "shoot"));
addAnimationData(9, new FieSkeletonAnimationObject(0, "shoot_concentration"));
addAnimationData(10, new FieSkeletonAnimationObject(0, "melee"));
addAnimationData(11, new FieSkeletonAnimationObject(0, "backstep"));
addAnimationData(12, new FieSkeletonAnimationObject(0, "shout"));
addAnimationData(13, new FieSkeletonAnimationObject(0, "charge"));
addAnimationData(14, new FieSkeletonAnimationObject(0, "charge_finish"));
addAnimationData(15, new FieSkeletonAnimationObject(0, "zero_distance_charge"));
addAnimationData(16, new FieSkeletonAnimationObject(0, "arrival"));
addAnimationData(17, new FieSkeletonAnimationObject(1, "emotion_normal"));
}
}
}

View file

@ -0,0 +1,40 @@
using Fie.Object;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.ChangelingAlpha
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaBurst")]
public class FieEmitObjectChangelingAlphaBurst : FieEmittableObjectBase
{
[SerializeField]
private float ChangelingAlphaBurstDuration = 0.7f;
[SerializeField]
private float ChangelingAlphaBurstDestroyDuration = 0.5f;
private bool _isEndUpdate;
private float _lifeCount;
private void Update()
{
if (!_isEndUpdate)
{
_lifeCount += Time.deltaTime;
if (_lifeCount > ChangelingAlphaBurstDuration)
{
destoryEmitObject(ChangelingAlphaBurstDestroyDuration);
_isEndUpdate = true;
}
}
}
private void OnTriggerStay(Collider collider)
{
if (!_isEndUpdate && collider.gameObject.tag == getHostileTagString())
{
addDamageToCollisionCharacter(collider, getDefaultDamageObject());
}
}
}
}

View file

@ -0,0 +1,64 @@
using Fie.Manager;
using Fie.Object;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.ChangelingAlpha
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaCharge")]
public class FieEmitObjectChangelingAlphaCharge : FieEmittableObjectBase
{
[SerializeField]
private float ChargeDuration = 0.4f;
[SerializeField]
private float ChargeDamageDuration = 0.3f;
private float _lifeTimeCount;
private bool _isEndUpdate;
public void Update()
{
if (!_isEndUpdate)
{
_lifeTimeCount += Time.deltaTime;
if (_lifeTimeCount >= ChargeDuration)
{
_isEndUpdate = true;
destoryEmitObject();
}
if (initTransform != null)
{
base.transform.position = initTransform.position;
}
}
}
private void OnTriggerEnter(Collider collider)
{
if (!_isEndUpdate && !(_lifeTimeCount > ChargeDamageDuration))
{
if (collider.gameObject.tag == getHostileTagString())
{
FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject());
if (x != null)
{
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingAlphaHitEffect>(base.transform, Vector3.zero);
destoryEmitObject(ChargeDuration - _lifeTimeCount);
}
}
FieEmittableObjectBase component = collider.GetComponent<FieEmittableObjectBase>();
if (component != null && reflectEmitObject(component))
{
Vector3 vector = collider.ClosestPointOnBounds(base.transform.position);
Vector3 vector2 = vector - base.transform.position;
FieEmitObjectChangelingAlphaReflectionEffect fieEmitObjectChangelingAlphaReflectionEffect = FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingAlphaReflectionEffect>(base.transform, vector2.normalized);
if (fieEmitObjectChangelingAlphaReflectionEffect != null)
{
fieEmitObjectChangelingAlphaReflectionEffect.transform.position = vector;
}
}
}
}
}
}

View file

@ -0,0 +1,21 @@
using Fie.Object;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.ChangelingAlpha
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaChargeEffect")]
public class FieEmitObjectChangelingAlphaChargeEffect : FieEmittableObjectBase
{
private const float DURATION = 1f;
public override void awakeEmitObject()
{
if (initTransform != null)
{
base.transform.position = initTransform.position;
}
base.transform.rotation = Quaternion.LookRotation(directionalVec);
destoryEmitObject(1f);
}
}
}

View file

@ -0,0 +1,64 @@
using Fie.Manager;
using Fie.Object;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.ChangelingAlpha
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaChargeFinish")]
public class FieEmitObjectChangelingAlphaChargeFinish : FieEmittableObjectBase
{
[SerializeField]
private float ChargeFinishDuration = 0.4f;
[SerializeField]
private float ChargeFinishDamageDuration = 0.3f;
private float _lifeTimeCount;
private bool _isEndUpdate;
public void Update()
{
if (!_isEndUpdate)
{
_lifeTimeCount += Time.deltaTime;
if (_lifeTimeCount >= ChargeFinishDuration)
{
_isEndUpdate = true;
destoryEmitObject();
}
if (initTransform != null)
{
base.transform.position = initTransform.position;
}
}
}
private void OnTriggerEnter(Collider collider)
{
if (!_isEndUpdate && !(_lifeTimeCount > ChargeFinishDamageDuration))
{
if (collider.gameObject.tag == getHostileTagString())
{
FieGameCharacter x = addDamageToCollisionCharacter(collider, getDefaultDamageObject());
if (x != null)
{
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingAlphaHitEffect>(base.transform, Vector3.zero);
destoryEmitObject(ChargeFinishDuration - _lifeTimeCount);
}
}
FieEmittableObjectBase component = collider.GetComponent<FieEmittableObjectBase>();
if (component != null && reflectEmitObject(component))
{
Vector3 vector = collider.ClosestPointOnBounds(base.transform.position);
Vector3 vector2 = vector - base.transform.position;
FieEmitObjectChangelingAlphaReflectionEffect fieEmitObjectChangelingAlphaReflectionEffect = FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingAlphaReflectionEffect>(base.transform, vector2.normalized);
if (fieEmitObjectChangelingAlphaReflectionEffect != null)
{
fieEmitObjectChangelingAlphaReflectionEffect.transform.position = vector;
}
}
}
}
}
}

View file

@ -0,0 +1,70 @@
using Fie.Object;
using ParticlePlayground;
using System.Collections.Generic;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.ChangelingAlpha
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaConcentration")]
public class FieEmitObjectChangelingAlphaConcentration : FieEmittableObjectBase
{
private const float EFFECT_DURATION = 2f;
private const float DURATION = 3f;
public List<PlaygroundParticlesC> effects;
public AudioSource soundEffect;
private float lifeTime;
private bool isStopEffects;
public override void awakeEmitObject()
{
foreach (PlaygroundParticlesC effect in effects)
{
if (effect != null)
{
effect.emit = true;
}
}
}
private void Update()
{
if (base.ownerCharacter == null)
{
lifeTime = 2f;
}
lifeTime += Time.deltaTime;
if (lifeTime > 2f && !isStopEffects && effects != null)
{
foreach (PlaygroundParticlesC effect in effects)
{
if (effect != null)
{
effect.emit = false;
}
}
if (soundEffect != null)
{
soundEffect.Stop();
}
isStopEffects = true;
}
if (lifeTime > 3f)
{
destoryEmitObject();
}
}
private void LateUpdate()
{
if (!(initTransform == null))
{
base.transform.position = initTransform.position;
}
}
}
}

View file

@ -0,0 +1,15 @@
using Fie.Object;
namespace Fie.Enemies.HoovesRaces.ChangelingAlpha
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaHitEffect")]
public class FieEmitObjectChangelingAlphaHitEffect : FieEmittableObjectBase
{
private const float DURATION = 1f;
public override void awakeEmitObject()
{
destoryEmitObject(1f);
}
}
}

View file

@ -0,0 +1,18 @@
using Fie.Object;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.ChangelingAlpha
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaReflectEffect")]
public class FieEmitObjectChangelingAlphaReflectionEffect : FieEmittableObjectBase
{
[SerializeField]
private float reflectEffectDuration = 0.6f;
public override void awakeEmitObject()
{
base.transform.rotation = Quaternion.LookRotation(directionalVec);
destoryEmitObject(reflectEffectDuration);
}
}
}

View file

@ -0,0 +1,59 @@
using Fie.Manager;
using Fie.Object;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.ChangelingAlpha
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaReflectionShout")]
public class FieEmitObjectChangelingAlphaReflectionShout : FieEmittableObjectBase
{
[SerializeField]
private float shoutDuration = 1.5f;
[SerializeField]
private float ShoutEnableDuration = 0.8f;
private float _lifeTimeCount;
private bool _isEndUpdate;
public void Update()
{
if (initTransform != null)
{
base.transform.position = initTransform.position;
}
if (!_isEndUpdate)
{
_lifeTimeCount += Time.deltaTime;
if (_lifeTimeCount >= shoutDuration)
{
_isEndUpdate = true;
destoryEmitObject();
}
}
}
private void OnTriggerEnter(Collider collider)
{
if (!_isEndUpdate && !(_lifeTimeCount > ShoutEnableDuration))
{
if (collider.gameObject.tag == getHostileTagString())
{
addDamageToCollisionCharacter(collider, getDefaultDamageObject());
}
FieEmittableObjectBase component = collider.GetComponent<FieEmittableObjectBase>();
if (component != null && reflectEmitObject(component))
{
Vector3 vector = collider.ClosestPointOnBounds(base.transform.position);
Vector3 vector2 = vector - base.transform.position;
FieEmitObjectChangelingAlphaReflectionEffect fieEmitObjectChangelingAlphaReflectionEffect = FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingAlphaReflectionEffect>(base.transform, vector2.normalized);
if (fieEmitObjectChangelingAlphaReflectionEffect != null)
{
fieEmitObjectChangelingAlphaReflectionEffect.transform.position = vector;
}
}
}
}
}
}

View file

@ -0,0 +1,151 @@
using Fie.Manager;
using Fie.Object;
using Fie.Utility;
using PigeonCoopToolkit.Effects.Trails;
using System.Collections.Generic;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.ChangelingAlpha
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaShot")]
public class FieEmitObjectChangelingAlphaShot : FieEmittableObjectBase
{
[SerializeField]
private float shotDuration = 1f;
[SerializeField]
private float shotVelocityMax = 4f;
[SerializeField]
private float shotAccelTime = 0.1f;
[SerializeField]
private float shoutDestroyDuration = 0.5f;
[SerializeField]
private GameObject effectModel;
[SerializeField]
private Light shotLight;
[SerializeField]
private List<SmokeTrail> trailList = new List<SmokeTrail>();
private Tweener<TweenTypesInSine> _velocityTweener = new Tweener<TweenTypesInSine>();
private Tweener<TweenTypesOutSine> _scaleTweener = new Tweener<TweenTypesOutSine>();
private Vector3 _lastDirectionalVec = Vector3.zero;
private Vector3 _initDirectionalVec = Vector3.zero;
private float _lifeTimeCount;
private float _minDistance = 3.40282347E+38f;
private bool _isEndUpdate;
private Vector3 _initEffectModelScale = Vector3.zero;
public void Awake()
{
_initEffectModelScale = effectModel.transform.localScale;
}
public override void awakeEmitObject()
{
_velocityTweener.InitTweener(shotAccelTime, 0f, shotVelocityMax);
_scaleTweener.InitTweener(shotAccelTime, Vector3.zero, Vector3.one);
_initDirectionalVec = directionalVec;
if (targetTransform != null && targetTransform.root != null)
{
Vector3 a = targetTransform.position;
FieGameCharacter component = targetTransform.root.GetComponent<FieGameCharacter>();
if (component != null && component.groundState == FieObjectGroundState.Grounding)
{
int layerMask = 512;
if (Physics.Raycast(targetTransform.position + Vector3.up * 2f, Vector3.down, out RaycastHit hitInfo, 1024f, layerMask) && hitInfo.collider.tag == "Floor")
{
a = hitInfo.point;
}
}
_initDirectionalVec = a - base.transform.position;
_initDirectionalVec.Normalize();
directionalVec = _initDirectionalVec;
}
if (trailList.Count > 0)
{
foreach (SmokeTrail trail in trailList)
{
trail.ClearSystem(emitState: true);
}
}
effectModel.transform.localScale = _initEffectModelScale;
}
public void Update()
{
if (!_isEndUpdate)
{
Vector3 vector = directionalVec * _velocityTweener.UpdateParameterFloat(Time.deltaTime);
base.transform.position += vector * Time.deltaTime;
base.transform.localScale = _scaleTweener.UpdateParameterVec3(Time.deltaTime);
_lifeTimeCount += Time.deltaTime;
if (_lifeTimeCount >= shotDuration)
{
if (trailList.Count > 0)
{
foreach (SmokeTrail trail in trailList)
{
trail.Emit = false;
trail.ClearSystem(emitState: false);
}
}
destoryEmitObject(shoutDestroyDuration);
_isEndUpdate = true;
}
base.transform.rotation = Quaternion.LookRotation(vector);
}
}
private void OnTriggerEnter(Collider collider)
{
if (!_isEndUpdate && (collider.gameObject.tag == getHostileTagString() || collider.gameObject.tag == "Floor"))
{
FieEmitObjectChangelingAlphaBurst fieEmitObjectChangelingAlphaBurst = FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingAlphaBurst>(base.transform, Vector3.zero);
if (collider.gameObject.tag == getHostileTagString())
{
addDamageToCollisionCharacter(collider, getDefaultDamageObject());
}
if (fieEmitObjectChangelingAlphaBurst != null)
{
fieEmitObjectChangelingAlphaBurst.setAllyTag(getArrayTag());
fieEmitObjectChangelingAlphaBurst.setHostileTag(getHostileTag());
}
FieManagerBehaviour<FieGameCameraManager>.I.gameCamera.setWiggler(Wiggler.WiggleTemplate.WIGGLE_TYPE_BIG);
if (trailList.Count > 0)
{
foreach (SmokeTrail trail in trailList)
{
trail.Emit = false;
}
}
shotLight.intensity = 0f;
effectModel.transform.localScale = Vector3.zero;
destoryEmitObject(shotDuration - _lifeTimeCount);
_isEndUpdate = true;
}
}
private void OnDisable()
{
if (trailList.Count > 0)
{
foreach (SmokeTrail trail in trailList)
{
trail.ClearSystem(emitState: false);
}
}
}
}
}

View file

@ -0,0 +1,52 @@
using Fie.Object;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.ChangelingAlpha
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/ChangelingAlpha/Power/ChangelingAlphaShout")]
public class FieEmitObjectChangelingAlphaShout : FieEmittableObjectBase
{
[SerializeField]
private float shoutDuration = 1.5f;
[SerializeField]
private float ShoutEnableDuration = 0.8f;
[SerializeField]
private float ShoutPysicalForce = 5f;
private float _lifeTimeCount;
private bool _isEndUpdate;
public void Update()
{
if (initTransform != null)
{
base.transform.position = initTransform.position;
}
if (!_isEndUpdate)
{
_lifeTimeCount += Time.deltaTime;
if (_lifeTimeCount >= shoutDuration)
{
_isEndUpdate = true;
destoryEmitObject();
}
}
}
private void OnTriggerEnter(Collider collider)
{
if (!_isEndUpdate && !(_lifeTimeCount > ShoutEnableDuration) && collider.gameObject.tag == getHostileTagString())
{
FieGameCharacter fieGameCharacter = addDamageToCollisionCharacter(collider, getDefaultDamageObject());
if (fieGameCharacter != null)
{
fieGameCharacter.resetMoveForce();
fieGameCharacter.setMoveForce((fieGameCharacter.centerTransform.position - base.transform.position).normalized * ShoutPysicalForce, 0f, useRound: false);
}
}
}
}
}

View file

@ -0,0 +1,80 @@
using Fie.Manager;
using Fie.Object;
using Spine;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.ChangelingAlpha
{
public class FieStateMachineChangelingAlphaCharge : FieStateMachineGameCharacterBase
{
private const float MOVE_THRESHOLD = 0.02f;
private const float WALK_FORCE_THRESHOLD = 0.3f;
private const float WALK_MOVESPEED_MAGNI = 0.25f;
private bool _isEnd;
private Type _nextState;
public override void updateState<T>(ref T gameCharacter)
{
FieChangelingAlpha changelingAlpha = gameCharacter as FieChangelingAlpha;
if ((object)changelingAlpha != null)
{
Vector3 externalInputVector = changelingAlpha.externalInputVector;
externalInputVector.z = externalInputVector.y * 0.5f;
externalInputVector.y = 0f;
float defaultMoveSpeed = changelingAlpha.getDefaultMoveSpeed();
TrackEntry trackEntry = changelingAlpha.animationManager.SetAnimation(13, isLoop: true);
if (trackEntry != null)
{
trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e)
{
if (e.Data.Name == "fire")
{
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingAlphaChargeEffect>(changelingAlpha.centerTransform, changelingAlpha.flipDirectionVector);
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingAlphaCharge>(changelingAlpha.centerTransform, changelingAlpha.flipDirectionVector, null, changelingAlpha);
}
};
}
changelingAlpha.addMoveForce(externalInputVector * (defaultMoveSpeed * changelingAlpha.externalInputForce), 0.4f);
}
}
public override void initialize(FieGameCharacter gameCharacter)
{
if (!(gameCharacter == null))
{
gameCharacter.isEnableAutoFlip = true;
}
}
public override void terminate(FieGameCharacter gameCharacter)
{
if (!(gameCharacter == null))
{
gameCharacter.isEnableAutoFlip = false;
}
}
public override bool isEnd()
{
return _isEnd;
}
public override Type getNextState()
{
return _nextState;
}
public override List<Type> getAllowedStateList()
{
List<Type> list = new List<Type>();
list.Add(typeof(FieStateMachineAnyConsider));
return list;
}
}
}

View file

@ -0,0 +1,152 @@
using Fie.Manager;
using Fie.Object;
using Spine;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.ChangelingAlpha
{
public class FieStateMachineChangelingAlphaChargeFinish : FieStateMachineGameCharacterBase
{
private enum FireState
{
KICK_START,
KICKING
}
private const float KICK_DELAY = 0.2f;
private const float KICK_HORMING_DISTANCE = 1f;
private const float KICK_HORMING_DEFAULT_RATE = 1f;
private const float GROUND_FORCE_TIME = 1.5f;
private const float GROUND_FORCE = 15f;
private Type _nextState = typeof(FieStateMachineCommonIdle);
private FireState _fireState;
private bool _isEnd;
private float _endTime = 3.40282347E+38f;
private float _timeCount;
private bool _isSetEndAnim;
private bool _isFinished;
public override void initialize(FieGameCharacter gameCharacter)
{
FieChangelingAlpha fieChangelingAlpha = gameCharacter as FieChangelingAlpha;
if (!(fieChangelingAlpha == null))
{
autoFlipToEnemy(fieChangelingAlpha);
fieChangelingAlpha.isEnableAutoFlip = false;
}
}
public override void terminate(FieGameCharacter gameCharacter)
{
FieChangelingAlpha fieChangelingAlpha = gameCharacter as FieChangelingAlpha;
if (!(fieChangelingAlpha == null))
{
fieChangelingAlpha.isEnableAutoFlip = false;
}
}
public override void updateState<T>(ref T gameCharacter)
{
if (gameCharacter is FieChangelingAlpha)
{
_timeCount += Time.deltaTime;
FieChangelingAlpha changelingAlpha = gameCharacter as FieChangelingAlpha;
switch (_fireState)
{
case FireState.KICK_START:
if (changelingAlpha.groundState == FieObjectGroundState.Grounding)
{
TrackEntry trackEntry = changelingAlpha.animationManager.SetAnimation(14, isLoop: false, isForceSet: true);
if (trackEntry != null)
{
trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e)
{
if (e.Data.Name == "fire")
{
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingAlphaChargeFinish>(changelingAlpha.centerTransform, changelingAlpha.flipDirectionVector, null, changelingAlpha);
}
if (e.Data.Name == "move")
{
Vector3 a = changelingAlpha.flipDirectionVector;
Transform lockonEnemyTransform = changelingAlpha.detector.getLockonEnemyTransform();
float num = 1f;
if (lockonEnemyTransform != null)
{
Vector3 vector = lockonEnemyTransform.position - changelingAlpha.transform.position;
vector.Normalize();
a = vector;
a.y = 0f;
}
Vector3 vector2 = a * (e.Float * num);
changelingAlpha.resetMoveForce();
changelingAlpha.setMoveForce(vector2, 0f, useRound: false);
if (e.Float > 0f)
{
changelingAlpha.setFlipByVector(vector2);
}
}
if (e.Data.Name == "finished")
{
_isEnd = true;
}
};
_endTime = trackEntry.endTime;
}
else
{
_endTime = 0f;
}
_fireState = FireState.KICKING;
}
else
{
_isEnd = true;
}
break;
}
if (_timeCount > _endTime)
{
_isEnd = true;
}
}
}
public override bool isEnd()
{
return _isEnd;
}
public override Type getNextState()
{
return _nextState;
}
public override List<Type> getAllowedStateList()
{
return new List<Type>();
}
public override float getDelay()
{
return 0.2f;
}
public override bool isFinished()
{
return _isFinished;
}
}
}

View file

@ -0,0 +1,55 @@
using Fie.Manager;
using Fie.Object;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.ChangelingAlpha
{
public class FieStateMachineChangelingAlphaConcentration : FieStateMachineGameCharacterBase
{
public override void updateState<T>(ref T gameCharacter)
{
if (gameCharacter is FieChangelingAlpha)
{
gameCharacter.animationManager.SetAnimation(9, isLoop: true);
}
}
public override void initialize(FieGameCharacter gameCharacter)
{
FieChangelingAlpha fieChangelingAlpha = gameCharacter as FieChangelingAlpha;
if (!(fieChangelingAlpha == null))
{
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingAlphaConcentration>(fieChangelingAlpha.hornTransform, Vector3.zero, null, gameCharacter);
autoFlipToEnemy(fieChangelingAlpha);
fieChangelingAlpha.isEnableAutoFlip = false;
}
}
public override void terminate(FieGameCharacter gameCharacter)
{
if (!(gameCharacter == null))
{
gameCharacter.isEnableAutoFlip = true;
}
}
public override bool isEnd()
{
return false;
}
public override Type getNextState()
{
return typeof(FieStateMachineCommonIdle);
}
public override List<Type> getAllowedStateList()
{
List<Type> list = new List<Type>();
list.Add(typeof(FieStateMachineAnyConsider));
return list;
}
}
}

View file

@ -0,0 +1,92 @@
using Fie.Manager;
using Fie.Object;
using Spine;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.ChangelingAlpha
{
public class FieStateMachineChangelingAlphaShoot : FieStateMachineGameCharacterBase
{
private enum ShootState
{
STATE_PREPARE,
STATE_SHOOT
}
private ShootState _shootState;
private bool _isEnd;
public override void initialize(FieGameCharacter gameCharacter)
{
gameCharacter.isEnableAutoFlip = false;
}
public override void updateState<T>(ref T gameCharacter)
{
FieChangelingAlpha changelingAlpha = gameCharacter as FieChangelingAlpha;
if (!(changelingAlpha == null))
{
if (changelingAlpha.detector.getLockonEnemyTransform() == null)
{
_isEnd = true;
}
else if (_shootState == ShootState.STATE_PREPARE)
{
TrackEntry trackEntry = changelingAlpha.animationManager.SetAnimation(8, isLoop: false, isForceSet: true);
if (trackEntry != null)
{
autoFlipToEnemy(changelingAlpha);
trackEntry.Event += delegate(Spine.AnimationState state, int trackIndex, Spine.Event e)
{
if (e.Data.Name == "fire")
{
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingAlphaShot>(changelingAlpha.hornTransform, changelingAlpha.flipDirectionVector, changelingAlpha.detector.getLockonEnemyTransform(isCenter: true), changelingAlpha);
}
if (e.Data.Name == "move")
{
Vector3 flipDirectionVector = changelingAlpha.flipDirectionVector;
Vector3 moveForce = flipDirectionVector * e.Float;
changelingAlpha.resetMoveForce();
changelingAlpha.setMoveForce(moveForce, 0f, useRound: false);
}
if (e.Data.Name == "finished")
{
_isEnd = true;
}
};
trackEntry.Complete += delegate
{
_isEnd = true;
};
}
else
{
_isEnd = true;
}
_shootState = ShootState.STATE_SHOOT;
}
}
}
public override bool isEnd()
{
return _isEnd;
}
public override Type getNextState()
{
return typeof(FieStateMachineCommonIdle);
}
public override List<Type> getAllowedStateList()
{
List<Type> list = new List<Type>();
list.Add(typeof(FieStateMachineChangelingAlphaConcentration));
list.Add(typeof(FieStateMachineChangelingAlphaShout));
return list;
}
}
}

Some files were not shown because too many files have changed in this diff Show more