Add version 1.32.1 source code
This commit is contained in:
commit
47c6f1908b
686 changed files with 90997 additions and 0 deletions
7
README.md
Normal file
7
README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
# "Kemono Friends Cellien May Cry" Source Code
|
||||
|
||||
Current version: **v1.32.1**
|
||||
|
||||
This repository contains a mirror of the source code for [けものフレンズ Cellien May Cry](https://store.steampowered.com/app/1962920/).
|
||||
|
||||
I am not the author of the source code. This repository is made available for educational, research and archival purposes only.
|
53
Script/ActivateAndPositionToRaycastHit.cs
Normal file
53
Script/ActivateAndPositionToRaycastHit.cs
Normal file
|
@ -0,0 +1,53 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ActivateAndPositionToRaycastHit : MonoBehaviour {
|
||||
|
||||
public GameObject targetObj;
|
||||
public Transform rayOrigin;
|
||||
public Vector3 rayOffset;
|
||||
public Vector3 direction;
|
||||
public float distance = 10f;
|
||||
public LayerMask layerMask;
|
||||
public bool activation = true;
|
||||
public bool positioning = true;
|
||||
public Vector3 offset;
|
||||
|
||||
Transform targetTrans;
|
||||
Ray ray = new Ray();
|
||||
RaycastHit raycastHit = new RaycastHit();
|
||||
static readonly Vector3 vecZero = Vector3.zero;
|
||||
static readonly Vector3 vecForward = Vector3.forward;
|
||||
|
||||
void Start () {
|
||||
targetTrans = targetObj.transform;
|
||||
if (activation) {
|
||||
targetObj.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void RaycastHitActivate(int param = 1) {
|
||||
enabled = (param != 0);
|
||||
if (activation && !enabled && targetObj.activeSelf) {
|
||||
targetObj.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
void LateUpdate () {
|
||||
ray.origin = rayOrigin.position + rayOffset;
|
||||
ray.direction = (direction == vecZero ? rayOrigin.TransformDirection(vecForward) : direction);
|
||||
if (Physics.Raycast(ray, out raycastHit, distance, layerMask, QueryTriggerInteraction.Ignore)) {
|
||||
if (positioning) {
|
||||
targetTrans.position = raycastHit.point + offset;
|
||||
}
|
||||
if (activation && !targetObj.activeSelf) {
|
||||
targetObj.SetActive(true);
|
||||
}
|
||||
} else {
|
||||
if (activation && targetObj.activeSelf) {
|
||||
targetObj.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
47
Script/ActivateExceptHome.cs
Normal file
47
Script/ActivateExceptHome.cs
Normal file
|
@ -0,0 +1,47 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ActivateExceptHome : MonoBehaviour {
|
||||
|
||||
public GameObject[] activateTarget;
|
||||
public GameObject[] deactivateTarget;
|
||||
public int[] exceptHomeFloors;
|
||||
private bool processedFlag;
|
||||
[System.NonSerialized] public bool isExceptHome;
|
||||
|
||||
private void Start() {
|
||||
if (!processedFlag && StageManager.Instance) {
|
||||
bool exceptHomeFlag = false;
|
||||
if (exceptHomeFloors != null && exceptHomeFloors.Length > 0 && StageManager.Instance.IsHomeStage) {
|
||||
for (int i = 0; i < exceptHomeFloors.Length; i++) {
|
||||
if (StageManager.Instance.floorNumber == exceptHomeFloors[i]) {
|
||||
exceptHomeFlag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ActivateExternal(!StageManager.Instance.IsHomeStage || exceptHomeFlag);
|
||||
}
|
||||
}
|
||||
|
||||
public void ActivateExternal(bool exceptHome) {
|
||||
if (activateTarget.Length > 0) {
|
||||
for (int i = 0; i < activateTarget.Length; i++) {
|
||||
if (activateTarget[i] && activateTarget[i].activeSelf != exceptHome) {
|
||||
activateTarget[i].SetActive(exceptHome);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (deactivateTarget.Length > 0) {
|
||||
for (int i = 0; i < deactivateTarget.Length; i++) {
|
||||
if (deactivateTarget[i] && deactivateTarget[i].activeSelf != !exceptHome) {
|
||||
deactivateTarget[i].SetActive(!exceptHome);
|
||||
}
|
||||
}
|
||||
}
|
||||
processedFlag = true;
|
||||
isExceptHome = exceptHome;
|
||||
}
|
||||
|
||||
}
|
17
Script/ActivateObject.cs
Normal file
17
Script/ActivateObject.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ActivateObject : MonoBehaviour {
|
||||
|
||||
public GameObject[] targetObject;
|
||||
|
||||
public void Activate(bool flag) {
|
||||
for (int i = 0; i < targetObject.Length; i++) {
|
||||
if (targetObject[i] && targetObject[i].activeSelf != flag) {
|
||||
targetObject[i].SetActive(flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
58
Script/ActivateObjectOnStop.cs
Normal file
58
Script/ActivateObjectOnStop.cs
Normal file
|
@ -0,0 +1,58 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
|
||||
public class ActivateObjectOnStop : MonoBehaviour {
|
||||
|
||||
[System.Serializable]
|
||||
public class BeaverWeapon {
|
||||
public bool enabled;
|
||||
public GameObject switchingObj;
|
||||
}
|
||||
|
||||
public GameObject targetObject;
|
||||
public Rigidbody rigid;
|
||||
public float limitSpeed = 1f;
|
||||
public float limitConditionTime = 0.25f;
|
||||
public float delay = 1f;
|
||||
public bool checkSleep;
|
||||
public bool setKinematicOnStop;
|
||||
public BeaverWeapon beaverWeapon;
|
||||
|
||||
private float elapsedTime = 0;
|
||||
private float limittingTime = 0;
|
||||
private bool stopped = false;
|
||||
// private float beaverTime;
|
||||
// const float carvingTime = 0.5f;
|
||||
// const float noCarvingTime = 1.0f;
|
||||
|
||||
void FixedUpdate() {
|
||||
if (!stopped && Time.timeScale > 0 && rigid) {
|
||||
float deltaTimeCache = Time.fixedDeltaTime;
|
||||
elapsedTime += deltaTimeCache;
|
||||
if (elapsedTime >= delay) {
|
||||
if (rigid.velocity.sqrMagnitude <= limitSpeed * limitSpeed && (!checkSleep || rigid.IsSleeping())) {
|
||||
limittingTime += deltaTimeCache;
|
||||
} else {
|
||||
limittingTime = 0f;
|
||||
}
|
||||
if (limittingTime >= limitConditionTime) {
|
||||
if (targetObject) {
|
||||
targetObject.SetActive(true);
|
||||
}
|
||||
if (setKinematicOnStop) {
|
||||
rigid.isKinematic = true;
|
||||
}
|
||||
stopped = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (beaverWeapon.enabled && stopped && Time.timeScale > 0 && beaverWeapon.switchingObj) {
|
||||
bool switchOn = (GameManager.Instance.time % 0.75 < 0.25);
|
||||
if (beaverWeapon.switchingObj.activeSelf != switchOn) {
|
||||
beaverWeapon.switchingObj.SetActive(switchOn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
28
Script/ActivateOnEnemyZero.cs
Normal file
28
Script/ActivateOnEnemyZero.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ActivateOnEnemyZero : MonoBehaviour {
|
||||
|
||||
public GameObject target;
|
||||
public bool invert;
|
||||
|
||||
private bool activated;
|
||||
|
||||
void Awake () {
|
||||
if (target) {
|
||||
target.SetActive(invert);
|
||||
}
|
||||
activated = false;
|
||||
}
|
||||
|
||||
void Update () {
|
||||
if (!activated && target && StageManager.Instance && StageManager.Instance.dungeonController) {
|
||||
int enemyCount = StageManager.Instance.dungeonController.EnemyCount();
|
||||
if (enemyCount <= 0) {
|
||||
target.SetActive(!invert);
|
||||
activated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
34
Script/ActivateOnProgress.cs
Normal file
34
Script/ActivateOnProgress.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ActivateOnProgress : MonoBehaviour {
|
||||
|
||||
public enum GenerateCondition {
|
||||
Always, HomeObject, InverseHomeObject
|
||||
}
|
||||
|
||||
public GameObject target;
|
||||
public int conditionProgress;
|
||||
public GenerateCondition generateCondition;
|
||||
bool activated;
|
||||
|
||||
void Awake() {
|
||||
if (target) {
|
||||
target.SetActive(false);
|
||||
}
|
||||
activated = false;
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (!activated && target && GameManager.Instance) {
|
||||
if (GameManager.Instance.save.progress >= conditionProgress) {
|
||||
activated = true;
|
||||
if (generateCondition == GenerateCondition.Always || (generateCondition == GenerateCondition.HomeObject && GameManager.Instance.save.config[GameManager.Save.configID_GenerateHomeObjects] != 0) || (generateCondition == GenerateCondition.InverseHomeObject && GameManager.Instance.save.config[GameManager.Save.configID_GenerateHomeObjects] == 0)) {
|
||||
target.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
enabled = false;
|
||||
}
|
||||
}
|
33
Script/ActivateOnSuperman.cs
Normal file
33
Script/ActivateOnSuperman.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ActivateOnSuperman : MonoBehaviour {
|
||||
|
||||
public GameObject[] targetObjects;
|
||||
|
||||
CharacterBase parentCBase;
|
||||
bool stateSave = false;
|
||||
|
||||
void Awake () {
|
||||
parentCBase = GetComponentInParent<CharacterBase>();
|
||||
stateSave = (parentCBase && parentCBase.isSuperman);
|
||||
for (int i = 0; i < targetObjects.Length; i++) {
|
||||
if (targetObjects[i]) {
|
||||
targetObjects[i].SetActive(stateSave);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Update() {
|
||||
bool flag = (parentCBase && parentCBase.isSuperman);
|
||||
if (stateSave != flag) {
|
||||
stateSave = flag;
|
||||
for (int i = 0; i < targetObjects.Length; i++) {
|
||||
if (targetObjects[i]) {
|
||||
targetObjects[i].SetActive(stateSave);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
29
Script/ActivateOnTriggerEnter.cs
Normal file
29
Script/ActivateOnTriggerEnter.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ActivateOnTriggerEnter : MonoBehaviour {
|
||||
|
||||
public GameObject targetObj;
|
||||
public string targetTag;
|
||||
public bool deactivateOnExit = false;
|
||||
|
||||
protected bool activated = false;
|
||||
|
||||
protected virtual void Activate(bool flag) {
|
||||
activated = flag;
|
||||
targetObj.SetActive(flag);
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other) {
|
||||
if (!activated && (string.IsNullOrEmpty(targetTag) || other.CompareTag(targetTag))) {
|
||||
Activate(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other) {
|
||||
if (deactivateOnExit && activated && (string.IsNullOrEmpty(targetTag) || other.CompareTag(targetTag))) {
|
||||
Activate(false);
|
||||
}
|
||||
}
|
||||
}
|
33
Script/ActivateOnTriggerStay.cs
Normal file
33
Script/ActivateOnTriggerStay.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ActivateOnTriggerStay : MonoBehaviour {
|
||||
|
||||
public GameObject targetObj;
|
||||
public string conditionTag;
|
||||
public float duration = 0.1f;
|
||||
|
||||
protected float stayTime;
|
||||
protected bool touchedOnThisFrame;
|
||||
|
||||
private void Update() {
|
||||
if (Time.timeScale > 0) {
|
||||
if (targetObj.activeSelf != (stayTime > 0)) {
|
||||
targetObj.SetActive(stayTime > 0);
|
||||
}
|
||||
touchedOnThisFrame = false;
|
||||
if (stayTime > 0) {
|
||||
stayTime -= Time.deltaTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerStay(Collider other) {
|
||||
if (!touchedOnThisFrame && other.CompareTag(conditionTag)) {
|
||||
stayTime = duration;
|
||||
touchedOnThisFrame = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
21
Script/ActivatePlayerLightOnTriggerEnter.cs
Normal file
21
Script/ActivatePlayerLightOnTriggerEnter.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ActivatePlayerLightOnTriggerEnter : MonoBehaviour {
|
||||
|
||||
public int lightType;
|
||||
|
||||
private void OnTriggerEnter(Collider other) {
|
||||
if (other.CompareTag("ItemGetter") && CharacterManager.Instance) {
|
||||
CharacterManager.Instance.SetPlayerLightActiveTemporal(true, lightType);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other) {
|
||||
if (other.CompareTag("ItemGetter") && CharacterManager.Instance) {
|
||||
CharacterManager.Instance.SetPlayerLightActiveTemporal(false, lightType);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
18
Script/ActivateRandom.cs
Normal file
18
Script/ActivateRandom.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ActivateRandom : MonoBehaviour {
|
||||
|
||||
public GameObject[] targetObj;
|
||||
|
||||
private void Awake() {
|
||||
if (targetObj.Length > 0) {
|
||||
int index = Random.Range(0, targetObj.Length);
|
||||
if (targetObj[index]) {
|
||||
targetObj[index].SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
57
Script/ActivateWithPlayerDistance.cs
Normal file
57
Script/ActivateWithPlayerDistance.cs
Normal file
|
@ -0,0 +1,57 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ActivateWithPlayerDistance : MonoBehaviour {
|
||||
|
||||
public GameObject activateTarget;
|
||||
public float conditionDistance = 65f;
|
||||
public bool ignoreY = true;
|
||||
public float conditionCameraHeight = 500f;
|
||||
public bool checkDefeatEnemyCondition;
|
||||
public bool activateOnClimbing;
|
||||
|
||||
Transform trans;
|
||||
Transform playerTrans;
|
||||
Vector3 playerPos;
|
||||
Transform camT;
|
||||
|
||||
private void Awake() {
|
||||
trans = transform;
|
||||
}
|
||||
|
||||
private void Start() {
|
||||
if (CharacterManager.Instance && CharacterManager.Instance.playerTrans) {
|
||||
playerTrans = CharacterManager.Instance.playerTrans;
|
||||
}
|
||||
if (conditionCameraHeight < 100f) {
|
||||
if (CameraManager.Instance) {
|
||||
CameraManager.Instance.SetMainCameraTransform(ref camT);
|
||||
} else {
|
||||
Camera mainCamera = Camera.main;
|
||||
if (mainCamera) {
|
||||
camT = mainCamera.transform;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LateUpdate () {
|
||||
if (playerTrans) {
|
||||
playerPos = playerTrans.position;
|
||||
if (ignoreY) {
|
||||
playerPos.y = trans.position.y;
|
||||
}
|
||||
bool active = (conditionDistance >= 200 || (activateOnClimbing && CharacterManager.Instance && CharacterManager.Instance.isClimbing) || (playerPos - trans.position).sqrMagnitude <= conditionDistance * conditionDistance);
|
||||
if (conditionCameraHeight < 100f && active) {
|
||||
active = (camT && camT.position.y - trans.position.y <= conditionCameraHeight);
|
||||
}
|
||||
if (checkDefeatEnemyCondition && StageManager.Instance && StageManager.Instance.dungeonController && StageManager.Instance.dungeonController.GetDefeatMissionCompleted() == false) {
|
||||
active = false;
|
||||
}
|
||||
if (activateTarget && activateTarget.activeSelf != active) {
|
||||
activateTarget.SetActive(active);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
26
Script/ActivateWithPlayerHeight.cs
Normal file
26
Script/ActivateWithPlayerHeight.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ActivateWithPlayerHeight : MonoBehaviour {
|
||||
|
||||
public GameObject activateTargetObj;
|
||||
public Transform standardTrans;
|
||||
public float offset;
|
||||
public bool activateOnPlayerGreaterThanStandard = false;
|
||||
|
||||
Transform playerTrans;
|
||||
|
||||
void Start () {
|
||||
playerTrans = CharacterManager.Instance.playerTrans;
|
||||
}
|
||||
|
||||
void Update () {
|
||||
if (playerTrans) {
|
||||
bool toActive = ((activateOnPlayerGreaterThanStandard && playerTrans.position.y > standardTrans.position.y + offset) || (!activateOnPlayerGreaterThanStandard && playerTrans.position.y < standardTrans.position.y + offset));
|
||||
if (activateTargetObj.activeSelf != toActive) {
|
||||
activateTargetObj.SetActive(toActive);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
33
Script/ActivateXWeaponTrailsOnEnable.cs
Normal file
33
Script/ActivateXWeaponTrailsOnEnable.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using XftWeapon;
|
||||
|
||||
public class ActivateXWeaponTrailsOnEnable : MonoBehaviour {
|
||||
|
||||
public float stopSmoothTime;
|
||||
XWeaponTrail xwt;
|
||||
|
||||
private void Awake() {
|
||||
xwt = GetComponent<XWeaponTrail>();
|
||||
if (xwt) {
|
||||
xwt.Init();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable() {
|
||||
if (xwt) {
|
||||
xwt.Activate();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable() {
|
||||
if (xwt) {
|
||||
if (stopSmoothTime <= 0f) {
|
||||
xwt.Deactivate();
|
||||
} else {
|
||||
xwt.StopSmoothly(stopSmoothTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
52
Script/Ambient.cs
Normal file
52
Script/Ambient.cs
Normal file
|
@ -0,0 +1,52 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using E7.Introloop;
|
||||
|
||||
public class Ambient : SingletonMonoBehaviour<Ambient> {
|
||||
|
||||
public IntroloopPlayer introloopPlayer;
|
||||
public IntroloopAudio[] introloopAudio;
|
||||
private int playingIndex = -1;
|
||||
|
||||
protected override void Awake() {
|
||||
if (CheckInstance()) {
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public int GetPlayingIndex() {
|
||||
return playingIndex;
|
||||
}
|
||||
|
||||
public void Play(int index, float fadeTime = 0.3f) {
|
||||
if (introloopPlayer != null) {
|
||||
if (index >= 0) {
|
||||
if (introloopAudio.Length > index && introloopAudio[index] != null && playingIndex != index) {
|
||||
introloopPlayer.Play(introloopAudio[index], fadeTime);
|
||||
}
|
||||
} else {
|
||||
introloopPlayer.Stop(fadeTime);
|
||||
}
|
||||
playingIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
public void Replay() {
|
||||
int playSave = playingIndex;
|
||||
playingIndex = -1;
|
||||
Play(playSave);
|
||||
}
|
||||
|
||||
public void Stop() {
|
||||
introloopPlayer.Stop();
|
||||
playingIndex = -1;
|
||||
}
|
||||
|
||||
public void StopFade(float fadeTime) {
|
||||
introloopPlayer.Stop(fadeTime);
|
||||
playingIndex = -1;
|
||||
}
|
||||
|
||||
|
||||
}
|
61
Script/AnimHash.cs
Normal file
61
Script/AnimHash.cs
Normal file
|
@ -0,0 +1,61 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class AnimHash : SingletonMonoBehaviour<AnimHash> {
|
||||
|
||||
[System.NonSerialized]
|
||||
public int[] ID;
|
||||
|
||||
public enum ParamName {
|
||||
Speed, IdleType, AnimSpeed, Jump, JumpType, Landing, SideStep, StepDirection, QuickTurn, Move, Back, Run, Refresh, KnockLight, KnockHeavy,
|
||||
Dead, Attack, AttackType, AttackSpeed, RotSpeed, WalkSpeed, IdleMotion, Climb, Curve, Fear, Smile, Drown, DrownTolerance, KnockRestoreSpeed, HomeAction, Spawn, DeadSpecial, StateFriendsIdle, StateFriendsIdle1, StateFriendsIdle2, StateFriendsRefresh, StateEnemyIdle, StateIFRIdle
|
||||
}
|
||||
|
||||
protected virtual void SetAnimHashID() {
|
||||
ID = new int[System.Enum.GetValues(typeof(ParamName)).Length];
|
||||
ID[(int)ParamName.Speed] = Animator.StringToHash("Speed");
|
||||
ID[(int)ParamName.IdleType] = Animator.StringToHash("IdleType");
|
||||
ID[(int)ParamName.AnimSpeed] = Animator.StringToHash("AnimSpeed");
|
||||
ID[(int)ParamName.Jump] = Animator.StringToHash("Jump");
|
||||
ID[(int)ParamName.JumpType] = Animator.StringToHash("JumpType");
|
||||
ID[(int)ParamName.Landing] = Animator.StringToHash("Landing");
|
||||
ID[(int)ParamName.SideStep] = Animator.StringToHash("SideStep");
|
||||
ID[(int)ParamName.StepDirection] = Animator.StringToHash("StepDirection");
|
||||
ID[(int)ParamName.QuickTurn] = Animator.StringToHash("QuickTurn");
|
||||
ID[(int)ParamName.Move] = Animator.StringToHash("Move");
|
||||
ID[(int)ParamName.Back] = Animator.StringToHash("Back");
|
||||
ID[(int)ParamName.Run] = Animator.StringToHash("Run");
|
||||
ID[(int)ParamName.Refresh] = Animator.StringToHash("Refresh");
|
||||
ID[(int)ParamName.KnockLight] = Animator.StringToHash("KnockLight");
|
||||
ID[(int)ParamName.KnockHeavy] = Animator.StringToHash("KnockHeavy");
|
||||
ID[(int)ParamName.Dead] = Animator.StringToHash("Dead");
|
||||
ID[(int)ParamName.Attack] = Animator.StringToHash("Attack");
|
||||
ID[(int)ParamName.AttackType] = Animator.StringToHash("AttackType");
|
||||
ID[(int)ParamName.AttackSpeed] = Animator.StringToHash("AttackSpeed");
|
||||
ID[(int)ParamName.RotSpeed] = Animator.StringToHash("RotSpeed");
|
||||
ID[(int)ParamName.WalkSpeed] = Animator.StringToHash("WalkSpeed");
|
||||
ID[(int)ParamName.IdleMotion] = Animator.StringToHash("IdleMotion");
|
||||
ID[(int)ParamName.Climb] = Animator.StringToHash("Climb");
|
||||
ID[(int)ParamName.Curve] = Animator.StringToHash("Curve");
|
||||
ID[(int)ParamName.Fear] = Animator.StringToHash("Fear");
|
||||
ID[(int)ParamName.Smile] = Animator.StringToHash("Smile");
|
||||
ID[(int)ParamName.Drown] = Animator.StringToHash("Drown");
|
||||
ID[(int)ParamName.DrownTolerance] = Animator.StringToHash("DrownTolerance");
|
||||
ID[(int)ParamName.KnockRestoreSpeed] = Animator.StringToHash("KnockRestoreSpeed");
|
||||
ID[(int)ParamName.HomeAction] = Animator.StringToHash("HomeAction");
|
||||
ID[(int)ParamName.Spawn] = Animator.StringToHash("Spawn");
|
||||
ID[(int)ParamName.DeadSpecial] = Animator.StringToHash("DeadSpecial");
|
||||
ID[(int)ParamName.StateFriendsIdle] = Animator.StringToHash("Base Layer.Locomotion.Idle");
|
||||
ID[(int)ParamName.StateFriendsIdle1] = Animator.StringToHash("Base Layer.Locomotion.Idle1");
|
||||
ID[(int)ParamName.StateFriendsIdle2] = Animator.StringToHash("Base Layer.Locomotion.Idle2");
|
||||
ID[(int)ParamName.StateFriendsRefresh] = Animator.StringToHash("Base Layer.Locomotion.Refresh");
|
||||
ID[(int)ParamName.StateEnemyIdle] = Animator.StringToHash("Base Layer.Idle");
|
||||
ID[(int)ParamName.StateIFRIdle] = Animator.StringToHash("Base Layer.Idle");
|
||||
}
|
||||
|
||||
protected override void Awake () {
|
||||
if (CheckInstance()) {
|
||||
DontDestroyOnLoad(gameObject);
|
||||
SetAnimHashID();
|
||||
}
|
||||
}
|
||||
}
|
40
Script/AnimationWing.cs
Normal file
40
Script/AnimationWing.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AnimationWing : MonoBehaviour {
|
||||
|
||||
public Vector3 targetRotation;
|
||||
public bool forLocalEuler;
|
||||
|
||||
MMD4MecanimBone bone;
|
||||
Animator anim;
|
||||
Transform trans;
|
||||
Quaternion boneRotation;
|
||||
int hash;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
anim = GetComponentInParent<Animator>();
|
||||
bone = GetComponent<MMD4MecanimBone>();
|
||||
trans = transform;
|
||||
if (AnimHash.Instance) {
|
||||
hash = AnimHash.Instance.ID[(int)AnimHash.ParamName.Curve];
|
||||
}
|
||||
}
|
||||
|
||||
void Update () {
|
||||
if (anim && hash != 0) {
|
||||
if (forLocalEuler) {
|
||||
Vector3 eulerTemp = targetRotation * anim.GetFloat(hash);
|
||||
trans.localEulerAngles = eulerTemp;
|
||||
} else {
|
||||
boneRotation = Quaternion.Euler(targetRotation * anim.GetFloat(hash));
|
||||
if (bone) {
|
||||
bone.userRotation = boneRotation;
|
||||
}
|
||||
trans.localRotation = boneRotation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
17
Script/AnimationWingVariation.cs
Normal file
17
Script/AnimationWingVariation.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AnimationWingVariation : AnimationWing {
|
||||
|
||||
public Vector3[] rotationArray;
|
||||
private int nowIndex = -1;
|
||||
|
||||
public void ChangeRotation(int index) {
|
||||
if (nowIndex != index && index >= 0 && index < rotationArray.Length) {
|
||||
nowIndex = index;
|
||||
targetRotation = rotationArray[nowIndex];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
635
Script/AttackDetection.cs
Normal file
635
Script/AttackDetection.cs
Normal file
|
@ -0,0 +1,635 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using XftWeapon;
|
||||
|
||||
public class AttackDetection : MonoBehaviour {
|
||||
|
||||
public enum ElementalAttribute { None, Bolt, Fire, Earth };
|
||||
public enum ReportType { None, Judgement, Hippo, PrairieDog, DarkWave, DarkInferno };
|
||||
protected const int receiverMax = 32;
|
||||
protected const int preservedMax = 8;
|
||||
protected const int notExistID = -1;
|
||||
protected static readonly Vector3 vecZero = Vector3.zero;
|
||||
protected static readonly Quaternion quaIden = Quaternion.identity;
|
||||
|
||||
protected class DamageReceiver {
|
||||
public int characterId;
|
||||
public DamageDetection[] preservedDD;
|
||||
public float forgetTime;
|
||||
public int count;
|
||||
public DamageReceiver() {
|
||||
characterId = notExistID;
|
||||
preservedDD = new DamageDetection[preservedMax];
|
||||
forgetTime = 0f;
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public AudioSourcePool.AudioName poolAudioName;
|
||||
public GameObject attackEffect;
|
||||
public GameObject endEffect;
|
||||
public Vector3 offset;
|
||||
public bool effectParenting;
|
||||
public bool isEffectOnly;
|
||||
public string targetTag;
|
||||
public float attackRate = 1;
|
||||
public float knockRate = 1;
|
||||
public float damageRate = 1;
|
||||
public float multiHitInterval;
|
||||
public int multiHitMaxCount;
|
||||
public int relationIndex = -1;
|
||||
public XWeaponTrail[] xWeaponTrails;
|
||||
public ParticleSystem[] particles;
|
||||
public ParticleSystem[] s_particles;
|
||||
public float particleStopDelay;
|
||||
public float s_particleStopDelay;
|
||||
public bool independenceOnAwake;
|
||||
public bool ignoreParentMultiplier;
|
||||
public bool selectTopDamageRate;
|
||||
public bool penetrate;
|
||||
public bool isProjectile;
|
||||
public int overrideColorType = -1;
|
||||
public ReportType reportType;
|
||||
|
||||
[System.NonSerialized]
|
||||
public bool attackEnabled;
|
||||
[System.NonSerialized]
|
||||
public CharacterBase parentCBase;
|
||||
[System.NonSerialized]
|
||||
public ElementalAttribute elementalAttribute;
|
||||
[System.NonSerialized]
|
||||
public bool unleashed;
|
||||
|
||||
protected AttackDetection mySelf;
|
||||
protected Transform trans;
|
||||
protected Collider[] selfCollider;
|
||||
protected DamageDetection targetDD;
|
||||
protected DamageReceiver[] damageReceiver = new DamageReceiver[receiverMax];
|
||||
protected int[] hitReservedIndex = new int[receiverMax];
|
||||
protected int hitReservedCount;
|
||||
protected Vector3 closestPoint;
|
||||
protected Vector3 direction;
|
||||
protected float particleRemainTime;
|
||||
protected float s_particleRemainTime;
|
||||
protected float attackPowerSave;
|
||||
protected float knockPowerSave;
|
||||
protected int startProgress;
|
||||
protected bool checkParentSuperman;
|
||||
protected Collider[] targetColliders;
|
||||
protected bool[] checkFlags = new bool[preservedMax];
|
||||
protected float[] checkParams = new float[preservedMax];
|
||||
protected const float oneFrameSec = 1f / 60f;
|
||||
protected bool parentIsFriend;
|
||||
|
||||
protected virtual void AwakeProcess() {
|
||||
trans = transform;
|
||||
mySelf = this;
|
||||
if (parentCBase == null) {
|
||||
parentCBase = GetComponentInParent<CharacterBase>();
|
||||
}
|
||||
selfCollider = GetComponents<Collider>();
|
||||
if (selfCollider.Length > 0) {
|
||||
for (int i = 0; i < selfCollider.Length; i++) {
|
||||
selfCollider[i].enabled = false;
|
||||
}
|
||||
}
|
||||
if (independenceOnAwake && parentCBase) {
|
||||
attackPowerSave = parentCBase.GetAttack(ignoreParentMultiplier);
|
||||
knockPowerSave = parentCBase.GetKnock(ignoreParentMultiplier);
|
||||
}
|
||||
for (int i = 0; i < receiverMax; i++) {
|
||||
damageReceiver[i] = new DamageReceiver();
|
||||
hitReservedIndex[i] = -1;
|
||||
}
|
||||
if (parentCBase && !parentCBase.isEnemy && !parentCBase.isPlayer) {
|
||||
parentIsFriend = true;
|
||||
}
|
||||
startProgress = 1;
|
||||
}
|
||||
|
||||
protected virtual void StartProcess() {
|
||||
if (xWeaponTrails != null) {
|
||||
for (int i = 0; i < xWeaponTrails.Length; i++) {
|
||||
if (xWeaponTrails[i]) {
|
||||
xWeaponTrails[i].Init();
|
||||
xWeaponTrails[i].Deactivate();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (particles != null && particles.Length > 0) {
|
||||
for (int i = 0; i < particles.Length; i++) {
|
||||
if (particles[i]) {
|
||||
particles[i].Stop();
|
||||
particles[i].Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (s_particles != null && s_particles.Length > 0) {
|
||||
for (int i = 0; i < s_particles.Length; i++) {
|
||||
if (s_particles[i]) {
|
||||
s_particles[i].Stop();
|
||||
s_particles[i].Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
startProgress = 2;
|
||||
}
|
||||
|
||||
protected virtual void Awake() {
|
||||
if (startProgress == 0) {
|
||||
AwakeProcess();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Start() {
|
||||
if (startProgress == 0) {
|
||||
AwakeProcess();
|
||||
}
|
||||
if (startProgress == 1) {
|
||||
StartProcess();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Update() {
|
||||
UpdateReceiver();
|
||||
if (!attackEnabled) {
|
||||
if (particleStopDelay > 0f && particleRemainTime > 0f) {
|
||||
particleRemainTime -= Time.deltaTime;
|
||||
if (particleRemainTime <= 0) {
|
||||
ParticlesStop();
|
||||
}
|
||||
}
|
||||
if (checkParentSuperman) {
|
||||
if (!parentCBase || !parentCBase.isSuperman) {
|
||||
S_ParticlesStop();
|
||||
}
|
||||
}
|
||||
if (s_particleStopDelay > 0f && s_particleRemainTime > 0f) {
|
||||
s_particleRemainTime -= Time.deltaTime;
|
||||
if (s_particleRemainTime <= 0f) {
|
||||
S_ParticlesStop();
|
||||
}
|
||||
}
|
||||
} else if (hitReservedCount > 0) {
|
||||
for (int i = 0; i < hitReservedCount; i++) {
|
||||
int index = hitReservedIndex[i];
|
||||
int answer = -2;
|
||||
if (index >= 0) {
|
||||
for (int j = 0; j < preservedMax; j++) {
|
||||
checkFlags[j] = (damageReceiver[index].preservedDD[j] != null);
|
||||
if (checkFlags[j]) {
|
||||
if (answer == -2) {
|
||||
answer = j;
|
||||
} else if (answer >= 0) {
|
||||
answer = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (answer == -1) {
|
||||
if (selectTopDamageRate) {
|
||||
answer = SelectWithDamageRate(index, false);
|
||||
if (answer == -1) {
|
||||
answer = SelectWithDamageRate(index, true);
|
||||
if (answer == -1) {
|
||||
answer = SelectWithDistance(index);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
answer = SelectWithDistance(index);
|
||||
if (answer == -1) {
|
||||
answer = SelectWithDamageRate(index, false);
|
||||
if (answer == -1) {
|
||||
answer = SelectWithDamageRate(index, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (answer < 0) {
|
||||
for (int j = 0; j < preservedMax; j++) {
|
||||
if (checkFlags[j]) {
|
||||
HitAttack(ref damageReceiver[index].preservedDD[j]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
HitAttack(ref damageReceiver[index].preservedDD[answer]);
|
||||
}
|
||||
hitReservedIndex[i] = -1;
|
||||
}
|
||||
}
|
||||
hitReservedCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other) {
|
||||
if (!isEffectOnly && (parentCBase || independenceOnAwake) && other.CompareTag(targetTag)) {
|
||||
WorkEnter(other.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other) {
|
||||
if (!isEffectOnly && (parentCBase || independenceOnAwake) && other.CompareTag(targetTag)) {
|
||||
WorkExit(other.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void WorkEnter(GameObject other) {
|
||||
if (attackEnabled) {
|
||||
targetDD = other.GetComponent<DamageDetection>();
|
||||
if (targetDD) {
|
||||
ConsiderHit(ref targetDD, true);
|
||||
if (relationIndex >= 0 && parentCBase) {
|
||||
parentCBase.ConsiderHitAttackDetection(relationIndex, ref targetDD);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void WorkExit(GameObject other) {
|
||||
targetDD = other.GetComponent<DamageDetection>();
|
||||
if (targetDD) {
|
||||
for (int i = 0; i < receiverMax; i++) {
|
||||
if (damageReceiver[i].characterId == targetDD.characterId) {
|
||||
for (int j = 0; j < preservedMax; j++) {
|
||||
if (damageReceiver[i].preservedDD[j] == targetDD) {
|
||||
damageReceiver[i].preservedDD[j] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ConsiderHit(ref DamageDetection targetDD, bool hitAttackEnabled) {
|
||||
int receiverBlank = -1;
|
||||
bool receiverExist = false;
|
||||
for (int i = 0; i < receiverMax; i++) {
|
||||
if (damageReceiver[i].characterId == notExistID) {
|
||||
if (receiverBlank < 0) {
|
||||
receiverBlank = i;
|
||||
}
|
||||
} else if (damageReceiver[i].characterId == targetDD.characterId) {
|
||||
int preservedBlank = -1;
|
||||
bool preservedExist = false;
|
||||
receiverExist = true;
|
||||
for (int j = 0; j < preservedMax; j++) {
|
||||
if (damageReceiver[i].preservedDD[j] == null) {
|
||||
if (preservedBlank < 0) {
|
||||
preservedBlank = j;
|
||||
}
|
||||
} else if (damageReceiver[i].preservedDD[j] == targetDD) {
|
||||
preservedExist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!preservedExist && preservedBlank >= 0) {
|
||||
damageReceiver[i].preservedDD[preservedBlank] = targetDD;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!receiverExist && receiverBlank >= 0) {
|
||||
if (hitAttackEnabled && hitReservedCount < hitReservedIndex.Length) {
|
||||
hitReservedIndex[hitReservedCount] = receiverBlank;
|
||||
hitReservedCount++;
|
||||
}
|
||||
damageReceiver[receiverBlank].characterId = targetDD.characterId;
|
||||
damageReceiver[receiverBlank].preservedDD[0] = targetDD;
|
||||
for (int i = 1; i < preservedMax; i++) {
|
||||
damageReceiver[receiverBlank].preservedDD[i] = null;
|
||||
}
|
||||
damageReceiver[receiverBlank].forgetTime = multiHitInterval;
|
||||
damageReceiver[receiverBlank].count = (multiHitInterval <= 0.01f ? 100 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
int SelectWithDistance(int index) {
|
||||
float minSqrDist = float.MaxValue;
|
||||
Vector3 pos = trans.position;
|
||||
int answer = -2;
|
||||
for (int i = 0; i < preservedMax; i++) {
|
||||
if (checkFlags[i]) {
|
||||
checkParams[i] = (GetClosestPoint(ref damageReceiver[index].preservedDD[i]) - pos).sqrMagnitude;
|
||||
if (checkParams[i] < minSqrDist) {
|
||||
minSqrDist = checkParams[i];
|
||||
}
|
||||
} else {
|
||||
checkParams[i] = float.MaxValue;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < preservedMax; i++) {
|
||||
if (checkFlags[i]) {
|
||||
if (checkParams[i] > minSqrDist) {
|
||||
checkFlags[i] = false;
|
||||
} else {
|
||||
if (answer == -2) {
|
||||
answer = i;
|
||||
} else if (answer >= 0) {
|
||||
answer = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
|
||||
int SelectWithDamageRate(int index, bool forKnocked = false) {
|
||||
float maxRate = float.MinValue;
|
||||
int answer = -2;
|
||||
for (int i = 0; i < preservedMax; i++) {
|
||||
if (checkFlags[i]) {
|
||||
checkParams[i] = forKnocked ? damageReceiver[index].preservedDD[i].knockedRate : damageReceiver[index].preservedDD[i].damageRate;
|
||||
if (checkParams[i] > maxRate) {
|
||||
maxRate = checkParams[i];
|
||||
}
|
||||
} else {
|
||||
checkParams[i] = float.MinValue;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < preservedMax; i++) {
|
||||
if (checkFlags[i]) {
|
||||
if (checkParams[i] < maxRate) {
|
||||
checkFlags[i] = false;
|
||||
} else {
|
||||
if (answer == -2) {
|
||||
answer = i;
|
||||
} else if (answer >= 0) {
|
||||
answer = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
|
||||
protected virtual void UpdateReceiver() {
|
||||
if (!isEffectOnly && multiHitInterval > 0.01f) {
|
||||
float deltaTimeCache = Time.deltaTime;
|
||||
for (int i = 0; i < receiverMax; i++) {
|
||||
if (damageReceiver[i].characterId != notExistID && (multiHitMaxCount <= 0 || damageReceiver[i].count < multiHitMaxCount)) {
|
||||
damageReceiver[i].forgetTime -= deltaTimeCache;
|
||||
if (damageReceiver[i].forgetTime <= 0f) {
|
||||
bool ddExist = false;
|
||||
for (int j = 0; j < preservedMax; j++) {
|
||||
if (damageReceiver[i].preservedDD[j]) {
|
||||
if (damageReceiver[i].preservedDD[j].gameObject.activeInHierarchy) {
|
||||
ddExist = true;
|
||||
} else {
|
||||
damageReceiver[i].preservedDD[j] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ddExist && hitReservedCount < hitReservedIndex.Length) {
|
||||
hitReservedIndex[hitReservedCount] = i;
|
||||
hitReservedCount++;
|
||||
if (damageReceiver[i].forgetTime < -oneFrameSec) {
|
||||
damageReceiver[i].forgetTime = -oneFrameSec;
|
||||
}
|
||||
damageReceiver[i].forgetTime += multiHitInterval;
|
||||
damageReceiver[i].count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual bool SendDamage(ref DamageDetection damageDetection, ref Vector3 closestPoint, ref Vector3 direction) {
|
||||
return damageDetection.ReceiveDamage(ref closestPoint, Mathf.RoundToInt(Mathf.Max(1f, CharacterBase.CalcDamage((independenceOnAwake ? attackPowerSave : parentCBase.GetAttack(ignoreParentMultiplier)) * attackRate * damageDetection.damageRate, damageDetection.GetDefence()) * damageRate)), (independenceOnAwake ? knockPowerSave : parentCBase.GetKnock(ignoreParentMultiplier)) * knockRate, ref direction, mySelf, penetrate, overrideColorType);
|
||||
}
|
||||
|
||||
protected virtual Vector3 GetClosestPoint(ref DamageDetection targetDD) {
|
||||
if (targetDD.specialCollider != null) {
|
||||
return targetDD.specialCollider.ClosestPoint(trans.position);
|
||||
} else {
|
||||
targetColliders = targetDD.GetComponents<Collider>();
|
||||
if (targetColliders.Length == 1) {
|
||||
return targetColliders[0].ClosestPoint(trans.position);
|
||||
} else if (targetColliders.Length > 1) {
|
||||
float sqrDistMax = float.MaxValue;
|
||||
Vector3 transPos = trans.position;
|
||||
Vector3 answer = transPos;
|
||||
for (int i = 0; i < targetColliders.Length; i++) {
|
||||
Vector3 point = targetColliders[i].ClosestPoint(transPos);
|
||||
float sqrDistTemp = (point - transPos).sqrMagnitude;
|
||||
if (sqrDistTemp < sqrDistMax) {
|
||||
sqrDistMax = sqrDistTemp;
|
||||
answer = point;
|
||||
}
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
}
|
||||
return Vector3.Lerp(targetDD.transform.position, trans.position, 0.5f);
|
||||
}
|
||||
|
||||
protected virtual void HitAttack(ref DamageDetection targetDD) {
|
||||
closestPoint = GetClosestPoint(ref targetDD);
|
||||
direction = targetDD.transform.position - trans.position;
|
||||
MyMath.NormalizeXZ(ref direction);
|
||||
SendDamage(ref targetDD, ref closestPoint, ref direction);
|
||||
}
|
||||
|
||||
public virtual void DetectionStart(bool effectEnabled = true, bool weaponTrailsEnabled = true) {
|
||||
if (startProgress == 0) {
|
||||
AwakeProcess();
|
||||
}
|
||||
if (startProgress == 1) {
|
||||
StartProcess();
|
||||
}
|
||||
hitReservedCount = 0;
|
||||
attackEnabled = true;
|
||||
for (int i = 0; i < damageReceiver.Length; i++) {
|
||||
damageReceiver[i].characterId = notExistID;
|
||||
}
|
||||
if (selfCollider != null && selfCollider.Length > 0) {
|
||||
for (int i = 0; i < selfCollider.Length; i++) {
|
||||
if (selfCollider[i]) {
|
||||
selfCollider[i].enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (effectEnabled && attackEffect) {
|
||||
Vector3 offsetTemp = vecZero;
|
||||
if (offset != vecZero && parentCBase) {
|
||||
offsetTemp = parentCBase.transform.TransformDirection(offset);
|
||||
}
|
||||
if (parentIsFriend && GameManager.Instance.save.config[GameManager.Save.configID_ObscureFriends] != 0) {
|
||||
GameObject objTemp;
|
||||
if (effectParenting) {
|
||||
objTemp = Instantiate(attackEffect, trans.position + offsetTemp, trans.rotation, trans);
|
||||
} else {
|
||||
objTemp = Instantiate(attackEffect, trans.position + offsetTemp, quaIden);
|
||||
}
|
||||
AudioSource audioTemp = objTemp.GetComponent<AudioSource>();
|
||||
if (audioTemp) {
|
||||
audioTemp.volume *= CharacterManager.Instance.GetObscureRateAudio();
|
||||
}
|
||||
} else {
|
||||
if (effectParenting) {
|
||||
Instantiate(attackEffect, trans.position + offsetTemp, trans.rotation, trans);
|
||||
} else {
|
||||
Instantiate(attackEffect, trans.position + offsetTemp, quaIden);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (effectEnabled && poolAudioName != AudioSourcePool.AudioName.None && AudioSourcePool.Instance) {
|
||||
AudioSourcePool.Instance.Play(poolAudioName, trans.position);
|
||||
}
|
||||
if (weaponTrailsEnabled && xWeaponTrails != null) {
|
||||
for (int i = 0; i < xWeaponTrails.Length; i++) {
|
||||
if (xWeaponTrails[i]) {
|
||||
xWeaponTrails[i].Activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
ParticlesPlay();
|
||||
S_ParticlesPlay();
|
||||
}
|
||||
|
||||
public virtual void DetectionEnd(bool effectEnabled = true, bool weaponTrailsEnabled = true) {
|
||||
if (startProgress == 0) {
|
||||
AwakeProcess();
|
||||
}
|
||||
if (startProgress == 1) {
|
||||
StartProcess();
|
||||
}
|
||||
hitReservedCount = 0;
|
||||
attackEnabled = false;
|
||||
for (int i = 0; i < damageReceiver.Length; i++) {
|
||||
damageReceiver[i].characterId = notExistID;
|
||||
}
|
||||
if (selfCollider != null && selfCollider.Length > 0) {
|
||||
for (int i = 0; i < selfCollider.Length; i++) {
|
||||
if (selfCollider[i]) {
|
||||
selfCollider[i].enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (effectEnabled && endEffect) {
|
||||
if (parentIsFriend && GameManager.Instance.save.config[GameManager.Save.configID_ObscureFriends] >= 2) {
|
||||
GameObject objTemp;
|
||||
if (effectParenting) {
|
||||
objTemp = Instantiate(endEffect, trans.position, quaIden, trans);
|
||||
} else {
|
||||
objTemp = Instantiate(endEffect, trans.position, quaIden);
|
||||
}
|
||||
AudioSource audioTemp = objTemp.GetComponent<AudioSource>();
|
||||
if (audioTemp) {
|
||||
audioTemp.volume *= CharacterManager.Instance.GetObscureRateAudio();
|
||||
}
|
||||
} else {
|
||||
if (effectParenting) {
|
||||
Instantiate(endEffect, trans.position, quaIden, trans);
|
||||
} else {
|
||||
Instantiate(endEffect, trans.position, quaIden);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (weaponTrailsEnabled && xWeaponTrails != null) {
|
||||
for (int i = 0; i < xWeaponTrails.Length; i++) {
|
||||
if (xWeaponTrails[i]) {
|
||||
xWeaponTrails[i].StopSmoothly(0.1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (particleStopDelay <= 0f) {
|
||||
ParticlesStop();
|
||||
} else {
|
||||
particleRemainTime = particleStopDelay;
|
||||
}
|
||||
if (s_particleStopDelay <= 0f) {
|
||||
S_ParticlesStop();
|
||||
} else {
|
||||
s_particleRemainTime = s_particleStopDelay;
|
||||
}
|
||||
}
|
||||
|
||||
public void ActivateXWeaponTrails() {
|
||||
if (xWeaponTrails != null) {
|
||||
for (int i = 0; i < xWeaponTrails.Length; i++) {
|
||||
if (xWeaponTrails[i]) {
|
||||
xWeaponTrails[i].Activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ParticlesPlay() {
|
||||
if (particles != null && particles.Length > 0) {
|
||||
for (int i = 0; i < particles.Length; i++) {
|
||||
if (particles[i]) {
|
||||
particles[i].Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ParticlesStop() {
|
||||
if (particles != null && particles.Length > 0) {
|
||||
for (int i = 0; i < particles.Length; i++) {
|
||||
if (particles[i]) {
|
||||
particles[i].Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void S_ParticlesPlay() {
|
||||
if (s_particles != null && s_particles.Length > 0 && parentCBase && parentCBase.isSuperman) {
|
||||
for (int i = 0; i < s_particles.Length; i++) {
|
||||
if (s_particles[i]) {
|
||||
s_particles[i].Play();
|
||||
}
|
||||
}
|
||||
checkParentSuperman = true;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void S_ParticlesStop() {
|
||||
if (s_particles != null && s_particles.Length > 0) {
|
||||
for (int i = 0; i < s_particles.Length; i++) {
|
||||
if (s_particles[i]) {
|
||||
s_particles[i].Stop();
|
||||
}
|
||||
}
|
||||
s_particleRemainTime = -1f;
|
||||
checkParentSuperman = false;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void XWeaponTrailsStop() {
|
||||
if (xWeaponTrails != null) {
|
||||
for (int i = 0; i < xWeaponTrails.Length; i++) {
|
||||
if (xWeaponTrails[i]) {
|
||||
xWeaponTrails[i].Init();
|
||||
xWeaponTrails[i].Deactivate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetParentCharacterBase(CharacterBase cBase) {
|
||||
parentCBase = cBase;
|
||||
if (independenceOnAwake && parentCBase) {
|
||||
attackPowerSave = parentCBase.GetAttack(ignoreParentMultiplier);
|
||||
knockPowerSave = parentCBase.GetKnock(ignoreParentMultiplier);
|
||||
}
|
||||
}
|
||||
|
||||
public CharacterBase GetParentCharacterBase() {
|
||||
return parentCBase;
|
||||
}
|
||||
|
||||
protected virtual void OnEnable() {
|
||||
if (!isProjectile) {
|
||||
DetectionEnd(false, false);
|
||||
ParticlesStop();
|
||||
S_ParticlesStop();
|
||||
XWeaponTrailsStop();
|
||||
particleRemainTime = 0f;
|
||||
s_particleRemainTime = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
36
Script/AttackDetectionAdditiveCollider.cs
Normal file
36
Script/AttackDetectionAdditiveCollider.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AttackDetectionAdditiveCollider : AttackDetection {
|
||||
|
||||
public Collider[] additiveCollider;
|
||||
|
||||
protected override void AwakeProcess() {
|
||||
base.AwakeProcess();
|
||||
for (int i = 0; i < additiveCollider.Length; i++) {
|
||||
if (additiveCollider[i]) {
|
||||
additiveCollider[i].enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void DetectionStart(bool effectEnabled = true, bool weaponTrailsEnabled = true) {
|
||||
base.DetectionStart(effectEnabled, weaponTrailsEnabled);
|
||||
for (int i = 0; i < additiveCollider.Length; i++) {
|
||||
if (additiveCollider[i]) {
|
||||
additiveCollider[i].enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void DetectionEnd(bool effectEnabled = true, bool weaponTrailsEnabled = true) {
|
||||
base.DetectionEnd(effectEnabled, weaponTrailsEnabled);
|
||||
for (int i = 0; i < additiveCollider.Length; i++) {
|
||||
if (additiveCollider[i]) {
|
||||
additiveCollider[i].enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
20
Script/AttackDetectionMustKnock.cs
Normal file
20
Script/AttackDetectionMustKnock.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AttackDetectionMustKnock : AttackDetectionPlayer {
|
||||
|
||||
protected override bool SendDamage(ref DamageDetection damageDetection, ref Vector3 closestPoint, ref Vector3 direction) {
|
||||
bool answer = false;
|
||||
CharacterBase damageCBase = damageDetection.GetCharacterBase();
|
||||
if (damageCBase && (!damageCBase.isBoss || (damageCBase.mustKnockEffectiveEnabled && damageDetection.colorType == CharacterBase.damageColor_Effective))) {
|
||||
damageCBase.mustKnockBackFlag = true;
|
||||
}
|
||||
answer = base.SendDamage(ref damageDetection, ref closestPoint, ref direction);
|
||||
if (damageCBase) {
|
||||
damageCBase.mustKnockBackFlag = false;
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
|
||||
}
|
76
Script/AttackDetectionParticle.cs
Normal file
76
Script/AttackDetectionParticle.cs
Normal file
|
@ -0,0 +1,76 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AttackDetectionParticle : AttackDetectionSick {
|
||||
|
||||
public bool forgetDamageReceiver = false;
|
||||
public int attackParticleIndex = 0;
|
||||
|
||||
List<ParticleCollisionEvent> collisionEvents;
|
||||
|
||||
protected override void StartProcess() {
|
||||
base.StartProcess();
|
||||
isProjectile = true;
|
||||
unleashed = true;
|
||||
collisionEvents = new List<ParticleCollisionEvent>();
|
||||
}
|
||||
|
||||
protected override void Update() {
|
||||
if (forgetDamageReceiver) {
|
||||
for (int i = 0; i < damageReceiver.Length; i++) {
|
||||
damageReceiver[i].characterId = notExistID;
|
||||
}
|
||||
}
|
||||
base.Update();
|
||||
}
|
||||
|
||||
protected override Vector3 GetClosestPoint(ref DamageDetection targetDD) {
|
||||
if (particles.Length > attackParticleIndex) {
|
||||
int numCollisionEvents = particles[attackParticleIndex].GetCollisionEvents(targetDD.gameObject, collisionEvents);
|
||||
if (numCollisionEvents > 0) {
|
||||
float minDist = float.MaxValue;
|
||||
Transform targetTrans = targetDD.transform;
|
||||
int answerIndex = 0;
|
||||
for (int i = 0; i < numCollisionEvents; i++) {
|
||||
float tempDist = (collisionEvents[i].intersection - targetTrans.position).sqrMagnitude;
|
||||
if (tempDist < minDist) {
|
||||
answerIndex = i;
|
||||
tempDist = minDist;
|
||||
}
|
||||
}
|
||||
return collisionEvents[answerIndex].intersection;
|
||||
}
|
||||
}
|
||||
return base.GetClosestPoint(ref targetDD);
|
||||
}
|
||||
|
||||
public override void WorkEnter(GameObject other) {
|
||||
if (attackEnabled) {
|
||||
targetDD = other.GetComponent<DamageDetection>();
|
||||
if (targetDD) {
|
||||
bool justDodged = false;
|
||||
CharacterBase targetCBase = targetDD.GetCharacterBase();
|
||||
if (targetCBase != null && targetCBase.isPlayer) {
|
||||
PlayerController targetPCon = targetCBase.GetComponent<PlayerController>();
|
||||
if (targetPCon) {
|
||||
justDodged = targetPCon.ReceiveParticleJustDodge(this);
|
||||
}
|
||||
}
|
||||
if (!justDodged) {
|
||||
ConsiderHit(ref targetDD, true);
|
||||
if (relationIndex >= 0 && parentCBase) {
|
||||
parentCBase.ConsiderHitAttackDetection(relationIndex, ref targetDD);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnParticleCollision(GameObject other) {
|
||||
if (!isEffectOnly && (parentCBase || independenceOnAwake) && other.CompareTag(targetTag)) {
|
||||
WorkEnter(other);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
30
Script/AttackDetectionParticleImmediateHit.cs
Normal file
30
Script/AttackDetectionParticleImmediateHit.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AttackDetectionParticleImmediateHit : AttackDetectionParticle {
|
||||
|
||||
public bool destroyOnHit;
|
||||
|
||||
protected override void Start() {
|
||||
base.Start();
|
||||
ParticlesPlay();
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
protected override void Update() {
|
||||
}
|
||||
|
||||
public override void WorkEnter(GameObject other) {
|
||||
if (other.CompareTag(targetTag)) {
|
||||
targetDD = other.GetComponent<DamageDetection>();
|
||||
if (targetDD) {
|
||||
HitAttack(ref targetDD);
|
||||
if (destroyOnHit) {
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
117
Script/AttackDetectionPlayer.cs
Normal file
117
Script/AttackDetectionPlayer.cs
Normal file
|
@ -0,0 +1,117 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using XftWeapon;
|
||||
|
||||
public class AttackDetectionPlayer : AttackDetection {
|
||||
|
||||
bool longFlag = false;
|
||||
CapsuleCollider selfCapCol;
|
||||
GameObject giraffeBeamInstance;
|
||||
Vector3 defCenter;
|
||||
float defRadius;
|
||||
float defHeight;
|
||||
protected bool defSelect;
|
||||
protected int defDirection;
|
||||
bool isPlayer = false;
|
||||
|
||||
public bool overrideLongEnabled;
|
||||
[System.Serializable]
|
||||
public class OverrideLongSettings {
|
||||
public Vector3 longCenter;
|
||||
public float longRadius;
|
||||
public float longHeight;
|
||||
public int longDirection;
|
||||
public GameObject giraffeBeam;
|
||||
}
|
||||
public OverrideLongSettings overrideLongSettings;
|
||||
public bool forHyper;
|
||||
|
||||
Vector3 longCenter = new Vector3(0, -2.4f, 0);
|
||||
const float longRadius = 1.2f;
|
||||
const float longHeight = 7.2f;
|
||||
|
||||
protected virtual void SetColliderSize(bool toLong) {
|
||||
if (selfCapCol) {
|
||||
if (toLong) {
|
||||
if (overrideLongEnabled) {
|
||||
selfCapCol.center = overrideLongSettings.longCenter;
|
||||
selfCapCol.radius = overrideLongSettings.longRadius;
|
||||
selfCapCol.height = overrideLongSettings.longHeight;
|
||||
selfCapCol.direction = overrideLongSettings.longDirection;
|
||||
} else {
|
||||
selfCapCol.center = longCenter;
|
||||
selfCapCol.radius = longRadius;
|
||||
selfCapCol.height = longHeight;
|
||||
}
|
||||
selectTopDamageRate = true;
|
||||
} else {
|
||||
selfCapCol.center = defCenter;
|
||||
selfCapCol.radius = defRadius;
|
||||
selfCapCol.height = defHeight;
|
||||
selfCapCol.direction = defDirection;
|
||||
selectTopDamageRate = defSelect;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void CheckBuff() {
|
||||
if (CharacterManager.Instance) {
|
||||
if (CharacterManager.Instance.GetBuff(CharacterManager.BuffType.Long) || (forHyper && parentCBase && parentCBase.isSuperman)) {
|
||||
if (!longFlag) {
|
||||
SetColliderSize(true);
|
||||
if (!giraffeBeamInstance && EffectDatabase.Instance) {
|
||||
if (overrideLongEnabled) {
|
||||
giraffeBeamInstance = Instantiate(overrideLongSettings.giraffeBeam, transform);
|
||||
} else {
|
||||
giraffeBeamInstance = Instantiate(EffectDatabase.Instance.prefab[(int)EffectDatabase.id.giraffeBeam], transform);
|
||||
}
|
||||
}
|
||||
longFlag = true;
|
||||
}
|
||||
} else {
|
||||
if (longFlag) {
|
||||
SetColliderSize(false);
|
||||
if (giraffeBeamInstance) {
|
||||
Destroy(giraffeBeamInstance);
|
||||
giraffeBeamInstance = null;
|
||||
}
|
||||
longFlag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool SendDamage(ref DamageDetection damageDetection, ref Vector3 closestPoint, ref Vector3 direction) {
|
||||
if (base.SendDamage(ref damageDetection, ref closestPoint, ref direction)) {
|
||||
if (isPlayer) {
|
||||
parentCBase.HitAttackAdditiveProcess();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override void Awake() {
|
||||
base.Awake();
|
||||
defSelect = selectTopDamageRate;
|
||||
}
|
||||
|
||||
protected override void Start () {
|
||||
base.Start();
|
||||
selfCapCol = GetComponent<CapsuleCollider>();
|
||||
if (selfCapCol) {
|
||||
defCenter = selfCapCol.center;
|
||||
defRadius = selfCapCol.radius;
|
||||
defHeight = selfCapCol.height;
|
||||
defDirection = selfCapCol.direction;
|
||||
}
|
||||
isPlayer = parentCBase.isPlayer;
|
||||
}
|
||||
|
||||
protected override void Update () {
|
||||
base.Update();
|
||||
CheckBuff();
|
||||
}
|
||||
|
||||
}
|
37
Script/AttackDetectionPlayerForBox.cs
Normal file
37
Script/AttackDetectionPlayerForBox.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AttackDetectionPlayerForBox : AttackDetectionPlayer {
|
||||
|
||||
public Vector3 boxLongCenter;
|
||||
public Vector3 boxLongSize;
|
||||
|
||||
Vector3 boxDefaultCenter;
|
||||
Vector3 boxDefaultSize;
|
||||
BoxCollider selfBoxCol;
|
||||
|
||||
protected override void SetColliderSize(bool toLong) {
|
||||
if (selfBoxCol) {
|
||||
if (toLong) {
|
||||
selfBoxCol.center = boxLongCenter;
|
||||
selfBoxCol.size = boxLongSize;
|
||||
selectTopDamageRate = true;
|
||||
} else {
|
||||
selfBoxCol.center = boxDefaultCenter;
|
||||
selfBoxCol.size = boxDefaultSize;
|
||||
selectTopDamageRate = defSelect;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Start() {
|
||||
base.Start();
|
||||
selfBoxCol = GetComponent<BoxCollider>();
|
||||
if (selfBoxCol) {
|
||||
boxDefaultCenter = selfBoxCol.center;
|
||||
boxDefaultSize = selfBoxCol.size;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
96
Script/AttackDetectionProjectile.cs
Normal file
96
Script/AttackDetectionProjectile.cs
Normal file
|
@ -0,0 +1,96 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AttackDetectionProjectile : AttackDetectionSick {
|
||||
|
||||
[System.Serializable]
|
||||
public class MovingLimit {
|
||||
public bool enabled = false;
|
||||
public float limitSpeed = 1;
|
||||
public float minDuration = 0.1f;
|
||||
public float delay = 0f;
|
||||
public bool recycle = false;
|
||||
public bool disablizeOnKinematic;
|
||||
}
|
||||
|
||||
public float attackDuration = 5;
|
||||
public float destroyTime = 5;
|
||||
public bool ignoreParentMissing;
|
||||
public GameObject destroyTarget;
|
||||
public MovingLimit movingLimit;
|
||||
|
||||
protected Rigidbody rigid;
|
||||
protected float elapsedTime;
|
||||
protected int shotProgress;
|
||||
protected float recycleTime = 0.1f;
|
||||
protected int kinematicCount;
|
||||
|
||||
protected override void AwakeProcess() {
|
||||
base.AwakeProcess();
|
||||
if (movingLimit.enabled) {
|
||||
rigid = GetComponentInParent<Rigidbody>();
|
||||
}
|
||||
shotProgress = 0;
|
||||
elapsedTime = 0;
|
||||
isProjectile = true;
|
||||
}
|
||||
|
||||
protected bool CheckDestroyCondition() {
|
||||
if (elapsedTime >= destroyTime || (!ignoreParentMissing && !parentCBase) || (movingLimit.enabled && !rigid) || (!ignoreParentMissing && parentCBase && parentCBase.IsThrowCancelling)) {
|
||||
if (shotProgress == 1) {
|
||||
DetectionEnd();
|
||||
}
|
||||
if (destroyTarget) {
|
||||
Destroy(destroyTarget);
|
||||
return true;
|
||||
} else if (transform.parent.gameObject) {
|
||||
Destroy(transform.parent.gameObject);
|
||||
return true;
|
||||
} else {
|
||||
Destroy(gameObject);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void FixedUpdate() {
|
||||
elapsedTime += Time.fixedDeltaTime;
|
||||
if (!CheckDestroyCondition()) {
|
||||
switch (shotProgress) {
|
||||
case 0:
|
||||
if (!movingLimit.enabled || (rigid && rigid.velocity.sqrMagnitude >= movingLimit.limitSpeed * movingLimit.limitSpeed && elapsedTime >= movingLimit.delay)) {
|
||||
if (!attackEnabled) {
|
||||
DetectionStart();
|
||||
}
|
||||
shotProgress = 1;
|
||||
elapsedTime = 0f;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (movingLimit.disablizeOnKinematic && rigid && rigid.isKinematic) {
|
||||
kinematicCount++;
|
||||
} else if (kinematicCount > 0) {
|
||||
kinematicCount = 0;
|
||||
}
|
||||
if (elapsedTime >= attackDuration || (movingLimit.enabled && elapsedTime >= movingLimit.minDuration && rigid && (rigid.velocity).sqrMagnitude < movingLimit.limitSpeed * movingLimit.limitSpeed) || kinematicCount > 1) {
|
||||
DetectionEnd();
|
||||
shotProgress = 2;
|
||||
elapsedTime = 0f;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (movingLimit.recycle && elapsedTime >= recycleTime) {
|
||||
shotProgress = 0;
|
||||
elapsedTime -= recycleTime;
|
||||
if (elapsedTime > oneFrameSec) {
|
||||
elapsedTime = oneFrameSec;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
35
Script/AttackDetectionProjectileAdditiveCollider.cs
Normal file
35
Script/AttackDetectionProjectileAdditiveCollider.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AttackDetectionProjectileAdditiveCollider : AttackDetectionProjectile {
|
||||
|
||||
public Collider[] additiveCollider;
|
||||
|
||||
protected override void AwakeProcess() {
|
||||
base.AwakeProcess();
|
||||
for (int i = 0; i < additiveCollider.Length; i++) {
|
||||
if (additiveCollider[i]) {
|
||||
additiveCollider[i].enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void DetectionStart(bool effectEnabled = true, bool weaponTrailsEnabled = true) {
|
||||
base.DetectionStart(effectEnabled, weaponTrailsEnabled);
|
||||
for (int i = 0; i < additiveCollider.Length; i++) {
|
||||
if (additiveCollider[i]) {
|
||||
additiveCollider[i].enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void DetectionEnd(bool effectEnabled = true, bool weaponTrailsEnabled = true) {
|
||||
base.DetectionEnd(effectEnabled, weaponTrailsEnabled);
|
||||
for (int i = 0; i < additiveCollider.Length; i++) {
|
||||
if (additiveCollider[i]) {
|
||||
additiveCollider[i].enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
Script/AttackDetectionProjectileFixDamage.cs
Normal file
15
Script/AttackDetectionProjectileFixDamage.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AttackDetectionProjectileFixDamage : AttackDetectionProjectile {
|
||||
|
||||
public int fixDamage;
|
||||
public float fixKnock;
|
||||
public bool attackerIsNull;
|
||||
|
||||
protected override bool SendDamage(ref DamageDetection damageDetection, ref Vector3 closestPoint, ref Vector3 direction) {
|
||||
return damageDetection.ReceiveDamage(ref closestPoint, fixDamage, fixKnock, ref direction, attackerIsNull ? null : mySelf, penetrate, overrideColorType);
|
||||
}
|
||||
|
||||
}
|
42
Script/AttackDetectionProjectileHitStop.cs
Normal file
42
Script/AttackDetectionProjectileHitStop.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AttackDetectionProjectileHitStop : AttackDetectionProjectile {
|
||||
|
||||
public Rigidbody controlRigidbody;
|
||||
public bool hitStopParenting;
|
||||
public float hitStopDestroyTimer;
|
||||
|
||||
protected float remainTime;
|
||||
protected bool stopped;
|
||||
|
||||
protected override void Update() {
|
||||
base.Update();
|
||||
if (stopped) {
|
||||
remainTime -= Time.deltaTime;
|
||||
if (remainTime < 0) {
|
||||
Destroy(controlRigidbody.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool SendDamage(ref DamageDetection damageDetection, ref Vector3 closestPoint, ref Vector3 direction) {
|
||||
bool hitFlag = base.SendDamage(ref damageDetection, ref closestPoint, ref direction);
|
||||
if (hitFlag && !stopped) {
|
||||
stopped = true;
|
||||
DetectionEnd();
|
||||
if (controlRigidbody) {
|
||||
controlRigidbody.velocity = Vector3.zero;
|
||||
controlRigidbody.collisionDetectionMode = CollisionDetectionMode.Discrete;
|
||||
controlRigidbody.isKinematic = true;
|
||||
}
|
||||
if (hitStopParenting && damageDetection.transform != null) {
|
||||
controlRigidbody.transform.SetParent(damageDetection.transform);
|
||||
}
|
||||
remainTime = hitStopDestroyTimer;
|
||||
}
|
||||
return hitFlag;
|
||||
}
|
||||
|
||||
}
|
28
Script/AttackDetectionSick.cs
Normal file
28
Script/AttackDetectionSick.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AttackDetectionSick : AttackDetection {
|
||||
|
||||
public CharacterBase.SickType sickType;
|
||||
public float sickTime = -1;
|
||||
public int probability = 0;
|
||||
|
||||
protected override bool SendDamage(ref DamageDetection damageDetection, ref Vector3 closestPoint, ref Vector3 direction) {
|
||||
if (base.SendDamage(ref damageDetection, ref closestPoint, ref direction)) {
|
||||
if (probability >= 100 || Random.Range(0, 100) < probability) {
|
||||
if (probability >= 10000) {
|
||||
damageDetection.ReceiveSick(CharacterBase.SickType.Poison, 10, this);
|
||||
damageDetection.ReceiveSick(CharacterBase.SickType.Fire, 10, this);
|
||||
damageDetection.ReceiveSick(CharacterBase.SickType.Acid, 10, this);
|
||||
damageDetection.ReceiveSick(CharacterBase.SickType.Slow, 10, this);
|
||||
} else {
|
||||
damageDetection.ReceiveSick(sickType, sickTime, this);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
81
Script/AttackDetectionSoundFade.cs
Normal file
81
Script/AttackDetectionSoundFade.cs
Normal file
|
@ -0,0 +1,81 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AttackDetectionSoundFade : AttackDetection {
|
||||
|
||||
public AudioSource audioSource;
|
||||
public float inTime = 1;
|
||||
public float outTime = 1;
|
||||
public float startVolume = 0;
|
||||
public float endVolume = 1;
|
||||
public float startPitch = 1;
|
||||
public float endPitch = 1;
|
||||
public bool reportHitAttackToParent;
|
||||
|
||||
private double timeStamp;
|
||||
private bool attackEnabledSave;
|
||||
private int fading;
|
||||
|
||||
protected override void Awake() {
|
||||
base.Awake();
|
||||
if (audioSource == null) {
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Update() {
|
||||
base.Update();
|
||||
if (audioSource) {
|
||||
if (attackEnabled && !attackEnabledSave) {
|
||||
fading = 1;
|
||||
timeStamp = GameManager.Instance.time;
|
||||
audioSource.volume = startVolume;
|
||||
audioSource.pitch = startPitch;
|
||||
if (audioSource.enabled) {
|
||||
audioSource.Play();
|
||||
}
|
||||
attackEnabledSave = attackEnabled;
|
||||
} else if (!attackEnabled && attackEnabledSave) {
|
||||
fading = 2;
|
||||
timeStamp = GameManager.Instance.time;
|
||||
audioSource.volume = endVolume;
|
||||
audioSource.pitch = endPitch;
|
||||
attackEnabledSave = attackEnabled;
|
||||
}
|
||||
|
||||
if (fading == 1) {
|
||||
if (GameManager.Instance.time - timeStamp < inTime) {
|
||||
float timePoint = (float)(GameManager.Instance.time - timeStamp) / inTime;
|
||||
audioSource.volume = Mathf.Lerp(startVolume, endVolume, timePoint);
|
||||
audioSource.pitch = Mathf.Lerp(startPitch, endPitch, timePoint);
|
||||
} else {
|
||||
audioSource.volume = endVolume;
|
||||
audioSource.pitch = endPitch;
|
||||
fading = 0;
|
||||
}
|
||||
} else if (fading == 2) {
|
||||
if (GameManager.Instance.time - timeStamp < outTime) {
|
||||
float timePoint = (float)(GameManager.Instance.time - timeStamp) / outTime;
|
||||
audioSource.volume = Mathf.Lerp(endVolume, startVolume, timePoint);
|
||||
audioSource.pitch = Mathf.Lerp(endPitch, startPitch, timePoint);
|
||||
} else {
|
||||
audioSource.volume = startVolume;
|
||||
audioSource.pitch = startPitch;
|
||||
fading = 0;
|
||||
if (startVolume <= 0) {
|
||||
audioSource.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void HitAttack(ref DamageDetection targetDD) {
|
||||
if (reportHitAttackToParent) {
|
||||
parentCBase.HitAttackAdditiveProcessDD(ref targetDD);
|
||||
}
|
||||
base.HitAttack(ref targetDD);
|
||||
}
|
||||
|
||||
}
|
26
Script/AttackEndOnCharacterIsNotAttacking.cs
Normal file
26
Script/AttackEndOnCharacterIsNotAttacking.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AttackEndOnCharacterIsNotAttacking : MonoBehaviour {
|
||||
|
||||
public AttackDetection attackDetection;
|
||||
CharacterBase cBase;
|
||||
|
||||
void Awake() {
|
||||
cBase = GetComponentInParent<CharacterBase>();
|
||||
}
|
||||
|
||||
private void Start() {
|
||||
if (!cBase) {
|
||||
cBase = GetComponentInParent<CharacterBase>();
|
||||
}
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (cBase && attackDetection && attackDetection.attackEnabled && !cBase.IsAttacking()) {
|
||||
attackDetection.DetectionEnd();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
12
Script/AttackStartOnStart.cs
Normal file
12
Script/AttackStartOnStart.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AttackStartOnStart : MonoBehaviour {
|
||||
|
||||
public AttackDetection attackDetection;
|
||||
|
||||
void Start () {
|
||||
attackDetection.DetectionStart();
|
||||
}
|
||||
}
|
47
Script/AudioFadeIn.cs
Normal file
47
Script/AudioFadeIn.cs
Normal file
|
@ -0,0 +1,47 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AudioFadeIn : MonoBehaviour {
|
||||
|
||||
public AudioSource audioSource;
|
||||
public float startVolume = 0f;
|
||||
public float endVolume = 1f;
|
||||
public bool changePitch;
|
||||
public float startPitch = 1f;
|
||||
public float endPitch = 1f;
|
||||
public float fadeTime = 1f;
|
||||
public float delayTime;
|
||||
|
||||
private float elapsedTime;
|
||||
|
||||
private void Awake() {
|
||||
if (audioSource) {
|
||||
audioSource.volume = startVolume;
|
||||
if (changePitch) {
|
||||
audioSource.pitch = startPitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (audioSource && fadeTime > 0f) {
|
||||
if (elapsedTime >= delayTime) {
|
||||
if (elapsedTime < delayTime + fadeTime) {
|
||||
audioSource.volume = Mathf.Lerp(startVolume, endVolume, (elapsedTime - delayTime) / fadeTime);
|
||||
if (changePitch) {
|
||||
audioSource.pitch = Mathf.Lerp(startPitch, endPitch, (elapsedTime - delayTime) / fadeTime);
|
||||
}
|
||||
} else {
|
||||
audioSource.volume = endVolume;
|
||||
if (changePitch) {
|
||||
audioSource.pitch = endPitch;
|
||||
}
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
elapsedTime += Time.deltaTime;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
37
Script/AudioPlayRandomTime.cs
Normal file
37
Script/AudioPlayRandomTime.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AudioPlayRandomTime : MonoBehaviour {
|
||||
|
||||
public AudioSource audioSource;
|
||||
public float minTime = 0f;
|
||||
public float maxTime = 2f;
|
||||
public float delayTime = 0f;
|
||||
|
||||
bool played = false;
|
||||
float elapsedTime = 0f;
|
||||
|
||||
private void Awake () {
|
||||
if (audioSource) {
|
||||
if (minTime > 0f || maxTime > 0f) {
|
||||
audioSource.time = Random.Range(minTime, maxTime);
|
||||
}
|
||||
if (delayTime <= 0f) {
|
||||
audioSource.Play();
|
||||
played = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
if (!played) {
|
||||
elapsedTime += Time.deltaTime;
|
||||
if (elapsedTime >= delayTime) {
|
||||
audioSource.Play();
|
||||
played = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
15
Script/AudioPlaySpecifyTime.cs
Normal file
15
Script/AudioPlaySpecifyTime.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AudioPlaySpecifyTime : MonoBehaviour {
|
||||
|
||||
public float startTime;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
AudioSource aSrc = GetComponent<AudioSource>();
|
||||
aSrc.time = startTime;
|
||||
aSrc.Play();
|
||||
}
|
||||
}
|
120
Script/AudioSourcePool.cs
Normal file
120
Script/AudioSourcePool.cs
Normal file
|
@ -0,0 +1,120 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AudioSourcePool : SingletonMonoBehaviour<AudioSourcePool>
|
||||
{
|
||||
|
||||
public enum AudioName { None, PlayerAttack, FriendsAttack, PlayerDamagedS, PlayerDamagedM, PlayerDamagedL, FriendsDamagedS, FriendsDamagedM, FriendsDamagedL, EnemyDamaged, EnemyDamagedL1, EnemyDamagedL2, EnemyDamagedCritical, EnemyDamagedCriticalL1, EnemyDamagedCriticalL2, EnemyDamagedGuard, DigGround, BallBounce, ContainerBreak, GetItem, GetItemImportant, GetMoney, SandstarBlow, EnemyDead, WallBreak };
|
||||
|
||||
[System.Serializable]
|
||||
public class AudioSet
|
||||
{
|
||||
public AudioName name;
|
||||
public GameObject prefab;
|
||||
public int reserveNum;
|
||||
public int maxNum;
|
||||
public int capacity;
|
||||
public CharacterManager.LoudSoundType loudSoundType;
|
||||
public float loudSoundDecreaseAmount;
|
||||
[System.NonSerialized]
|
||||
public List<AudioSource> sourceList;
|
||||
}
|
||||
|
||||
public AudioSet[] audioSets;
|
||||
public Dictionary<AudioName, int> audioDictionary;
|
||||
static readonly Quaternion quaIden = Quaternion.identity;
|
||||
|
||||
protected override void Awake() {
|
||||
if (CheckInstance()) {
|
||||
audioDictionary = new Dictionary<AudioName, int>(audioSets.Length);
|
||||
for (int i = 0; i < audioSets.Length; i++) {
|
||||
audioSets[i].sourceList = new List<AudioSource>(audioSets[i].capacity);
|
||||
audioDictionary.Add(audioSets[i].name, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
for (int s = 0; s < audioSets.Length; s++) {
|
||||
int count = audioSets[s].sourceList.Count;
|
||||
for (int i = count - 1; i >= 0; i--) {
|
||||
if (audioSets[s].sourceList[i] && audioSets[s].sourceList[i].gameObject.activeSelf && !audioSets[s].sourceList[i].isPlaying) {
|
||||
if (audioSets[s].maxNum > 0 && count > audioSets[s].maxNum) {
|
||||
Destroy(audioSets[s].sourceList[i].gameObject);
|
||||
audioSets[s].sourceList.RemoveAt(i);
|
||||
count--;
|
||||
} else {
|
||||
audioSets[s].sourceList[i].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Play(AudioName audioName, Vector3 position, float volume = 1f) {
|
||||
if (audioName != AudioName.None) {
|
||||
int index = audioDictionary[audioName];
|
||||
int count = audioSets[index].sourceList.Count;
|
||||
bool found = false;
|
||||
if (audioSets[index].loudSoundDecreaseAmount > 0f) {
|
||||
volume *= CharacterManager.Instance.GetLoudSoundVolumeRate(audioSets[index].loudSoundType, audioSets[index].loudSoundDecreaseAmount);
|
||||
}
|
||||
if (volume > 0f) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (audioSets[index].sourceList[i] && !audioSets[index].sourceList[i].gameObject.activeSelf) {
|
||||
audioSets[index].sourceList[i].transform.position = position;
|
||||
audioSets[index].sourceList[i].volume = volume;
|
||||
audioSets[index].sourceList[i].gameObject.SetActive(true);
|
||||
audioSets[index].sourceList[i].Play();
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found && count < audioSets[index].capacity) {
|
||||
AudioSource audioSource = Instantiate(audioSets[index].prefab, position, quaIden).GetComponent<AudioSource>();
|
||||
audioSource.volume = volume;
|
||||
audioSource.Play();
|
||||
audioSets[index].sourceList.Add(audioSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Reduce() {
|
||||
for (int s = 0; s < audioSets.Length; s++) {
|
||||
int count = audioSets[s].sourceList.Count;
|
||||
if (count > audioSets[s].reserveNum) {
|
||||
for (int i = count - 1; i >= 0; i--) {
|
||||
if (audioSets[s].sourceList[i] == null) {
|
||||
audioSets[s].sourceList.RemoveAt(i);
|
||||
count--;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count > audioSets[s].reserveNum) {
|
||||
for (int i = count - 1; i >= 0 && count > audioSets[s].reserveNum; i--) {
|
||||
if (!audioSets[s].sourceList[i].isPlaying) {
|
||||
Destroy(audioSets[s].sourceList[i].gameObject);
|
||||
audioSets[s].sourceList.RemoveAt(i);
|
||||
count--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StopAll() {
|
||||
for (int s = 0; s < audioSets.Length; s++) {
|
||||
int count = audioSets[s].sourceList.Count;
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (audioSets[s].sourceList[i]) {
|
||||
audioSets[s].sourceList[i].Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
27
Script/AutoActivateObject.cs
Normal file
27
Script/AutoActivateObject.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AutoActivateObject : MonoBehaviour {
|
||||
|
||||
public GameObject targetObj;
|
||||
public float delay = 0.5f;
|
||||
public bool toActive = true;
|
||||
|
||||
float elapsedTime = 0;
|
||||
bool activated = false;
|
||||
|
||||
void Update () {
|
||||
if (!activated) {
|
||||
if (elapsedTime >= delay) {
|
||||
if (targetObj) {
|
||||
targetObj.SetActive(toActive);
|
||||
}
|
||||
activated = true;
|
||||
enabled = false;
|
||||
} else {
|
||||
elapsedTime += Time.deltaTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
16
Script/AutoActivateXWeaponTrail.cs
Normal file
16
Script/AutoActivateXWeaponTrail.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using XftWeapon;
|
||||
|
||||
public class AutoActivateXWeaponTrail : MonoBehaviour {
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
XWeaponTrail xwt = GetComponent<XWeaponTrail>();
|
||||
if (xwt) {
|
||||
xwt.Init();
|
||||
xwt.Activate();
|
||||
}
|
||||
}
|
||||
}
|
13
Script/AutoDeactivate.cs
Normal file
13
Script/AutoDeactivate.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class AutoDeactivate : MonoBehaviour {
|
||||
|
||||
public float remainTime = 0;
|
||||
|
||||
void Update () {
|
||||
remainTime -= Time.deltaTime;
|
||||
if (remainTime <= 0) {
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
11
Script/AutoDestroy.cs
Normal file
11
Script/AutoDestroy.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class AutoDestroy : MonoBehaviour {
|
||||
|
||||
public float life = 5;
|
||||
|
||||
protected virtual void Start() {
|
||||
Destroy(gameObject, life);
|
||||
}
|
||||
|
||||
}
|
14
Script/AutoDestroyRandom.cs
Normal file
14
Script/AutoDestroyRandom.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AutoDestroyRandom : AutoDestroy {
|
||||
|
||||
public float randomMin = -0.5f;
|
||||
public float randomMax = 0.5f;
|
||||
|
||||
private void Awake() {
|
||||
life += Random.Range(randomMin, randomMax);
|
||||
}
|
||||
|
||||
}
|
22
Script/AutoDestroy_SaveChildParticles.cs
Normal file
22
Script/AutoDestroy_SaveChildParticles.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class AutoDestroy_SaveChildParticles : AutoDestroy {
|
||||
|
||||
protected override void Start() {
|
||||
StartCoroutine(DestroyAction());
|
||||
}
|
||||
|
||||
IEnumerator DestroyAction() {
|
||||
yield return new WaitForSeconds(life);
|
||||
ParticleSystem[] particles = GetComponentsInChildren<ParticleSystem>();
|
||||
if (particles.Length > 0) {
|
||||
for (int i = 0; i < particles.Length; i++) {
|
||||
particles[i].transform.SetParent(null);
|
||||
particles[i].Stop();
|
||||
}
|
||||
}
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
}
|
22
Script/AutoDestroy_SaveObject.cs
Normal file
22
Script/AutoDestroy_SaveObject.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class AutoDestroy_SaveObject : AutoDestroy {
|
||||
|
||||
public Transform[] saveTarget;
|
||||
|
||||
protected override void Start() {
|
||||
StartCoroutine(DestroyAction());
|
||||
}
|
||||
|
||||
IEnumerator DestroyAction() {
|
||||
yield return new WaitForSeconds(life);
|
||||
for (int i = 0; i < saveTarget.Length; i++) {
|
||||
if (saveTarget[i]) {
|
||||
saveTarget[i].SetParent(null);
|
||||
}
|
||||
}
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
}
|
40
Script/AutoInstantiate.cs
Normal file
40
Script/AutoInstantiate.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AutoInstantiate : MonoBehaviour {
|
||||
|
||||
public GameObject prefab;
|
||||
public float timer;
|
||||
public bool andDestroy;
|
||||
public Vector3 offset;
|
||||
public Vector3 angle;
|
||||
public bool parenting;
|
||||
|
||||
protected float remainTime;
|
||||
protected bool completed = false;
|
||||
protected GameObject instance;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
remainTime = timer;
|
||||
}
|
||||
|
||||
protected virtual void ExecuteInstantiate() {
|
||||
instance = Instantiate(prefab, transform.position + offset, angle == Vector3.zero ? Quaternion.identity : Quaternion.Euler(angle.x, angle.y, angle.z), parenting ? transform : null);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
if (!completed) {
|
||||
remainTime -= Time.deltaTime;
|
||||
if (remainTime <= 0) {
|
||||
ExecuteInstantiate();
|
||||
completed = true;
|
||||
if (andDestroy) {
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
Script/AutoInstantiate_SetCullingPivot.cs
Normal file
15
Script/AutoInstantiate_SetCullingPivot.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AutoInstantiate_SetCullingPivot : AutoInstantiate {
|
||||
|
||||
protected override void ExecuteInstantiate() {
|
||||
base.ExecuteInstantiate();
|
||||
ItemCharacter ifr = instance.GetComponent<ItemCharacter>();
|
||||
if (ifr) {
|
||||
ifr.SetCullingPivotTrans(transform);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
78
Script/AutoMove.cs
Normal file
78
Script/AutoMove.cs
Normal file
|
@ -0,0 +1,78 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
|
||||
public class AutoMove : MonoBehaviour {
|
||||
|
||||
[System.Serializable]
|
||||
public class QuakeSettings {
|
||||
public bool enabled;
|
||||
public bool onComplete;
|
||||
public Vector3 offset;
|
||||
public float amplitude = 10f;
|
||||
public float frequency = 4f;
|
||||
public float attackTime = 0f;
|
||||
public float sustainTime = 0f;
|
||||
public float decayTime = 1f;
|
||||
public float impactRadius = 1f;
|
||||
public float dissipationDistance = 100f;
|
||||
}
|
||||
|
||||
public bool playOnStart = true;
|
||||
public Vector3 move;
|
||||
public float delay;
|
||||
public float time;
|
||||
public Ease ease = Ease.Linear;
|
||||
public QuakeSettings quakeSettings;
|
||||
Transform trans;
|
||||
|
||||
private void Awake() {
|
||||
trans = transform;
|
||||
}
|
||||
|
||||
private void OnDestroy() {
|
||||
if (trans) {
|
||||
trans.DOKill();
|
||||
}
|
||||
}
|
||||
|
||||
void Start () {
|
||||
if (playOnStart) {
|
||||
Action();
|
||||
}
|
||||
}
|
||||
|
||||
public void Action() {
|
||||
if (trans) {
|
||||
if (quakeSettings.enabled) {
|
||||
if (quakeSettings.onComplete) {
|
||||
if (delay > 0f) {
|
||||
trans.DOLocalMove(move, time).SetRelative().SetEase(ease).SetDelay(delay).OnComplete(QuakeAction);
|
||||
} else {
|
||||
trans.DOLocalMove(move, time).SetRelative().SetEase(ease).OnComplete(QuakeAction);
|
||||
}
|
||||
} else {
|
||||
if (delay > 0f) {
|
||||
trans.DOLocalMove(move, time).SetRelative().SetEase(ease).SetDelay(delay).OnStart(QuakeAction);
|
||||
} else {
|
||||
trans.DOLocalMove(move, time).SetRelative().SetEase(ease).OnStart(QuakeAction);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (delay > 0f) {
|
||||
trans.DOLocalMove(move, time).SetRelative().SetEase(ease).SetDelay(delay);
|
||||
} else {
|
||||
trans.DOLocalMove(move, time).SetRelative().SetEase(ease);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QuakeAction() {
|
||||
if (trans && CameraManager.Instance) {
|
||||
CameraManager.Instance.SetQuake(trans.position + quakeSettings.offset, quakeSettings.amplitude, quakeSettings.frequency, quakeSettings.attackTime, quakeSettings.sustainTime, quakeSettings.decayTime, quakeSettings.impactRadius, quakeSettings.dissipationDistance);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
15
Script/AutoMoveAndRotateOnAwake.cs
Normal file
15
Script/AutoMoveAndRotateOnAwake.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AutoMoveAndRotateOnAwake : MonoBehaviour {
|
||||
|
||||
public Vector3 position;
|
||||
public Vector3 rotation;
|
||||
public Vector3 scale;
|
||||
|
||||
private void Awake() {
|
||||
transform.SetPositionAndRotation(position, Quaternion.Euler(rotation));
|
||||
transform.localScale = scale;
|
||||
}
|
||||
}
|
48
Script/AutoRotation.cs
Normal file
48
Script/AutoRotation.cs
Normal file
|
@ -0,0 +1,48 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class AutoRotation : MonoBehaviour {
|
||||
|
||||
public Vector3 rotSpeed;
|
||||
public bool always = false;
|
||||
Transform trans;
|
||||
Vector3 eulerTemp;
|
||||
|
||||
private void Start() {
|
||||
trans = transform;
|
||||
eulerTemp = trans.localEulerAngles;
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
float delta = Time.deltaTime;
|
||||
if (rotSpeed.x != 0f) {
|
||||
eulerTemp.x += rotSpeed.x * delta;
|
||||
if (eulerTemp.x > 180f) {
|
||||
eulerTemp.x -= 360f;
|
||||
}
|
||||
}
|
||||
if (rotSpeed.y != 0f) {
|
||||
eulerTemp.y += rotSpeed.y * delta;
|
||||
if (eulerTemp.y > 180f) {
|
||||
eulerTemp.y -= 360f;
|
||||
}
|
||||
}
|
||||
if (rotSpeed.z != 0f) {
|
||||
eulerTemp.z += rotSpeed.z * delta;
|
||||
if (eulerTemp.z > 180f) {
|
||||
eulerTemp.z -= 360f;
|
||||
}
|
||||
}
|
||||
trans.localEulerAngles = eulerTemp;
|
||||
}
|
||||
|
||||
void OnBecameInvisible() {
|
||||
if (!always) {
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
void OnBecameVisible() {
|
||||
if (!always) {
|
||||
enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
39
Script/AutoRotationWithQuality.cs
Normal file
39
Script/AutoRotationWithQuality.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AutoRotationWithQuality : MonoBehaviour {
|
||||
|
||||
public Vector3 rotSpeed;
|
||||
public int conditionQuality = 1;
|
||||
Vector3 eulerTemp;
|
||||
|
||||
private void Start() {
|
||||
eulerTemp = transform.localEulerAngles;
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
if (GameManager.Instance && GameManager.Instance.save.config[GameManager.Save.configID_QualityLevel] >= conditionQuality) {
|
||||
float delta = Time.deltaTime;
|
||||
if (rotSpeed.x != 0f) {
|
||||
eulerTemp.x += rotSpeed.x * delta;
|
||||
if (eulerTemp.x > 180f) {
|
||||
eulerTemp.x -= 360f;
|
||||
}
|
||||
}
|
||||
if (rotSpeed.y != 0f) {
|
||||
eulerTemp.y += rotSpeed.y * delta;
|
||||
if (eulerTemp.y > 180f) {
|
||||
eulerTemp.y -= 360f;
|
||||
}
|
||||
}
|
||||
if (rotSpeed.z != 0f) {
|
||||
eulerTemp.z += rotSpeed.z * delta;
|
||||
if (eulerTemp.z > 180f) {
|
||||
eulerTemp.z -= 360f;
|
||||
}
|
||||
}
|
||||
transform.localEulerAngles = eulerTemp;
|
||||
}
|
||||
}
|
||||
}
|
21
Script/AutoRotation_AwakeRandomize.cs
Normal file
21
Script/AutoRotation_AwakeRandomize.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AutoRotation_AwakeRandomize : AutoRotation {
|
||||
|
||||
public Vector3 randomRange;
|
||||
|
||||
private void Awake() {
|
||||
if (randomRange.x != 0f) {
|
||||
rotSpeed.x += Random.Range(randomRange.x * -0.5f, randomRange.x * 0.5f);
|
||||
}
|
||||
if (randomRange.y != 0f) {
|
||||
rotSpeed.y += Random.Range(randomRange.y * -0.5f, randomRange.y * 0.5f);
|
||||
}
|
||||
if (randomRange.z != 0f) {
|
||||
rotSpeed.z += Random.Range(randomRange.z * -0.5f, randomRange.z * 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
31
Script/AutoRotation_iTween.cs
Normal file
31
Script/AutoRotation_iTween.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
|
||||
public class AutoRotation_iTween : MonoBehaviour {
|
||||
|
||||
public Vector3 toRotation;
|
||||
public float delay = 0f;
|
||||
public float time = 1f;
|
||||
public Ease ease;
|
||||
|
||||
Transform trans;
|
||||
|
||||
void Start() {
|
||||
trans = transform;
|
||||
if (trans) {
|
||||
if (delay > 0f) {
|
||||
trans.DOLocalRotate(toRotation, time).SetRelative().SetEase(ease).SetDelay(delay);
|
||||
} else {
|
||||
trans.DOLocalRotate(toRotation, time).SetRelative().SetEase(ease);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy() {
|
||||
if (trans) {
|
||||
trans.DOKill();
|
||||
}
|
||||
}
|
||||
}
|
43
Script/AutoScale.cs
Normal file
43
Script/AutoScale.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AutoScale : MonoBehaviour {
|
||||
|
||||
public float delay = 0;
|
||||
public float time = 1;
|
||||
public Vector3 endScale;
|
||||
public bool completeAndDestroy;
|
||||
|
||||
Transform trans;
|
||||
Vector3 startScale;
|
||||
bool gotStartScale;
|
||||
float duration;
|
||||
bool complete;
|
||||
|
||||
void Start() {
|
||||
trans = transform;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update() {
|
||||
if (!complete) {
|
||||
duration += Time.deltaTime;
|
||||
if (duration >= delay) {
|
||||
if (!gotStartScale) {
|
||||
startScale = trans.localScale;
|
||||
gotStartScale = true;
|
||||
}
|
||||
if (duration >= delay + time) {
|
||||
trans.localScale = endScale;
|
||||
complete = true;
|
||||
if (completeAndDestroy) {
|
||||
Destroy(gameObject);
|
||||
}
|
||||
} else if (time > 0) {
|
||||
trans.localScale = startScale + (endScale - startScale) * (duration - delay) / time;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
37
Script/AutoScaleForLineRenderer.cs
Normal file
37
Script/AutoScaleForLineRenderer.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AutoScaleForLineRenderer : MonoBehaviour {
|
||||
|
||||
public float delay = 0;
|
||||
public float time = 1;
|
||||
public float startWidthMultiplier;
|
||||
public float endWidthMultiplier;
|
||||
public bool completeAndDestroy;
|
||||
|
||||
LineRenderer lineRenderer;
|
||||
float duration;
|
||||
bool complete;
|
||||
|
||||
void Start() {
|
||||
lineRenderer = GetComponent<LineRenderer>();
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (!complete && lineRenderer) {
|
||||
duration += Time.deltaTime;
|
||||
if (duration >= delay) {
|
||||
if (duration >= delay + time) {
|
||||
lineRenderer.widthMultiplier = endWidthMultiplier;
|
||||
complete = true;
|
||||
if (completeAndDestroy) {
|
||||
Destroy(gameObject);
|
||||
}
|
||||
} else if (time > 0) {
|
||||
lineRenderer.widthMultiplier = startWidthMultiplier + (endWidthMultiplier - startWidthMultiplier) * (duration - delay) / time;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
52
Script/AutoSetEnabled.cs
Normal file
52
Script/AutoSetEnabled.cs
Normal file
|
@ -0,0 +1,52 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AutoSetEnabled : MonoBehaviour {
|
||||
|
||||
public GameObject[] targetObjects;
|
||||
public Collider[] targetColliders;
|
||||
public AudioSource[] targetAudioSources;
|
||||
public MonoBehaviour[] targetBehaviours;
|
||||
public float delay = 1f;
|
||||
public bool toDisable = false;
|
||||
float elapsedTime = 0;
|
||||
|
||||
void Activate() {
|
||||
for (int i = 0; i < targetObjects.Length; i++) {
|
||||
if (targetObjects[i]) {
|
||||
targetObjects[i].SetActive(!toDisable);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < targetColliders.Length; i++) {
|
||||
if (targetColliders[i]) {
|
||||
targetColliders[i].enabled = !toDisable;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < targetAudioSources.Length; i++) {
|
||||
if (targetAudioSources[i]) {
|
||||
targetAudioSources[i].enabled = !toDisable;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < targetBehaviours.Length; i++) {
|
||||
if (targetBehaviours[i]) {
|
||||
targetBehaviours[i].enabled = !toDisable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Start() {
|
||||
if (delay <= 0f) {
|
||||
Activate();
|
||||
}
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (elapsedTime < delay) {
|
||||
elapsedTime += Time.deltaTime;
|
||||
if (elapsedTime >= delay) {
|
||||
Activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
20
Script/AutoSetParentNull.cs
Normal file
20
Script/AutoSetParentNull.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AutoSetParentNull : MonoBehaviour
|
||||
{
|
||||
|
||||
public float timer;
|
||||
|
||||
private void Update() {
|
||||
timer -= Time.deltaTime;
|
||||
if (timer <= 0f) {
|
||||
if (transform.parent != null) {
|
||||
transform.SetParent(null);
|
||||
}
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
32
Script/AutoShrink.cs
Normal file
32
Script/AutoShrink.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AutoShrink : MonoBehaviour {
|
||||
|
||||
public float delay = 0;
|
||||
public float shrinkTime = 1;
|
||||
public bool scaleZeroDestroy = true;
|
||||
private Vector3 startScale;
|
||||
private float duration = 0f;
|
||||
bool startScaleGot = false;
|
||||
|
||||
void Update () {
|
||||
if (duration >= delay) {
|
||||
if (shrinkTime > 0 && (duration - delay) < shrinkTime) {
|
||||
if (!startScaleGot) {
|
||||
startScale = transform.localScale;
|
||||
startScaleGot = true;
|
||||
}
|
||||
transform.localScale = startScale * (1f - (duration - delay) / shrinkTime);
|
||||
} else {
|
||||
if (scaleZeroDestroy && gameObject) {
|
||||
Destroy(gameObject);
|
||||
} else {
|
||||
transform.localScale = Vector3.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
duration += Time.deltaTime;
|
||||
}
|
||||
}
|
263
Script/BGM.cs
Normal file
263
Script/BGM.cs
Normal file
|
@ -0,0 +1,263 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using UnityEditor;
|
||||
using E7.Introloop;
|
||||
|
||||
public class BGM : SingletonMonoBehaviour<BGM> {
|
||||
|
||||
public IntroloopPlayer introloopPlayer;
|
||||
public IntroloopAudio[] introloopAudio;
|
||||
|
||||
[System.NonSerialized]
|
||||
public string[] musicModTitle;
|
||||
[System.NonSerialized]
|
||||
public string[] musicModCaption;
|
||||
[System.NonSerialized]
|
||||
public bool musicModInfoChanged;
|
||||
[System.NonSerialized]
|
||||
public float masterVolumeRate = 1f;
|
||||
|
||||
private int playingIndex = -1;
|
||||
private bool autoReplayEnabled;
|
||||
|
||||
protected override void Awake() {
|
||||
if (CheckInstance()) {
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void Start() {
|
||||
LoadMod();
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
if (autoReplayEnabled && playingIndex >= 0 && GetPlayingAudioSource() == null) {
|
||||
int playSave = playingIndex;
|
||||
playingIndex = -1;
|
||||
Play(playSave, 0f, true);
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator LoadFile(string fileName, AudioType audioType, int musicIndex, int linesCount) {
|
||||
bool modError = false;
|
||||
UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(fileName, audioType);
|
||||
yield return www.SendWebRequest();
|
||||
if (www.isHttpError || www.isNetworkError) {
|
||||
modError = true;
|
||||
} else {
|
||||
AudioClip audioClip = ((DownloadHandlerAudioClip)www.downloadHandler).audioClip;
|
||||
if (audioClip == null) {
|
||||
modError = true;
|
||||
} else {
|
||||
introloopAudio[musicIndex].SetModClip(audioClip);
|
||||
}
|
||||
if (modError && GameManager.Instance) {
|
||||
GameManager.Instance.SetModError(0, linesCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadMod() {
|
||||
string directoryPath = Application.dataPath + "/mods";
|
||||
if (Directory.Exists(directoryPath)) {
|
||||
bool foundFile = false;
|
||||
char[] charSeparators = new char[] { '\t' };
|
||||
string csvPath = directoryPath + "/music.csv";
|
||||
if (File.Exists(csvPath)) {
|
||||
foundFile = true;
|
||||
} else {
|
||||
csvPath = directoryPath + "/music.txt";
|
||||
if (File.Exists(csvPath)) {
|
||||
foundFile = true;
|
||||
}
|
||||
}
|
||||
if (foundFile) {
|
||||
FileInfo fi = new FileInfo(csvPath);
|
||||
try {
|
||||
using (StreamReader sr = new StreamReader(fi.OpenRead(), Encoding.UTF8)) {
|
||||
string refPath = directoryPath + "/";
|
||||
int musicIndex = -1;
|
||||
int linesCount = 0;
|
||||
if (GameManager.Instance) {
|
||||
GameManager.Instance.modFlag = true;
|
||||
GameManager.Instance.musicModFlag = true;
|
||||
}
|
||||
while (sr.Peek() > -1) {
|
||||
linesCount++;
|
||||
bool modError = false;
|
||||
string[] values = sr.ReadLine().Split(charSeparators, 3, System.StringSplitOptions.None);
|
||||
if (values.Length > 0 && !string.IsNullOrEmpty(values[0])) {
|
||||
if (values.Length < 2) {
|
||||
modError = true;
|
||||
} else {
|
||||
switch (values[0]) {
|
||||
case "INDEX":
|
||||
if (int.TryParse(values[1], out int indexTemp)) {
|
||||
musicIndex = indexTemp - 1;
|
||||
if (musicIndex >= 0 && musicIndex < introloopAudio.Length) {
|
||||
introloopAudio[musicIndex].Volume = 1f;
|
||||
introloopAudio[musicIndex].Pitch = 1f;
|
||||
introloopAudio[musicIndex].nonLooping = false;
|
||||
introloopAudio[musicIndex].loopWholeAudio = true;
|
||||
} else {
|
||||
modError = true;
|
||||
}
|
||||
} else {
|
||||
modError = true;
|
||||
}
|
||||
break;
|
||||
case "FILENAME":
|
||||
if (musicIndex >= 0 && musicIndex < introloopAudio.Length) {
|
||||
string fileName = refPath + values[1];
|
||||
if (!File.Exists(fileName)) {
|
||||
modError = true;
|
||||
} else {
|
||||
StartCoroutine(LoadFile(fileName, AudioType.OGGVORBIS, musicIndex, linesCount));
|
||||
}
|
||||
} else {
|
||||
modError = true;
|
||||
}
|
||||
break;
|
||||
case "TITLE":
|
||||
if (musicIndex >= 0 && musicIndex < introloopAudio.Length) {
|
||||
if (!musicModInfoChanged) {
|
||||
musicModTitle = new string[introloopAudio.Length];
|
||||
musicModCaption = new string[introloopAudio.Length];
|
||||
musicModInfoChanged = true;
|
||||
}
|
||||
musicModTitle[musicIndex] = values[1];
|
||||
} else {
|
||||
modError = true;
|
||||
}
|
||||
break;
|
||||
case "CAPTION":
|
||||
if (musicIndex >= 0 && musicIndex < introloopAudio.Length) {
|
||||
if (!musicModInfoChanged) {
|
||||
musicModTitle = new string[introloopAudio.Length];
|
||||
musicModCaption = new string[introloopAudio.Length];
|
||||
musicModInfoChanged = true;
|
||||
}
|
||||
musicModCaption[musicIndex] = values[1];
|
||||
} else {
|
||||
modError = true;
|
||||
}
|
||||
break;
|
||||
case "VOLUME":
|
||||
if (musicIndex >= 0 && musicIndex < introloopAudio.Length && float.TryParse(values[1], out float volumeTemp)) {
|
||||
introloopAudio[musicIndex].Volume = Mathf.Clamp01(volumeTemp);
|
||||
} else {
|
||||
modError = true;
|
||||
}
|
||||
break;
|
||||
case "PITCH":
|
||||
if (musicIndex >= 0 && musicIndex < introloopAudio.Length && float.TryParse(values[1], out float pitchTemp)) {
|
||||
introloopAudio[musicIndex].Pitch = Mathf.Clamp(pitchTemp, 0.1f, 3f);
|
||||
} else {
|
||||
modError = true;
|
||||
}
|
||||
break;
|
||||
case "LOOPTYPE":
|
||||
if (musicIndex >= 0 && musicIndex < introloopAudio.Length) {
|
||||
switch (values[1]) {
|
||||
case "INTROLOOP":
|
||||
introloopAudio[musicIndex].nonLooping = false;
|
||||
introloopAudio[musicIndex].loopWholeAudio = false;
|
||||
break;
|
||||
case "LOOP":
|
||||
introloopAudio[musicIndex].nonLooping = false;
|
||||
introloopAudio[musicIndex].loopWholeAudio = true;
|
||||
break;
|
||||
case "NONLOOPING":
|
||||
introloopAudio[musicIndex].nonLooping = true;
|
||||
introloopAudio[musicIndex].loopWholeAudio = false;
|
||||
break;
|
||||
default:
|
||||
modError = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
modError = true;
|
||||
}
|
||||
break;
|
||||
case "INTROBOUNDARY":
|
||||
if (musicIndex >= 0 && musicIndex < introloopAudio.Length && float.TryParse(values[1], out float introBoundaryTemp)) {
|
||||
introloopAudio[musicIndex].introBoundary = introBoundaryTemp;
|
||||
} else {
|
||||
modError = true;
|
||||
}
|
||||
break;
|
||||
case "LOOPINGBOUNDARY":
|
||||
if (musicIndex >= 0 && musicIndex < introloopAudio.Length && float.TryParse(values[1], out float loopingBoundaryTemp)) {
|
||||
introloopAudio[musicIndex].loopingBoundary = loopingBoundaryTemp;
|
||||
} else {
|
||||
modError = true;
|
||||
}
|
||||
break;
|
||||
case "MASTERVOLUME":
|
||||
if (float.TryParse(values[1], out float masterVolumeTemp)) {
|
||||
masterVolumeRate = Mathf.Clamp(masterVolumeTemp, 0f, 3f);
|
||||
} else {
|
||||
modError = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
modError = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (modError && GameManager.Instance) {
|
||||
GameManager.Instance.SetModError(GameManager.ModType.Music, linesCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
GameManager.Instance.SetModError(GameManager.ModType.Music, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int GetPlayingIndex() {
|
||||
return playingIndex;
|
||||
}
|
||||
|
||||
public void Play(int index, float fadeTime = 0.3f, bool autoReplay = false) {
|
||||
if (introloopPlayer != null) {
|
||||
if (index >= 0) {
|
||||
if (introloopAudio.Length > index && introloopAudio[index] != null && playingIndex != index) {
|
||||
introloopPlayer.Play(introloopAudio[index], fadeTime);
|
||||
}
|
||||
} else {
|
||||
introloopPlayer.Stop(fadeTime);
|
||||
}
|
||||
playingIndex = index;
|
||||
}
|
||||
autoReplayEnabled = autoReplay;
|
||||
}
|
||||
|
||||
public void Replay() {
|
||||
int playSave = playingIndex;
|
||||
playingIndex = -1;
|
||||
Play(playSave);
|
||||
}
|
||||
|
||||
public void Stop() {
|
||||
introloopPlayer.Stop();
|
||||
playingIndex = -1;
|
||||
}
|
||||
|
||||
public void StopFade(float fadeTime) {
|
||||
introloopPlayer.Stop(fadeTime);
|
||||
playingIndex = -1;
|
||||
}
|
||||
|
||||
public AudioSource GetPlayingAudioSource() {
|
||||
return introloopPlayer.GetPlayingAudioSource();
|
||||
}
|
||||
|
||||
}
|
26
Script/BombLookDown.cs
Normal file
26
Script/BombLookDown.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BombLookDown : MonoBehaviour {
|
||||
|
||||
Rigidbody rb;
|
||||
Transform trans;
|
||||
static readonly Vector3 vecZero = Vector3.zero;
|
||||
static readonly Vector3 vecRight = Vector3.right;
|
||||
|
||||
void Start () {
|
||||
rb = GetComponent<Rigidbody>();
|
||||
trans = transform;
|
||||
}
|
||||
|
||||
void Update () {
|
||||
if (rb) {
|
||||
if (trans.rotation.eulerAngles.x < 85f) {
|
||||
rb.AddTorque(trans.TransformDirection(vecRight) * 2 * Time.deltaTime, ForceMode.VelocityChange);
|
||||
} else {
|
||||
rb.AddTorque(vecZero, ForceMode.VelocityChange);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
142
Script/BombPower.cs
Normal file
142
Script/BombPower.cs
Normal file
|
@ -0,0 +1,142 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BombPower : MonoBehaviour {
|
||||
|
||||
public enum BombType {
|
||||
Normal, Poison, Acid
|
||||
};
|
||||
|
||||
public BombType bombType;
|
||||
public float scaleTime = 1f;
|
||||
public float maxRadius = 20f;
|
||||
public float damageRate = 1f;
|
||||
public bool destroyOnComplete = true;
|
||||
public bool damageFriends;
|
||||
public float maxRadiusForFriends = 40f;
|
||||
|
||||
EnemyBase[] eBase;
|
||||
FriendsBase[] fBase;
|
||||
bool[] enemyTreated;
|
||||
bool[] friendsTreated;
|
||||
float elapsedTime;
|
||||
float scaleSpeed;
|
||||
Transform trans;
|
||||
int damageAmount;
|
||||
float knockAmount;
|
||||
BombReceiverForEnemy[] bombReceiver;
|
||||
bool bombReceiverExist;
|
||||
int t_defeatCount;
|
||||
|
||||
private void Start() {
|
||||
trans = transform;
|
||||
if (scaleTime > 0) {
|
||||
scaleSpeed = maxRadius / scaleTime;
|
||||
}
|
||||
|
||||
GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy");
|
||||
eBase = new EnemyBase[enemies.Length];
|
||||
for (int i = 0; i < enemies.Length; i++) {
|
||||
eBase[i] = enemies[i].GetComponent<EnemyBase>();
|
||||
}
|
||||
enemyTreated = new bool[enemies.Length];
|
||||
|
||||
GameObject[] bombReceiverObj = GameObject.FindGameObjectsWithTag("BombReceiver");
|
||||
if (bombReceiverObj.Length > 0) {
|
||||
bombReceiverExist = true;
|
||||
bombReceiver = new BombReceiverForEnemy[bombReceiverObj.Length];
|
||||
for (int i = 0; i < bombReceiver.Length; i++) {
|
||||
bombReceiver[i] = bombReceiverObj[i].GetComponent<BombReceiverForEnemy>();
|
||||
}
|
||||
}
|
||||
|
||||
GameObject[] friends = GameObject.FindGameObjectsWithTag("Player");
|
||||
fBase = new FriendsBase[friends.Length];
|
||||
for (int i = 0; i < friends.Length; i++) {
|
||||
fBase[i] = friends[i].GetComponent<FriendsBase>();
|
||||
}
|
||||
friendsTreated = new bool[friends.Length];
|
||||
damageAmount = Mathf.RoundToInt(GameManager.Instance.GetLevelStatusNow() * 320f * damageRate);
|
||||
if (bombType != BombType.Normal) {
|
||||
damageAmount = damageAmount * 3 / 4;
|
||||
}
|
||||
knockAmount = (GameManager.Instance.GetLevelNow + 50) * 20f * damageRate;
|
||||
if (CharacterManager.Instance) {
|
||||
CharacterManager.Instance.bossResult.useItemCount++;
|
||||
if (GameManager.Instance.save.stageReport.Length >= GameManager.stageReportMax) {
|
||||
GameManager.Instance.save.stageReport[GameManager.stageReport_ItemCount]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
elapsedTime += Time.deltaTime;
|
||||
float condDist = Mathf.Clamp(elapsedTime * scaleSpeed, 0f, maxRadius);
|
||||
float condSqrDist = condDist * condDist;
|
||||
for (int i = 0; i < eBase.Length; i++) {
|
||||
if (eBase[i] && eBase[i].enabled && !enemyTreated[i] && (eBase[i].transform.position - trans.position).sqrMagnitude <= condSqrDist) {
|
||||
enemyTreated[i] = true;
|
||||
eBase[i].TakeDamageFixKnock(damageAmount, eBase[i].GetCenterPosition(), knockAmount, (eBase[i].transform.position - trans.position).normalized, eBase[i].GetTargetExist() ? CharacterManager.Instance.pCon : null, 3, true);
|
||||
if (!TrophyManager.Instance.IsTrophyHad(TrophyManager.t_Bomb) && eBase[i].GetNowHP() <= 0) {
|
||||
t_defeatCount++;
|
||||
if (t_defeatCount >= 20) {
|
||||
TrophyManager.Instance.CheckTrophy(TrophyManager.t_Bomb, true);
|
||||
}
|
||||
}
|
||||
switch (bombType) {
|
||||
case BombType.Normal:
|
||||
eBase[i].ResetSickToleranceAll();
|
||||
break;
|
||||
case BombType.Poison:
|
||||
eBase[i].ResetSickTolerance(CharacterBase.SickType.Poison);
|
||||
eBase[i].SetSick(CharacterBase.SickType.Poison, 40);
|
||||
eBase[i].ResetSickToleranceAll();
|
||||
break;
|
||||
case BombType.Acid:
|
||||
eBase[i].ResetSickTolerance(CharacterBase.SickType.Acid);
|
||||
eBase[i].SetSick(CharacterBase.SickType.Acid, 40);
|
||||
eBase[i].ResetSickToleranceAll();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bombReceiverExist) {
|
||||
for (int i = 0; i < bombReceiver.Length; i++) {
|
||||
if (bombReceiver[i] && (bombReceiver[i].transform.position - trans.position).sqrMagnitude <= condSqrDist) {
|
||||
bombReceiver[i].DestroyWithEffect();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (damageFriends) {
|
||||
condDist = Mathf.Clamp(elapsedTime * scaleSpeed, 0f, maxRadiusForFriends);
|
||||
condSqrDist = condDist * condDist;
|
||||
for (int i = 0; i < fBase.Length; i++) {
|
||||
if (fBase[i] && fBase[i].enabled && !friendsTreated[i] && (fBase[i].transform.position - trans.position).sqrMagnitude <= condSqrDist) {
|
||||
friendsTreated[i] = true;
|
||||
int nowHP = fBase[i].GetNowHP();
|
||||
int damage = 0;
|
||||
switch (bombType) {
|
||||
case BombType.Normal:
|
||||
damage = Mathf.Min(Mathf.RoundToInt((200 + StageManager.Instance.GetSlipDamage(false) * 10) * damageRate), nowHP - 1);
|
||||
fBase[i].TakeDamage(damage, fBase[i].GetCenterPosition(), 400 * damageRate, (fBase[i].transform.position - trans.position).normalized, null, 0, true);
|
||||
break;
|
||||
case BombType.Poison:
|
||||
damage = Mathf.Min(Mathf.RoundToInt((200 + StageManager.Instance.GetSlipDamage(false) * 10) * 0.75f * damageRate), nowHP - 1);
|
||||
fBase[i].TakeDamage(damage, fBase[i].GetCenterPosition(), 400 * damageRate, (fBase[i].transform.position - trans.position).normalized, null, 0, true);
|
||||
fBase[i].SetSick(CharacterBase.SickType.Poison, 20);
|
||||
break;
|
||||
case BombType.Acid:
|
||||
damage = Mathf.Min(Mathf.RoundToInt((200 + StageManager.Instance.GetSlipDamage(false) * 10) * 0.75f * damageRate), nowHP - 1);
|
||||
fBase[i].TakeDamage(damage, fBase[i].GetCenterPosition(), 400 * damageRate, (fBase[i].transform.position - trans.position).normalized, null, 0, true);
|
||||
fBase[i].SetSick(CharacterBase.SickType.Acid, 20);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (destroyOnComplete && elapsedTime >= scaleTime + 0.05f) {
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
180
Script/BombTrigger.cs
Normal file
180
Script/BombTrigger.cs
Normal file
|
@ -0,0 +1,180 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BombTrigger : MonoBehaviour {
|
||||
|
||||
[System.Serializable]
|
||||
public class AdditionalTrap {
|
||||
public bool enabled;
|
||||
public GameObject prefab;
|
||||
public int conditionLevel = 0;
|
||||
public bool applyGroundNormal;
|
||||
}
|
||||
|
||||
public GameObject attackObject;
|
||||
public string targetTag = "";
|
||||
public float triggerDelay = 0.1f;
|
||||
public float startRadius = 0.01f;
|
||||
public float endRadius = 1f;
|
||||
public float inflationTime = 0.1f;
|
||||
public float endTime = 0.2f;
|
||||
public float forceBurstTime = 5f;
|
||||
public float forceBurstRandomRange = 0.1f;
|
||||
public float destroyTime = 10f;
|
||||
public float parentDestroyDelay = 0f;
|
||||
public bool adjustScaleOnStart = true;
|
||||
public bool attackStartOnBurst = false;
|
||||
public GameObject missingDestroyTarget;
|
||||
public AdditionalTrap additionalTrap;
|
||||
public bool restrictLayerEnabled;
|
||||
public LayerMask conditionLayer;
|
||||
public ParticleSystem[] remainParticles;
|
||||
|
||||
protected AttackDetection attackDetection;
|
||||
protected CapsuleCollider attackCollider;
|
||||
protected CharacterBase parentCBase;
|
||||
protected bool parentFound;
|
||||
protected float duration;
|
||||
protected bool entered;
|
||||
protected bool inflated;
|
||||
protected bool ended;
|
||||
protected float forceBurstTimeReal;
|
||||
|
||||
private void Awake() {
|
||||
if (attackObject) {
|
||||
attackDetection = attackObject.GetComponent<AttackDetection>();
|
||||
attackCollider = attackObject.GetComponent<CapsuleCollider>();
|
||||
if (forceBurstRandomRange != 0f) {
|
||||
forceBurstTimeReal = forceBurstTime + Random.Range(forceBurstRandomRange * -0.5f, forceBurstRandomRange * 0.5f);
|
||||
} else {
|
||||
forceBurstTimeReal = forceBurstTime;
|
||||
}
|
||||
parentCBase = GetComponentInParent<CharacterBase>();
|
||||
if (parentCBase) {
|
||||
parentFound = true;
|
||||
}
|
||||
} else {
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void Start() {
|
||||
if (attackCollider && attackDetection) {
|
||||
attackCollider.enabled = false;
|
||||
attackCollider.radius = startRadius;
|
||||
attackDetection.enabled = false;
|
||||
attackDetection.DetectionEnd(false);
|
||||
}
|
||||
if (adjustScaleOnStart) {
|
||||
Vector3 lossy = transform.lossyScale;
|
||||
Vector3 newScale = Vector3.one;
|
||||
if (lossy != newScale) {
|
||||
if (lossy.x > 0f) {
|
||||
newScale.x = 1f / lossy.x;
|
||||
}
|
||||
if (lossy.y > 0f) {
|
||||
newScale.y = 1f / lossy.y;
|
||||
}
|
||||
if (lossy.z > 0f) {
|
||||
newScale.z = 1f / lossy.z;
|
||||
}
|
||||
transform.localScale = newScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void SetAdditionalTrap() {
|
||||
if (additionalTrap.enabled && parentCBase) {
|
||||
bool check = true;
|
||||
if (additionalTrap.conditionLevel >= 1) {
|
||||
if (parentCBase.Level < additionalTrap.conditionLevel) {
|
||||
check = false;
|
||||
}
|
||||
}
|
||||
if (check) {
|
||||
LayerMask layerMask = LayerMask.GetMask("Field");
|
||||
RaycastHit hit;
|
||||
Ray ray = new Ray(transform.position + new Vector3(0f, 0.5f, 0f), Vector3.down);
|
||||
if (Physics.Raycast(ray, out hit, 2f, layerMask, QueryTriggerInteraction.Ignore)) {
|
||||
Vector3 pointTemp = hit.point;
|
||||
pointTemp.y += Random.Range(0.0025f, 0.005f);
|
||||
GameObject trapInstance = Instantiate(additionalTrap.prefab, hit.point, additionalTrap.applyGroundNormal && hit.normal.y > 0f ? Quaternion.FromToRotation(Vector3.up, hit.normal) : Quaternion.identity);
|
||||
if (trapInstance) {
|
||||
MissingObjectToDestroy trapChecker = trapInstance.GetComponent<MissingObjectToDestroy>();
|
||||
if (trapChecker) {
|
||||
trapChecker.SetGameObject(parentCBase.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Update() {
|
||||
if (parentFound && missingDestroyTarget && parentCBase == null) {
|
||||
Destroy(missingDestroyTarget);
|
||||
} else {
|
||||
duration += Time.deltaTime;
|
||||
if (entered) {
|
||||
if (duration >= destroyTime && destroyTime < 10000 && ended) {
|
||||
Destroy(gameObject);
|
||||
} else if (duration >= endTime && inflated) {
|
||||
if (!ended) {
|
||||
attackDetection.DetectionEnd(false);
|
||||
ended = true;
|
||||
}
|
||||
} else if (duration >= inflationTime) {
|
||||
if (!inflated) {
|
||||
if (attackCollider != null) {
|
||||
attackCollider.radius = endRadius;
|
||||
}
|
||||
inflated = true;
|
||||
}
|
||||
} else if (inflationTime > 0 && attackCollider != null) {
|
||||
attackCollider.radius = Mathf.Lerp(startRadius, endRadius, duration / inflationTime);
|
||||
}
|
||||
} else {
|
||||
if (duration >= forceBurstTimeReal && forceBurstTimeReal < 10000) {
|
||||
Burst();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Burst() {
|
||||
if (!entered) {
|
||||
entered = true;
|
||||
attackCollider.enabled = true;
|
||||
attackCollider.radius = startRadius;
|
||||
attackDetection.enabled = true;
|
||||
if (attackStartOnBurst) {
|
||||
attackDetection.DetectionStart();
|
||||
}
|
||||
if (parentDestroyDelay >= 0) {
|
||||
Transform parentTransform = transform.parent;
|
||||
if (parentTransform) {
|
||||
transform.SetParent(null);
|
||||
if (remainParticles.Length > 0) {
|
||||
for (int i = 0; i < remainParticles.Length; i++) {
|
||||
if (remainParticles[i]) {
|
||||
remainParticles[i].Stop();
|
||||
remainParticles[i].transform.SetParent(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Destroy(parentTransform.gameObject, parentDestroyDelay);
|
||||
}
|
||||
}
|
||||
SetAdditionalTrap();
|
||||
duration = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other) {
|
||||
if (!entered && duration >= triggerDelay && (string.IsNullOrEmpty(targetTag) || other.CompareTag(targetTag)) && (!restrictLayerEnabled || ((1 << other.gameObject.layer) & conditionLayer) != 0)) {
|
||||
Burst();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
15
Script/BombTriggerAddition.cs
Normal file
15
Script/BombTriggerAddition.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BombTriggerAddition : MonoBehaviour {
|
||||
|
||||
public BombTrigger bombTrigger;
|
||||
public string targetTag = "";
|
||||
|
||||
private void OnTriggerStay(Collider other) {
|
||||
if (string.IsNullOrEmpty(targetTag) || other.CompareTag(targetTag)) {
|
||||
bombTrigger.Burst();
|
||||
}
|
||||
}
|
||||
}
|
16
Script/BombTrigger_CheckStay.cs
Normal file
16
Script/BombTrigger_CheckStay.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BombTrigger_CheckStay : BombTrigger {
|
||||
|
||||
private void OnTriggerStay(Collider other) {
|
||||
if (!entered && duration >= triggerDelay && (string.IsNullOrEmpty(targetTag) || other.CompareTag(targetTag)) && (!restrictLayerEnabled || ((1 << other.gameObject.layer) & conditionLayer) != 0)) {
|
||||
DamageDetection ddTemp = other.GetComponent<DamageDetection>();
|
||||
if (ddTemp && !ddTemp.isNotCharacter) {
|
||||
Burst();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
82
Script/BuffField.cs
Normal file
82
Script/BuffField.cs
Normal file
|
@ -0,0 +1,82 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BuffField : MonoBehaviour {
|
||||
|
||||
public string targetTag = "Player";
|
||||
public FriendsBase.FieldBuffType type;
|
||||
|
||||
FriendsBase fBaseTemp;
|
||||
int playerEntering;
|
||||
int[] friendsEntering = new int[GameManager.friendsMax];
|
||||
const string registerHateTag = "Enemy";
|
||||
const int parentFriendsID = 23;
|
||||
const float hateConditionDistance = 10f;
|
||||
|
||||
private void Start() {
|
||||
FriendsBase parentFriendsBase = CharacterManager.Instance.GetFriendsBase(parentFriendsID);
|
||||
if (parentFriendsBase) {
|
||||
Transform parentTrans = parentFriendsBase.transform;
|
||||
GameObject[] enemies = GameObject.FindGameObjectsWithTag(registerHateTag);
|
||||
EnemyBase enemyBaseTemp;
|
||||
float amount = CharacterManager.Instance.GetNormalKnockAmount();
|
||||
for (int i = 0; i < enemies.Length; i++) {
|
||||
enemyBaseTemp = enemies[i].GetComponent<EnemyBase>();
|
||||
if (enemyBaseTemp) {
|
||||
if (enemyBaseTemp.isBoss) {
|
||||
enemyBaseTemp.RegisterTargetHate(parentFriendsBase, amount * 4f);
|
||||
} else if ((enemies[i].transform.position - parentTrans.position).sqrMagnitude <= hateConditionDistance * hateConditionDistance) {
|
||||
enemyBaseTemp.RegisterTargetHate(parentFriendsBase, amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
if (CharacterManager.Instance) {
|
||||
if (playerEntering >= 2 && CharacterManager.Instance.pCon) {
|
||||
CharacterManager.Instance.pCon.SetFieldBuff(type);
|
||||
}
|
||||
for (int i = 0; i < friendsEntering.Length; i++) {
|
||||
if (friendsEntering[i] >= 2 && CharacterManager.Instance.friends[i].fBase) {
|
||||
CharacterManager.Instance.friends[i].fBase.SetFieldBuff(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other) {
|
||||
if (CharacterManager.Instance && other.CompareTag(targetTag)) {
|
||||
fBaseTemp = other.GetComponent<FriendsBase>();
|
||||
if (fBaseTemp) {
|
||||
if (fBaseTemp.isPlayer) {
|
||||
if (playerEntering == 0) {
|
||||
CharacterManager.Instance.ShowFieldBuff(fBaseTemp.transform.position, type, true);
|
||||
}
|
||||
playerEntering = 2;
|
||||
} else if (fBaseTemp.friendsId >= 0 && fBaseTemp.friendsId < friendsEntering.Length && fBaseTemp.friendsId != parentFriendsID) {
|
||||
if (friendsEntering[fBaseTemp.friendsId] == 0) {
|
||||
CharacterManager.Instance.ShowFieldBuff(fBaseTemp.transform.position, type, false);
|
||||
}
|
||||
friendsEntering[fBaseTemp.friendsId] = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other) {
|
||||
if (CharacterManager.Instance && other.CompareTag(targetTag)) {
|
||||
fBaseTemp = other.GetComponent<FriendsBase>();
|
||||
if (fBaseTemp) {
|
||||
if (fBaseTemp.isPlayer) {
|
||||
playerEntering = 1;
|
||||
} else if (fBaseTemp.friendsId >= 0 && fBaseTemp.friendsId < friendsEntering.Length && fBaseTemp.friendsId != parentFriendsID) {
|
||||
friendsEntering[fBaseTemp.friendsId] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
15
Script/BulletPhysicsDeactivate.cs
Normal file
15
Script/BulletPhysicsDeactivate.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BulletPhysicsDeactivate : MonoBehaviour {
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
GameObject bulletPhysicsObj = GameObject.Find("MMD4MecanimBulletPhysics");
|
||||
if (bulletPhysicsObj) {
|
||||
bulletPhysicsObj.SetActive(false);
|
||||
}
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
181
Script/BusConsole.cs
Normal file
181
Script/BusConsole.cs
Normal file
|
@ -0,0 +1,181 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Rewired;
|
||||
|
||||
public class BusConsole : MonoBehaviour {
|
||||
|
||||
public GameObject balloonPrefab;
|
||||
public Vector3 balloonOffset = new Vector3(0, 1.6f, 0);
|
||||
public Transform cameraPivot;
|
||||
public Transform cameraFocusPoint;
|
||||
|
||||
Player playerInput;
|
||||
int state = 0;
|
||||
int answer;
|
||||
int saveSlot = -1;
|
||||
int stageId;
|
||||
int floorNum;
|
||||
int pauseWait;
|
||||
bool entering;
|
||||
bool actionTextEnabled;
|
||||
const string targetTag = "ItemGetter";
|
||||
|
||||
void Start() {
|
||||
Instantiate(balloonPrefab, transform.position + balloonOffset, transform.rotation, transform);
|
||||
playerInput = GameManager.Instance.playerInput;
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (CharacterManager.Instance) {
|
||||
switch (state) {
|
||||
case 1:
|
||||
if (PauseController.Instance) {
|
||||
if (PauseController.Instance.pauseGame) {
|
||||
pauseWait = 2;
|
||||
} else if (pauseWait > 0) {
|
||||
pauseWait--;
|
||||
}
|
||||
if (PauseController.Instance.returnToLibraryProcessing) {
|
||||
state = 0;
|
||||
}
|
||||
if (pauseWait <= 0 && PauseController.Instance.GetPauseEnabled() && playerInput.GetButtonDown(RewiredConsts.Action.Submit)) {
|
||||
UISE.Instance.Play(UISE.SoundName.submit);
|
||||
PauseController.Instance.SetChoices(2, true, TextManager.Get("WORD_BUS"), "CHOICE_RIDE", "CHOICE_CANCEL");
|
||||
state = 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch (PauseController.Instance.ChoicesControl()) {
|
||||
case -2:
|
||||
UISE.Instance.Play(UISE.SoundName.cancel);
|
||||
PauseController.Instance.CancelChoices();
|
||||
CancelCommon();
|
||||
break;
|
||||
case 0:
|
||||
UISE.Instance.Play(UISE.SoundName.submit);
|
||||
if (cameraPivot && CameraManager.Instance) {
|
||||
CameraManager.Instance.SetEventCamera(cameraPivot.position, cameraPivot.eulerAngles, float.MaxValue, 1f, Vector3.Distance(cameraPivot.position, cameraFocusPoint.position));
|
||||
}
|
||||
PauseController.Instance.CancelChoices();
|
||||
PauseController.Instance.bus.busConsole = this;
|
||||
PauseController.Instance.PauseBus();
|
||||
state = 3;
|
||||
break;
|
||||
case 1:
|
||||
UISE.Instance.Play(UISE.SoundName.submit);
|
||||
PauseController.Instance.CancelChoices();
|
||||
CancelCommon();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (!PauseController.Instance.pauseGame) {
|
||||
state = 4;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
CancelCommon();
|
||||
break;
|
||||
case 11:
|
||||
state = 12;
|
||||
break;
|
||||
case 12:
|
||||
switch (PauseController.Instance.ChoicesControl()) {
|
||||
case -2:
|
||||
UISE.Instance.Play(UISE.SoundName.cancel);
|
||||
PauseController.Instance.CancelChoices();
|
||||
PauseController.Instance.HideCaution();
|
||||
CancelCommon();
|
||||
break;
|
||||
case 0:
|
||||
UISE.Instance.Play(UISE.SoundName.submit);
|
||||
PauseController.Instance.CancelChoices(false);
|
||||
PauseController.Instance.HideCaution();
|
||||
SceneChange.Instance.StartEyeCatch();
|
||||
saveSlot = -1;
|
||||
state = 14;
|
||||
break;
|
||||
case 1:
|
||||
UISE.Instance.Play(UISE.SoundName.submit);
|
||||
PauseController.Instance.CancelChoices(false);
|
||||
PauseController.Instance.HideCaution();
|
||||
SaveController.Instance.permitEmptySlot = true;
|
||||
SaveController.Instance.Activate();
|
||||
state = 13;
|
||||
break;
|
||||
case 2:
|
||||
UISE.Instance.Play(UISE.SoundName.submit);
|
||||
PauseController.Instance.CancelChoices();
|
||||
PauseController.Instance.HideCaution();
|
||||
CancelCommon();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
saveSlot = -1;
|
||||
answer = SaveController.Instance.SaveControlExternal();
|
||||
if (answer >= 0 && answer < GameManager.saveSlotMax) {
|
||||
saveSlot = answer;
|
||||
state += 1;
|
||||
} else if (answer < -1) {
|
||||
PauseController.Instance.CancelChoices();
|
||||
CancelCommon();
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
if (SceneChange.Instance.GetEyeCatch()) {
|
||||
PauseController.Instance.CancelChoices();
|
||||
if (stageId != StageManager.homeStageId) {
|
||||
GameManager.Instance.save.moveByBus = 1;
|
||||
}
|
||||
StageManager.Instance.MoveStage(stageId, floorNum < 0 ? 0 : floorNum, saveSlot, true);
|
||||
SceneChange.Instance.EndEyeCatch();
|
||||
}
|
||||
break;
|
||||
}
|
||||
bool actionTemp = (state == 1 && pauseWait <= 0 && PauseController.Instance.pauseEnabled);
|
||||
if (actionTextEnabled != actionTemp) {
|
||||
CharacterManager.Instance.SetActionType(actionTemp ? CharacterManager.ActionType.Search : CharacterManager.ActionType.None, gameObject);
|
||||
actionTextEnabled = actionTemp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CancelCommon() {
|
||||
state = (entering ? 1 : 0);
|
||||
}
|
||||
|
||||
public void SetMoveChoices(int index) {
|
||||
stageId = PauseController.Instance.bus.destination[index].x;
|
||||
floorNum = PauseController.Instance.bus.destination[index].y;
|
||||
PauseController.Instance.SetChoices(3, true, TextManager.Get(PauseController.Instance.bus.dicKey[index]), "CHOICE_ENTER", "CHOICE_SAVEENTER", "CHOICE_CANCEL");
|
||||
state = 11;
|
||||
}
|
||||
|
||||
protected virtual void OnTriggerEnter(Collider other) {
|
||||
if (other.CompareTag(targetTag)) {
|
||||
entering = true;
|
||||
if (state < 2) {
|
||||
state = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnTriggerExit(Collider other) {
|
||||
if (other.CompareTag(targetTag)) {
|
||||
entering = false;
|
||||
if (state < 2) {
|
||||
state = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy() {
|
||||
if ((state == 2 || state == 12) && PauseController.Instance) {
|
||||
PauseController.Instance.CancelChoices();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
49
Script/BusDriving.cs
Normal file
49
Script/BusDriving.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BusDriving : MonoBehaviour {
|
||||
|
||||
[System.Serializable]
|
||||
public class AxleInfo {
|
||||
public WheelCollider wheel;
|
||||
public Transform model;
|
||||
public bool motor; //駆動輪か?
|
||||
public bool steering; //ハンドル操作をしたときに角度が変わるか?
|
||||
}
|
||||
|
||||
public List<AxleInfo> axleInfos;
|
||||
public float maxMotorTorque;
|
||||
public float maxSteeringAngle;
|
||||
|
||||
private Vector3 vecTemp;
|
||||
|
||||
private void Update() {
|
||||
if (Time.timeScale > 0f && PauseController.Instance && !PauseController.Instance.pauseGame && PauseController.Instance.pauseEnabled) {
|
||||
float deltaTimeCache = Time.deltaTime;
|
||||
foreach (AxleInfo axleInfo in axleInfos) {
|
||||
vecTemp = axleInfo.model.localEulerAngles;
|
||||
vecTemp.x += axleInfo.wheel.rpm / 60 * 360 * deltaTimeCache;
|
||||
if (axleInfo.steering) {
|
||||
vecTemp.y = axleInfo.wheel.steerAngle - vecTemp.z;
|
||||
}
|
||||
axleInfo.model.localEulerAngles = vecTemp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FixedUpdate() {
|
||||
if (Time.timeScale > 0f && PauseController.Instance && !PauseController.Instance.pauseGame && PauseController.Instance.pauseEnabled) {
|
||||
float motor = maxMotorTorque * GameManager.Instance.playerInput.GetAxis(RewiredConsts.Action.Vertical);
|
||||
float steering = maxSteeringAngle * GameManager.Instance.playerInput.GetAxis(RewiredConsts.Action.Horizontal);
|
||||
foreach (AxleInfo axleInfo in axleInfos) {
|
||||
if (axleInfo.steering) {
|
||||
axleInfo.wheel.steerAngle = steering;
|
||||
}
|
||||
if (axleInfo.motor) {
|
||||
axleInfo.wheel.motorTorque = motor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1129
Script/CameraManager.cs
Normal file
1129
Script/CameraManager.cs
Normal file
File diff suppressed because it is too large
Load diff
34
Script/ChangeLightIntensity.cs
Normal file
34
Script/ChangeLightIntensity.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
|
||||
public class ChangeLightIntensity : MonoBehaviour {
|
||||
|
||||
public Light pointLight;
|
||||
public float endIntensity;
|
||||
public float time;
|
||||
public Ease easeType = Ease.InOutSine;
|
||||
|
||||
void Start () {
|
||||
if (!pointLight) {
|
||||
pointLight = GetComponent<Light>();
|
||||
}
|
||||
if (pointLight) {
|
||||
pointLight.DOIntensity(endIntensity, time).SetEase(easeType).OnComplete(EaseComplete);
|
||||
}
|
||||
}
|
||||
|
||||
void EaseComplete() {
|
||||
if (pointLight && endIntensity <= 0) {
|
||||
pointLight.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy() {
|
||||
if (pointLight) {
|
||||
pointLight.DOKill();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
21
Script/ChangeScale.cs
Normal file
21
Script/ChangeScale.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
|
||||
public class ChangeScale : MonoBehaviour {
|
||||
|
||||
public Vector3 toScale;
|
||||
public float duration = 1f;
|
||||
Ease easeType = Ease.OutSine;
|
||||
|
||||
void Start () {
|
||||
transform.DOScale(toScale, duration).SetEase(easeType);
|
||||
}
|
||||
|
||||
private void OnDestroy() {
|
||||
if (gameObject) {
|
||||
gameObject.transform.DOKill();
|
||||
}
|
||||
}
|
||||
}
|
24
Script/ChangeSnapshotOnTrigger.cs
Normal file
24
Script/ChangeSnapshotOnTrigger.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ChangeSnapshotOnTrigger : MonoBehaviour {
|
||||
|
||||
public string targetSnapshot = "Snapshot";
|
||||
public float transitionTime = 0.5f;
|
||||
|
||||
private void OnTriggerEnter(Collider other) {
|
||||
if (other.CompareTag("ItemGetter")) {
|
||||
GameManager.Instance.ChangeSnapshot(targetSnapshot, transitionTime);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other) {
|
||||
if (other.CompareTag("ItemGetter")) {
|
||||
if (StageManager.Instance && StageManager.Instance.dungeonController) {
|
||||
StageManager.Instance.dungeonController.SetDefaultSnapshot(transitionTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
3147
Script/CharacterBase.cs
Normal file
3147
Script/CharacterBase.cs
Normal file
File diff suppressed because it is too large
Load diff
720
Script/CharacterDatabase.cs
Normal file
720
Script/CharacterDatabase.cs
Normal file
|
@ -0,0 +1,720 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.IO;
|
||||
|
||||
public class CharacterDatabase : SingletonMonoBehaviour<CharacterDatabase> {
|
||||
|
||||
const int enemyLevelMax = 5;
|
||||
|
||||
[System.Serializable]
|
||||
public class Friends {
|
||||
public string path;
|
||||
public int cost;
|
||||
public GameObject cache;
|
||||
}
|
||||
|
||||
public class EnemyStatus {
|
||||
public int hp;
|
||||
public int attack;
|
||||
public int defense;
|
||||
public int exp;
|
||||
public int item0;
|
||||
public int item1;
|
||||
public int assumeLevel;
|
||||
public EnemyStatus() {
|
||||
hp = 50;
|
||||
attack = 10;
|
||||
defense = 0;
|
||||
exp = 1;
|
||||
item0 = -1;
|
||||
item1 = -1;
|
||||
assumeLevel = 1;
|
||||
}
|
||||
public EnemyStatus(int hp, int attack, int defense, int exp, int item0 = -1, int item1 = -1, int assumeLevel = 1) {
|
||||
this.hp = hp;
|
||||
this.attack = attack;
|
||||
this.defense = defense;
|
||||
this.exp = exp;
|
||||
this.item0 = item0;
|
||||
this.item1 = item1;
|
||||
this.assumeLevel = assumeLevel;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class VariableStatus {
|
||||
public int noCoreHP;
|
||||
public int haveCoreHP;
|
||||
public int attack;
|
||||
public int exp;
|
||||
public VariableStatus() {
|
||||
noCoreHP = 50;
|
||||
haveCoreHP = 50;
|
||||
attack = 10;
|
||||
exp = 1;
|
||||
}
|
||||
public VariableStatus(int noCoreHP, int haveCoreHP, int attack, int exp) {
|
||||
this.noCoreHP = noCoreHP;
|
||||
this.haveCoreHP = haveCoreHP;
|
||||
this.attack = attack;
|
||||
this.exp = exp;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class Enemy {
|
||||
public string path;
|
||||
public string spritePath;
|
||||
public int maxLevel;
|
||||
public bool[] statusExist = new bool[enemyLevelMax];
|
||||
public bool[] appearInBook = new bool[enemyLevelMax];
|
||||
public EnemyStatus[] status = new EnemyStatus[enemyLevelMax];
|
||||
public GameObject cache;
|
||||
public Sprite spriteCache;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class NPC {
|
||||
public string path;
|
||||
public GameObject cache;
|
||||
}
|
||||
|
||||
/*
|
||||
[System.Serializable]
|
||||
public class Facility {
|
||||
public int referBit;
|
||||
public string path;
|
||||
public string spritePath;
|
||||
public GameObject cache;
|
||||
public Sprite spriteCache;
|
||||
}
|
||||
*/
|
||||
|
||||
[System.Serializable]
|
||||
public class AnimCon {
|
||||
public string path;
|
||||
public RuntimeAnimatorController cache;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class UICache {
|
||||
public GameObject balloonSerif;
|
||||
public GameObject damagePlayer;
|
||||
public GameObject damageHeal;
|
||||
public GameObject damageEnemy;
|
||||
public GameObject damageCritical;
|
||||
public GameObject damageBack;
|
||||
public GameObject damageEffective;
|
||||
public GameObject damageHyper;
|
||||
public GameObject damageHard;
|
||||
public GameObject damageHardBack;
|
||||
public GameObject enemyCanvas;
|
||||
public GameObject justDodgeHigh;
|
||||
public GameObject justDodgeMiddle;
|
||||
public GameObject justDodgeLow;
|
||||
public GameObject getExp;
|
||||
public GameObject gutsNormal;
|
||||
public GameObject gutsLast;
|
||||
public GameObject defeatRemain;
|
||||
public GameObject fieldBuffHP;
|
||||
public GameObject fieldBuffST;
|
||||
public GameObject fieldBuffAttack;
|
||||
}
|
||||
|
||||
public Friends[] friends;
|
||||
public Enemy[] enemy;
|
||||
public VariableStatus[] variableStatus;
|
||||
public NPC[] npc;
|
||||
public UICache ui;
|
||||
public AnimCon[] animCon;
|
||||
// public Facility[] facility;
|
||||
|
||||
public static readonly int[] sinWREnemyIDArray = { 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 52, 55, 56, 57, 58, 59, 60, 64, 65, 66 };
|
||||
public const int sandstarRawLevel = 4;
|
||||
public const int amusementBossLevel = 1;
|
||||
|
||||
protected override void Awake() {
|
||||
if (CheckInstance()) {
|
||||
DontDestroyOnLoad(gameObject);
|
||||
SetCharacterData();
|
||||
LoadEnemyTable();
|
||||
LoadStatusTable();
|
||||
SetUICache();
|
||||
}
|
||||
}
|
||||
|
||||
void SetCharacterData() {
|
||||
SetFriends(1, "Prefab/Friends/001_Kaban", 1);
|
||||
SetFriends(2, "Prefab/Friends/002_Hippo", 2);
|
||||
SetFriends(3, "Prefab/Friends/003_Otter", 1);
|
||||
SetFriends(4, "Prefab/Friends/004_Jaguar", 3);
|
||||
SetFriends(5, "Prefab/Friends/005_Ibis", 2);
|
||||
SetFriends(6, "Prefab/Friends/006_Alpaca", 1);
|
||||
SetFriends(7, "Prefab/Friends/007_SandCat", 2);
|
||||
SetFriends(8, "Prefab/Friends/008_Tsuchinoko", 3);
|
||||
SetFriends(9, "Prefab/Friends/009_Beaver", 2);
|
||||
SetFriends(10, "Prefab/Friends/010_PrairieDog", 2);
|
||||
SetFriends(11, "Prefab/Friends/011_Moose", 5);
|
||||
SetFriends(12, "Prefab/Friends/012_Lion", 5);
|
||||
SetFriends(13, "Prefab/Friends/013_WhiteOwl", 4);
|
||||
SetFriends(14, "Prefab/Friends/014_EagleOwl", 4);
|
||||
SetFriends(15, "Prefab/Friends/015_Margay", 1);
|
||||
SetFriends(16, "Prefab/Friends/016_Princess", 1);
|
||||
SetFriends(17, "Prefab/Friends/017_Rocker", 1);
|
||||
SetFriends(18, "Prefab/Friends/018_Gean", 1);
|
||||
SetFriends(19, "Prefab/Friends/019_Hululu", 3);
|
||||
SetFriends(20, "Prefab/Friends/020_Emperor", 2);
|
||||
SetFriends(21, "Prefab/Friends/021_RedFox", 2);
|
||||
SetFriends(22, "Prefab/Friends/022_SilverFox", 3);
|
||||
SetFriends(23, "Prefab/Friends/023_CampoFlicker", 2);
|
||||
SetFriends(24, "Prefab/Friends/024_GrayWolf", 3);
|
||||
SetFriends(25, "Prefab/Friends/025_Giraffe", 3);
|
||||
SetFriends(26, "Prefab/Friends/026_GoldenMonkey", 4);
|
||||
SetFriends(27, "Prefab/Friends/027_BrownBear", 6);
|
||||
SetFriends(28, "Prefab/Friends/028_PaintedWolf", 4);
|
||||
SetFriends(29, "Prefab/Friends/029_Raccoon", 2);
|
||||
SetFriends(30, "Prefab/Friends/030_Fennec", 2);
|
||||
SetFriends(31, "Prefab/Friends/031_AnotherServal", 10);
|
||||
SetFriends(32, "Prefab/Friends/032_Serval", 8);
|
||||
SetFriends(33, "Prefab/Friends/033_HyperServal", 33);
|
||||
|
||||
enemy[0].path = "Prefab/Enemy/000_WingBolt";
|
||||
enemy[1].path = "Prefab/Enemy/001_PlugAdapter";
|
||||
enemy[2].path = "Prefab/Enemy/002_SmartBall";
|
||||
enemy[3].path = "Prefab/Enemy/003_Debris";
|
||||
enemy[4].path = "Prefab/Enemy/004_Amoeba";
|
||||
enemy[5].path = "Prefab/Enemy/005_Dissodinium";
|
||||
enemy[6].path = "Prefab/Enemy/006_Ceratium";
|
||||
enemy[7].path = "Prefab/Enemy/007_Ornithocercus";
|
||||
enemy[8].path = "Prefab/Enemy/008_Desmodesmus";
|
||||
enemy[9].path = "Prefab/Enemy/009_Chaetoceros";
|
||||
enemy[10].path = "Prefab/Enemy/010_Euglena";
|
||||
enemy[11].path = "Prefab/Enemy/011_Volvox";
|
||||
enemy[12].path = "Prefab/Enemy/012_Alexandrium";
|
||||
enemy[13].path = "Prefab/Enemy/013_Ambigolimax";
|
||||
enemy[14].path = "Prefab/Enemy/014_Camponotus";
|
||||
enemy[15].path = "Prefab/Enemy/015_Anotogaster";
|
||||
enemy[16].path = "Prefab/Enemy/016_Scorpiones";
|
||||
enemy[17].path = "Prefab/Enemy/017_ScorpionesMagnus";
|
||||
enemy[18].path = "Prefab/Enemy/018_Araneus";
|
||||
enemy[19].path = "Prefab/Enemy/019_Aurelia";
|
||||
enemy[20].path = "Prefab/Enemy/020_Daphnia";
|
||||
enemy[21].path = "Prefab/Enemy/021_Aedes";
|
||||
enemy[22].path = "Prefab/Enemy/022_Tenodera";
|
||||
enemy[23].path = "Prefab/Enemy/023_Polistes";
|
||||
enemy[24].path = "Prefab/Enemy/024_Parantica";
|
||||
enemy[25].path = "Prefab/Enemy/025_Birdlien";
|
||||
enemy[26].path = "Prefab/Enemy/026_Enypniastes";
|
||||
enemy[27].path = "Prefab/Enemy/027_Clione";
|
||||
enemy[28].path = "Prefab/Enemy/028_Bathynomus";
|
||||
enemy[29].path = "Prefab/Enemy/029_Oligochaeta";
|
||||
enemy[30].path = "Prefab/Enemy/030_Ramazzottius";
|
||||
enemy[31].path = "Prefab/Enemy/031_Ammonitida";
|
||||
enemy[32].path = "Prefab/Enemy/032_Amanita";
|
||||
enemy[33].path = "Prefab/Enemy/033_Periplaneta";
|
||||
enemy[34].path = "Prefab/Enemy/034_Anomalocaris";
|
||||
enemy[35].path = "Prefab/Enemy/035_Halocynthia";
|
||||
enemy[36].path = "Prefab/Enemy/036_Dunkleosteus";
|
||||
enemy[37].path = "Prefab/Enemy/037_TRex";
|
||||
enemy[38].path = "Prefab/Enemy/038_Eomaia";
|
||||
enemy[39].path = "Prefab/Enemy/039_Australopithecus";
|
||||
enemy[40].path = "Prefab/Enemy/040_AlligatorClips";
|
||||
enemy[41].path = "Prefab/Enemy/041_DarkServal1";
|
||||
enemy[42].path = "Prefab/Enemy/042_B-2";
|
||||
enemy[43].path = "Prefab/Enemy/043_RedGrowl";
|
||||
enemy[44].path = "Prefab/Enemy/044_Akula";
|
||||
enemy[45].path = "Prefab/Enemy/045_DarkServal2";
|
||||
enemy[46].path = "Prefab/Enemy/046_CeckyBeast";
|
||||
enemy[47].path = "Prefab/Enemy/047_Glaucus";
|
||||
enemy[48].path = "Prefab/Enemy/048_SnowTower";
|
||||
enemy[49].path = "Prefab/Enemy/049_Queen";
|
||||
enemy[50].path = "Prefab/Enemy/050_DarkServal_SP1";
|
||||
enemy[51].path = "Prefab/Enemy/051_DarkServal_SP2";
|
||||
enemy[52].path = "Prefab/Enemy/052_DarkServal3";
|
||||
enemy[53].path = "Prefab/Enemy/053_HomoSapiens";
|
||||
enemy[54].path = "Prefab/Enemy/054_Dummy";
|
||||
enemy[55].path = "Prefab/Enemy/055_AlligatorClipsRaw";
|
||||
enemy[56].path = "Prefab/Enemy/056_B-2Raw";
|
||||
enemy[57].path = "Prefab/Enemy/057_RedGrowlRaw";
|
||||
enemy[58].path = "Prefab/Enemy/058_CeckyBeastRaw";
|
||||
enemy[59].path = "Prefab/Enemy/059_SnowTowerRaw";
|
||||
enemy[60].path = "Prefab/Enemy/060_BigDog";
|
||||
enemy[61].path = "Prefab/Enemy/061_BigDogEX";
|
||||
enemy[62].path = "Prefab/Enemy/062_BigDogInside";
|
||||
enemy[63].path = "Prefab/Enemy/063_QueenRaw";
|
||||
enemy[64].path = "Prefab/Enemy/064_Heliozoa";
|
||||
enemy[65].path = "Prefab/Enemy/065_Empress";
|
||||
enemy[66].path = "Prefab/Enemy/066_ImperatrixMundi";
|
||||
enemy[0].spritePath = "Enemy/face_000_WingBolt";
|
||||
enemy[1].spritePath = "Enemy/face_001_PlugAdapter";
|
||||
enemy[2].spritePath = "Enemy/face_002_SmartBall";
|
||||
enemy[3].spritePath = "Enemy/face_003_Debris";
|
||||
enemy[4].spritePath = "Enemy/face_004_Amoeba";
|
||||
enemy[5].spritePath = "Enemy/face_005_Dissodinium";
|
||||
enemy[6].spritePath = "Enemy/face_006_Ceratium";
|
||||
enemy[7].spritePath = "Enemy/face_007_Ornithocercus";
|
||||
enemy[8].spritePath = "Enemy/face_008_Desmodesmus";
|
||||
enemy[9].spritePath = "Enemy/face_009_Chaetoceros";
|
||||
enemy[10].spritePath = "Enemy/face_010_Euglena";
|
||||
enemy[11].spritePath = "Enemy/face_011_Volvox";
|
||||
enemy[12].spritePath = "Enemy/face_012_Alexandrium";
|
||||
enemy[13].spritePath = "Enemy/face_013_Ambigolimax";
|
||||
enemy[14].spritePath = "Enemy/face_014_Camponotus";
|
||||
enemy[15].spritePath = "Enemy/face_015_Anotogaster";
|
||||
enemy[16].spritePath = "Enemy/face_016_Scorpiones";
|
||||
enemy[17].spritePath = "Enemy/face_017_ScorpionesMagnus";
|
||||
enemy[18].spritePath = "Enemy/face_018_Araneus";
|
||||
enemy[19].spritePath = "Enemy/face_019_Aurelia";
|
||||
enemy[20].spritePath = "Enemy/face_020_Daphnia";
|
||||
enemy[21].spritePath = "Enemy/face_021_Aedes";
|
||||
enemy[22].spritePath = "Enemy/face_022_Tenodera";
|
||||
enemy[23].spritePath = "Enemy/face_023_Polistes";
|
||||
enemy[24].spritePath = "Enemy/face_024_Parantica";
|
||||
enemy[25].spritePath = "Enemy/face_025_Birdlien";
|
||||
enemy[26].spritePath = "Enemy/face_026_Enypniastes";
|
||||
enemy[27].spritePath = "Enemy/face_027_Clione";
|
||||
enemy[28].spritePath = "Enemy/face_028_Bathynomus";
|
||||
enemy[29].spritePath = "Enemy/face_029_Oligochaeta";
|
||||
enemy[30].spritePath = "Enemy/face_030_Ramazzottius";
|
||||
enemy[31].spritePath = "Enemy/face_031_Ammonitida";
|
||||
enemy[32].spritePath = "Enemy/face_032_Amanita";
|
||||
enemy[33].spritePath = "Enemy/face_033_Periplaneta";
|
||||
enemy[34].spritePath = "Enemy/face_034_Anomalocaris";
|
||||
enemy[35].spritePath = "Enemy/face_035_Halocynthia";
|
||||
enemy[36].spritePath = "Enemy/face_036_Dunkleosteus";
|
||||
enemy[37].spritePath = "Enemy/face_037_TRex";
|
||||
enemy[38].spritePath = "Enemy/face_038_Eomaia";
|
||||
enemy[39].spritePath = "Enemy/face_039_Australopithecus";
|
||||
enemy[40].spritePath = "Enemy/face_040_AlligatorClips";
|
||||
enemy[41].spritePath = "Enemy/face_041_DarkServal1";
|
||||
enemy[42].spritePath = "Enemy/face_042_B-2";
|
||||
enemy[43].spritePath = "Enemy/face_043_RedGrowl";
|
||||
enemy[44].spritePath = "Enemy/face_044_Akula";
|
||||
enemy[45].spritePath = "Enemy/face_045_DarkServal2";
|
||||
enemy[46].spritePath = "Enemy/face_046_CeckyBeast";
|
||||
enemy[47].spritePath = "Enemy/face_047_Glaucus";
|
||||
enemy[48].spritePath = "Enemy/face_048_SnowTower";
|
||||
enemy[49].spritePath = "Enemy/face_049_Queen";
|
||||
enemy[50].spritePath = "Enemy/face_050_DarkServal_SP1";
|
||||
enemy[51].spritePath = "Enemy/face_051_DarkServal_SP2";
|
||||
enemy[52].spritePath = "Enemy/face_052_DarkServal3";
|
||||
enemy[53].spritePath = "Enemy/face_053_HomoSapiens";
|
||||
enemy[54].spritePath = "Enemy/face_054_Dummy";
|
||||
enemy[55].spritePath = "Enemy/face_055_AlligatorClipsRaw";
|
||||
enemy[56].spritePath = "Enemy/face_056_B-2Raw";
|
||||
enemy[57].spritePath = "Enemy/face_057_RedGrowlRaw";
|
||||
enemy[58].spritePath = "Enemy/face_058_CeckyBeastRaw";
|
||||
enemy[59].spritePath = "Enemy/face_059_SnowTowerRaw";
|
||||
enemy[60].spritePath = "Enemy/face_060_BigDog";
|
||||
enemy[61].spritePath = "Enemy/face_061_BigDogEX";
|
||||
enemy[62].spritePath = "Enemy/face_062_BigDogInside";
|
||||
enemy[63].spritePath = "Enemy/face_063_QueenRaw";
|
||||
enemy[64].spritePath = "Enemy/face_064_Heliozoa";
|
||||
enemy[65].spritePath = "Enemy/face_065_Empress";
|
||||
enemy[66].spritePath = "Enemy/face_066_ImperatrixMundi";
|
||||
for (int i = 0; i < 67; i++) {
|
||||
enemy[i].maxLevel = 4;
|
||||
}
|
||||
enemy[50].maxLevel = 0;
|
||||
enemy[51].maxLevel = 0;
|
||||
enemy[53].maxLevel = 0;
|
||||
enemy[61].maxLevel = 0;
|
||||
enemy[63].maxLevel = 0;
|
||||
for (int i = 0; i < 40; i++) {
|
||||
for (int j = 1; j < enemy[i].appearInBook.Length; j++) {
|
||||
enemy[i].appearInBook[j] = true;
|
||||
}
|
||||
}
|
||||
for (int i = 40; i < 67; i++) {
|
||||
enemy[i].appearInBook[0] = true;
|
||||
}
|
||||
enemy[39].appearInBook[0] = true;
|
||||
enemy[66].appearInBook[4] = true;
|
||||
|
||||
npc[0].path = "Prefab/NPC/000_LuckyBeast";
|
||||
npc[1].path = "Prefab/NPC/001_Fossa";
|
||||
npc[2].path = "Prefab/NPC/002_Tamandua";
|
||||
npc[3].path = "Prefab/NPC/003_ScarletIbis";
|
||||
npc[4].path = "Prefab/NPC/004_Oryx";
|
||||
npc[5].path = "Prefab/NPC/005_Elephant";
|
||||
npc[6].path = "Prefab/NPC/006_AxisDeer";
|
||||
npc[7].path = "Prefab/NPC/007_Porcupine";
|
||||
npc[8].path = "Prefab/NPC/008_Aurochs";
|
||||
npc[9].path = "Prefab/NPC/009_Armadillo";
|
||||
npc[10].path = "Prefab/NPC/010_Chameleon";
|
||||
npc[11].path = "Prefab/NPC/011_Shoebill";
|
||||
npc[12].path = "Prefab/NPC/012_GiantPenguin";
|
||||
npc[13].path = "Prefab/NPC/013_Capybara";
|
||||
npc[14].path = "Prefab/NPC/014_Tapir";
|
||||
npc[15].path = "Prefab/NPC/015_Aardwolf";
|
||||
npc[16].path = "Prefab/NPC/016_Dolphin";
|
||||
npc[17].path = "Prefab/NPC/017_LuckyBeastGenbu";
|
||||
npc[18].path = "Prefab/NPC/018_LuckyBeastType3";
|
||||
npc[19].path = "Prefab/NPC/019_Nana";
|
||||
npc[20].path = "Prefab/NPC/020_Mirai";
|
||||
npc[21].path = "Prefab/NPC/021_Kako";
|
||||
npc[22].path = "Prefab/NPC/022_SecondServal";
|
||||
npc[23].path = "Prefab/NPC/023_Oinarisama";
|
||||
npc[24].path = "Prefab/NPC/024_Kitsunezaki";
|
||||
|
||||
|
||||
animCon[1].path = "AnimCon/Kaban";
|
||||
animCon[2].path = "AnimCon/Hippo";
|
||||
animCon[3].path = "AnimCon/Otter";
|
||||
animCon[4].path = "AnimCon/Jaguar";
|
||||
animCon[5].path = "AnimCon/Ibis";
|
||||
animCon[6].path = "AnimCon/Alpaca";
|
||||
animCon[7].path = "AnimCon/SandCat";
|
||||
animCon[8].path = "AnimCon/Tsuchinoko";
|
||||
animCon[9].path = "AnimCon/Beaver";
|
||||
animCon[10].path = "AnimCon/PrairieDog";
|
||||
animCon[11].path = "AnimCon/Moose";
|
||||
animCon[12].path = "AnimCon/Lion";
|
||||
animCon[13].path = "AnimCon/WhiteOwl";
|
||||
animCon[14].path = "AnimCon/EagleOwl";
|
||||
animCon[15].path = "AnimCon/Margay";
|
||||
animCon[16].path = "AnimCon/PPP_Female";
|
||||
animCon[17].path = "AnimCon/PPP_Male";
|
||||
animCon[21].path = "AnimCon/RedFox";
|
||||
animCon[22].path = "AnimCon/SilverFox";
|
||||
animCon[23].path = "AnimCon/CampoFlicker";
|
||||
animCon[24].path = "AnimCon/GrayWolf";
|
||||
animCon[25].path = "AnimCon/Giraffe";
|
||||
animCon[26].path = "AnimCon/GoldenMonkey";
|
||||
animCon[27].path = "AnimCon/BrownBear";
|
||||
animCon[28].path = "AnimCon/PaintedWolf";
|
||||
animCon[29].path = "AnimCon/Raccoon";
|
||||
animCon[30].path = "AnimCon/Fennec";
|
||||
animCon[31].path = "AnimCon/AnotherServal";
|
||||
animCon[32].path = "AnimCon/IFR_Kaban";
|
||||
animCon[33].path = "AnimCon/IFR_Hippo";
|
||||
animCon[34].path = "AnimCon/IFR_Otter";
|
||||
animCon[35].path = "AnimCon/IFR_Jaguar";
|
||||
animCon[36].path = "AnimCon/IFR_Ibis";
|
||||
animCon[37].path = "AnimCon/IFR_Alpaca";
|
||||
animCon[38].path = "AnimCon/IFR_SandCat";
|
||||
animCon[39].path = "AnimCon/IFR_Tsuchinoko";
|
||||
animCon[40].path = "AnimCon/IFR_PrairieDog";
|
||||
animCon[41].path = "AnimCon/IFR_Moose";
|
||||
animCon[42].path = "AnimCon/IFR_Lion";
|
||||
animCon[43].path = "AnimCon/IFR_EagleOwl";
|
||||
animCon[44].path = "AnimCon/IFR_CampoFlicker";
|
||||
animCon[45].path = "AnimCon/IFR_GrayWolf";
|
||||
animCon[46].path = "AnimCon/IFR_Giraffe";
|
||||
animCon[47].path = "AnimCon/IFR_GoldenMonkey";
|
||||
animCon[48].path = "AnimCon/IFR_BrownBear";
|
||||
animCon[49].path = "AnimCon/IFR_PaintedWolf";
|
||||
animCon[50].path = "AnimCon/IFR_AnotherServal";
|
||||
animCon[51].path = "AnimCon/IFR_LuckyBeast";
|
||||
animCon[52].path = "AnimCon/IFR_Fossa";
|
||||
animCon[53].path = "AnimCon/IFR_Tamandua";
|
||||
animCon[54].path = "AnimCon/IFR_Oryx";
|
||||
animCon[55].path = "AnimCon/IFR_AxisDeer";
|
||||
animCon[56].path = "AnimCon/IFR_Aurochs";
|
||||
animCon[57].path = "AnimCon/IFR_Shoebill";
|
||||
animCon[58].path = "AnimCon/IFR_GiantPenguin";
|
||||
animCon[59].path = "AnimCon/IFR_Dolphin";
|
||||
animCon[60].path = "AnimCon/IFR_LuckyBeastGenbu";
|
||||
animCon[61].path = "AnimCon/IFR_LuckyBeastType3";
|
||||
animCon[62].path = "AnimCon/Serval";
|
||||
animCon[63].path = "AnimCon/IFR_SitChair";
|
||||
animCon[64].path = "AnimCon/IFR_IbisAp";
|
||||
animCon[65].path = "AnimCon/IFR_MargayAp";
|
||||
animCon[66].path = "AnimCon/IFR_Kitsunezaki";
|
||||
|
||||
/*
|
||||
facility[0].path = "Prefab/Facility/JapariLibrary";
|
||||
facility[1].path = "Prefab/Facility/Pool";
|
||||
facility[2].path = "Prefab/Facility/Suberidai";
|
||||
facility[3].path = "Prefab/Facility/JunglePlant_Library";
|
||||
facility[4].path = "Prefab/Facility/JapariCafe";
|
||||
facility[5].path = "Prefab/Facility/DesertCave";
|
||||
facility[6].path = "Prefab/Facility/LogHouse";
|
||||
facility[7].path = "Prefab/Facility/ItemBox";
|
||||
facility[8].path = "Prefab/Facility/MogisenButai";
|
||||
facility[9].path = "Prefab/Facility/LionCastle";
|
||||
facility[10].path = "Prefab/Facility/PPP_Butai";
|
||||
facility[11].path = "Prefab/Facility/MusicBox";
|
||||
facility[12].path = "Prefab/Facility/Onsen";
|
||||
facility[13].path = "Prefab/Facility/VideoGameConsole";
|
||||
facility[14].path = "Prefab/Facility/VideoGameCase";
|
||||
facility[15].path = "Prefab/Facility/LodgeRoom";
|
||||
facility[16].path = "Prefab/Facility/Illust_Giraffe";
|
||||
facility[17].path = "Prefab/Facility/Illust_CampoFlicker";
|
||||
facility[18].path = "Prefab/Facility/Pencil";
|
||||
facility[19].path = "Prefab/Facility/Kitchen";
|
||||
facility[20].path = "Prefab/Facility/KitchenFire";
|
||||
facility[21].path = "Prefab/Facility/MiniInductionCooker";
|
||||
facility[22].path = "Prefab/Facility/BusLikeSet";
|
||||
facility[23].path = "Prefab/Facility/BusLikeOnly";
|
||||
facility[24].path = "Prefab/Facility/JapariBus";
|
||||
facility[25].path = "Prefab/Facility/AnotherServal_Sleeping";
|
||||
facility[26].path = "Prefab/Facility/Statue_Blue";
|
||||
facility[27].path = "Prefab/Facility/Statue_Red";
|
||||
facility[28].path = "Prefab/Facility/Statue_Violet";
|
||||
facility[29].path = "Prefab/Facility/Statue_Black";
|
||||
facility[30].path = "Prefab/Facility/Statue_Silver";
|
||||
facility[31].path = "Prefab/Facility/Statue_Golden";
|
||||
facility[32].path = "Prefab/Facility/Statue_Complex";
|
||||
facility[33].path = "Prefab/Facility/Sushizanmai";
|
||||
facility[34].path = "Prefab/Facility/DictionaryBook";
|
||||
facility[35].path = ""; //Dummy
|
||||
facility[36].path = "Prefab/Facility/DifficultyBook";
|
||||
facility[37].path = "Prefab/Facility/TutorialBook";
|
||||
facility[0].referBit = 0;
|
||||
facility[1].referBit = 1;
|
||||
facility[2].referBit = 2;
|
||||
facility[3].referBit = 3;
|
||||
facility[4].referBit = 4;
|
||||
facility[5].referBit = 5;
|
||||
facility[6].referBit = 6;
|
||||
facility[7].referBit = 7;
|
||||
facility[8].referBit = 8;
|
||||
facility[9].referBit = 9;
|
||||
facility[10].referBit = 10;
|
||||
facility[11].referBit = 11;
|
||||
facility[12].referBit = 12;
|
||||
facility[13].referBit = 13;
|
||||
facility[14].referBit = 13;
|
||||
facility[15].referBit = 14;
|
||||
facility[16].referBit = 14;
|
||||
facility[17].referBit = 14;
|
||||
facility[18].referBit = 14;
|
||||
facility[19].referBit = 15;
|
||||
facility[20].referBit = 15;
|
||||
facility[21].referBit = 16;
|
||||
facility[22].referBit = 17;
|
||||
facility[23].referBit = 17;
|
||||
facility[24].referBit = 18;
|
||||
facility[25].referBit = -1;
|
||||
facility[26].referBit = 19;
|
||||
facility[27].referBit = 19;
|
||||
facility[28].referBit = 19;
|
||||
facility[29].referBit = 19;
|
||||
facility[30].referBit = 19;
|
||||
facility[31].referBit = 19;
|
||||
facility[32].referBit = 19;
|
||||
facility[33].referBit = 20;
|
||||
facility[34].referBit = -1;
|
||||
facility[35].referBit = 21;
|
||||
facility[36].referBit = -1;
|
||||
facility[0].spritePath = "Facility/face_JapariLibrary";
|
||||
facility[1].spritePath = "Facility/face_Pool";
|
||||
facility[2].spritePath = "Facility/face_Suberidai";
|
||||
facility[3].spritePath = "Facility/face_JunglePlant";
|
||||
facility[4].spritePath = "Facility/face_JapariCafe";
|
||||
facility[5].spritePath = "Facility/face_DesertCave";
|
||||
facility[6].spritePath = "Facility/face_LogHouse";
|
||||
facility[7].spritePath = "Facility/face_ItemBox";
|
||||
facility[8].spritePath = "Facility/face_MogisenButai";
|
||||
facility[9].spritePath = "Facility/face_LionCastle";
|
||||
facility[10].spritePath = "Facility/face_PPP_Butai";
|
||||
facility[11].spritePath = "Facility/face_MusicBox";
|
||||
facility[12].spritePath = "Facility/face_Onsen";
|
||||
facility[14].spritePath = "Facility/face_VideoGame";
|
||||
facility[15].spritePath = "Facility/face_LodgeRoom";
|
||||
facility[19].spritePath = "Facility/face_Kitchen";
|
||||
facility[21].spritePath = "Facility/face_MiniInductionCooker";
|
||||
facility[23].spritePath = "Facility/face_BusLike";
|
||||
facility[24].spritePath = "Facility/face_JapariBus";
|
||||
facility[32].spritePath = "Facility/face_Statue";
|
||||
facility[33].spritePath = "Facility/face_Sushizanmai";
|
||||
facility[34].spritePath = "Facility/face_DictionaryBook";
|
||||
facility[35].spritePath = "Enemy/face_054_Dummy";
|
||||
facility[36].spritePath = "Facility/face_DifficultyBook";
|
||||
facility[37].spritePath = "Facility/face_TutorialBook";
|
||||
*/
|
||||
}
|
||||
|
||||
void LoadEnemyTable() {
|
||||
string filePath = "Text/enemy";
|
||||
TextAsset csv = Resources.Load<TextAsset>(filePath);
|
||||
StringReader reader = new StringReader(csv.text);
|
||||
while (reader.Peek() > -1) {
|
||||
string[] values = reader.ReadLine().Split('\t');
|
||||
int id = int.Parse(values[0]);
|
||||
if (id >= 0 && id < GameManager.enemyMax) {
|
||||
int level = int.Parse(values[1]);
|
||||
if (level >= 0 && level <= enemy[id].maxLevel) {
|
||||
enemy[id].statusExist[level] = true;
|
||||
enemy[id].status[level] = new EnemyStatus(int.Parse(values[2]), int.Parse(values[3]), int.Parse(values[4]), int.Parse(values[5]), int.Parse(values[6]), int.Parse(values[7]), int.Parse(values[8]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LoadStatusTable() {
|
||||
string filePath = "Text/status";
|
||||
TextAsset csv = Resources.Load<TextAsset>(filePath);
|
||||
StringReader reader = new StringReader(csv.text);
|
||||
int index = 0;
|
||||
int max = variableStatus.Length;
|
||||
while (reader.Peek() > -1 && index < max) {
|
||||
string[] values = reader.ReadLine().Split('\t');
|
||||
variableStatus[index] = new VariableStatus(int.Parse(values[0]), int.Parse(values[1]), int.Parse(values[2]), int.Parse(values[3]));
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void LoadFriendsTable() {
|
||||
string filePath = "Text/friends";
|
||||
TextAsset csv = Resources.Load<TextAsset>(filePath);
|
||||
StringReader reader = new StringReader(csv.text);
|
||||
while (reader.Peek() > -1) {
|
||||
string[] values = reader.ReadLine().Split('\t');
|
||||
int id = int.Parse(values[0]);
|
||||
if (id >= 0 && id < GameManager.friendsMax) {
|
||||
friends[id].status = new FriendsStatus(int.Parse(values[1]), int.Parse(values[2]), int.Parse(values[3]), int.Parse(values[4]), int.Parse(values[5]));
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void SetFriends(int id, string objName, int cost) {
|
||||
friends[id].path = objName;
|
||||
friends[id].cost = cost;
|
||||
}
|
||||
|
||||
void SetEnemy(int id, string objName, int maxLevel = 4) {
|
||||
enemy[id].path = objName;
|
||||
enemy[id].maxLevel = maxLevel;
|
||||
}
|
||||
|
||||
void SetUICache() {
|
||||
ui.balloonSerif = Resources.Load("Prefab/UI/BalloonSerif", typeof(GameObject)) as GameObject;
|
||||
ui.damagePlayer = Resources.Load("Prefab/UI/DamagePlayer", typeof(GameObject)) as GameObject;
|
||||
ui.damageHeal = Resources.Load("Prefab/UI/DamageHeal", typeof(GameObject)) as GameObject;
|
||||
ui.damageEnemy = Resources.Load("Prefab/UI/DamageEnemy", typeof(GameObject)) as GameObject;
|
||||
ui.damageCritical = Resources.Load("Prefab/UI/DamageCritical", typeof(GameObject)) as GameObject;
|
||||
ui.damageBack = Resources.Load("Prefab/UI/DamageBack", typeof(GameObject)) as GameObject;
|
||||
ui.damageEffective = Resources.Load("Prefab/UI/DamageEffective", typeof(GameObject)) as GameObject;
|
||||
ui.damageHyper = Resources.Load("Prefab/UI/DamageHyper", typeof(GameObject)) as GameObject;
|
||||
ui.damageHard = Resources.Load("Prefab/UI/DamageHard", typeof(GameObject)) as GameObject;
|
||||
ui.damageHardBack = Resources.Load("Prefab/UI/DamageHardBack", typeof(GameObject)) as GameObject;
|
||||
ui.enemyCanvas = Resources.Load("Prefab/UI/EnemyCanvas", typeof(GameObject)) as GameObject;
|
||||
ui.justDodgeHigh = Resources.Load("Prefab/UI/JustDodgeHigh", typeof(GameObject)) as GameObject;
|
||||
ui.justDodgeMiddle = Resources.Load("Prefab/UI/JustDodgeMiddle", typeof(GameObject)) as GameObject;
|
||||
ui.justDodgeLow = Resources.Load("Prefab/UI/JustDodgeLow", typeof(GameObject)) as GameObject;
|
||||
ui.getExp = Resources.Load("Prefab/UI/GetExp", typeof(GameObject)) as GameObject;
|
||||
ui.gutsNormal = Resources.Load("Prefab/UI/GutsNormal", typeof(GameObject)) as GameObject;
|
||||
ui.gutsLast = Resources.Load("Prefab/UI/GutsLast", typeof(GameObject)) as GameObject;
|
||||
ui.defeatRemain = Resources.Load("Prefab/UI/DefeatRemain", typeof(GameObject)) as GameObject;
|
||||
ui.fieldBuffHP = Resources.Load("Prefab/UI/FieldBuffHP", typeof(GameObject)) as GameObject;
|
||||
ui.fieldBuffST = Resources.Load("Prefab/UI/FieldBuffST", typeof(GameObject)) as GameObject;
|
||||
ui.fieldBuffAttack = Resources.Load("Prefab/UI/FieldBuffAttack", typeof(GameObject)) as GameObject;
|
||||
}
|
||||
|
||||
public GameObject GetDamagePrefab(int type) {
|
||||
switch (type) {
|
||||
case 0:
|
||||
return ui.damagePlayer;
|
||||
case 1:
|
||||
return ui.damageHeal;
|
||||
case 2:
|
||||
return ui.damageEnemy;
|
||||
case 3:
|
||||
return ui.damageCritical;
|
||||
case 4:
|
||||
return ui.damageBack;
|
||||
case 5:
|
||||
return ui.damageEffective;
|
||||
case 6:
|
||||
return ui.damageHyper;
|
||||
case 7:
|
||||
return ui.damageHard;
|
||||
case 8:
|
||||
return ui.damageHardBack;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public GameObject GetFriends(int id) {
|
||||
if (friends[id].cache == null) {
|
||||
friends[id].cache = Resources.Load(friends[id].path, typeof(GameObject)) as GameObject;
|
||||
}
|
||||
return friends[id].cache;
|
||||
}
|
||||
|
||||
public GameObject GetEnemy(int id) {
|
||||
if (enemy[id].cache == null) {
|
||||
enemy[id].cache = Resources.Load(enemy[id].path, typeof(GameObject)) as GameObject;
|
||||
}
|
||||
return enemy[id].cache;
|
||||
}
|
||||
|
||||
public GameObject GetNPC(int id) {
|
||||
if (npc[id].cache == null) {
|
||||
npc[id].cache = Resources.Load(npc[id].path, typeof(GameObject)) as GameObject;
|
||||
}
|
||||
return npc[id].cache;
|
||||
}
|
||||
|
||||
/*
|
||||
public GameObject GetFacility(int id) {
|
||||
if (facility[id].cache == null) {
|
||||
facility[id].cache = Resources.Load(facility[id].path, typeof(GameObject)) as GameObject;
|
||||
}
|
||||
return facility[id].cache;
|
||||
}
|
||||
|
||||
public Sprite GetFacilitySprite(int id) {
|
||||
if (string.IsNullOrEmpty(facility[id].spritePath)) {
|
||||
return null;
|
||||
} else if (facility[id].spriteCache == null) {
|
||||
facility[id].spriteCache = Resources.Load(facility[id].spritePath, typeof(Sprite)) as Sprite;
|
||||
}
|
||||
return facility[id].spriteCache;
|
||||
}
|
||||
*/
|
||||
|
||||
public Sprite GetEnemySprite(int id) {
|
||||
if (string.IsNullOrEmpty(enemy[id].spritePath)) {
|
||||
return null;
|
||||
} else if (enemy[id].spriteCache == null) {
|
||||
enemy[id].spriteCache = Resources.Load(enemy[id].spritePath, typeof(Sprite)) as Sprite;
|
||||
}
|
||||
return enemy[id].spriteCache;
|
||||
}
|
||||
|
||||
public bool CheckFacilityEnabled(int id) {
|
||||
if (id >= 0) {
|
||||
int referBit = ItemDatabase.Instance.GetItemPrice(ItemDatabase.facilityBottom + id);
|
||||
if (referBit < 0 || GameManager.Instance.save.facilityDisabled == 0) {
|
||||
return true;
|
||||
} else {
|
||||
return (GameManager.Instance.save.facilityDisabled & (1 << referBit)) == 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SwitchFacilityEnabled(int id) {
|
||||
if (id >= 0) {
|
||||
int referBit = ItemDatabase.Instance.GetItemPrice(ItemDatabase.facilityBottom + id);
|
||||
if (referBit >= 0) {
|
||||
GameManager.Instance.save.facilityDisabled ^= (1 << referBit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public RuntimeAnimatorController GetAnimCon(int id) {
|
||||
if (animCon[id].cache == null) {
|
||||
animCon[id].cache = Resources.Load(animCon[id].path, typeof(RuntimeAnimatorController)) as RuntimeAnimatorController;
|
||||
}
|
||||
return animCon[id].cache;
|
||||
}
|
||||
|
||||
/*
|
||||
public void UnloadEnemyCache() {
|
||||
for (int i = 0; i < enemy.Length; i++) {
|
||||
if (enemy[i].cache != null) {
|
||||
Destroy(enemy[i].cache);
|
||||
enemy[i].cache = null;
|
||||
}
|
||||
}
|
||||
Resources.UnloadUnusedAssets();
|
||||
}
|
||||
*/
|
||||
}
|
4986
Script/CharacterManager.cs
Normal file
4986
Script/CharacterManager.cs
Normal file
File diff suppressed because it is too large
Load diff
19
Script/CheckArmsSound.cs
Normal file
19
Script/CheckArmsSound.cs
Normal file
|
@ -0,0 +1,19 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CheckArmsSound : MonoBehaviour {
|
||||
|
||||
public AudioSource targetAudioSource;
|
||||
int configSave = -1;
|
||||
|
||||
void Update() {
|
||||
int configTemp = GameManager.Instance.save.config[GameManager.Save.configID_ShowArms];
|
||||
if (configSave != configTemp) {
|
||||
configSave = configTemp;
|
||||
if (targetAudioSource) {
|
||||
targetAudioSource.enabled = (configSave == 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
24
Script/CheckAttackEnabledToActivate.cs
Normal file
24
Script/CheckAttackEnabledToActivate.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CheckAttackEnabledToActivate : MonoBehaviour {
|
||||
|
||||
public GameObject activateTarget;
|
||||
public AttackDetection attackDetection;
|
||||
|
||||
void Start () {
|
||||
if (attackDetection == null) {
|
||||
attackDetection = GetComponentInParent<AttackDetection>();
|
||||
}
|
||||
if (activateTarget) {
|
||||
activateTarget.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
void Update () {
|
||||
if (activateTarget && attackDetection && attackDetection.attackEnabled != activateTarget.activeSelf) {
|
||||
activateTarget.SetActive(attackDetection.attackEnabled);
|
||||
}
|
||||
}
|
||||
}
|
37
Script/CheckMultiHitIntervalForBuff.cs
Normal file
37
Script/CheckMultiHitIntervalForBuff.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CheckMultiHitIntervalForBuff : MonoBehaviour {
|
||||
|
||||
public float multiHitBuffInterval = 0.1f;
|
||||
public int multiHitBuffMaxCount;
|
||||
AttackDetection attackDetection;
|
||||
float multiHitDefaultInterval;
|
||||
int multiHitDefaultMaxCount;
|
||||
|
||||
private void Awake() {
|
||||
attackDetection = GetComponent<AttackDetection>();
|
||||
if (attackDetection) {
|
||||
multiHitDefaultInterval = attackDetection.multiHitInterval;
|
||||
multiHitDefaultMaxCount = attackDetection.multiHitMaxCount;
|
||||
CheckMulti();
|
||||
}
|
||||
}
|
||||
|
||||
void CheckMulti() {
|
||||
if (attackDetection && CharacterManager.Instance) {
|
||||
if (CharacterManager.Instance.GetBuff(CharacterManager.BuffType.Multi)) {
|
||||
attackDetection.multiHitInterval = multiHitBuffInterval;
|
||||
attackDetection.multiHitMaxCount = multiHitBuffMaxCount;
|
||||
} else {
|
||||
attackDetection.multiHitInterval = multiHitDefaultInterval;
|
||||
attackDetection.multiHitMaxCount = multiHitDefaultMaxCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Update() {
|
||||
CheckMulti();
|
||||
}
|
||||
}
|
44
Script/CheckTriggerStay.cs
Normal file
44
Script/CheckTriggerStay.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CheckTriggerStay : MonoBehaviour {
|
||||
|
||||
public string targetTag = "EnemyDamageDetection";
|
||||
public string targetLayer = "";
|
||||
public bool stayFlag;
|
||||
public GameObject stayObj;
|
||||
int stayCount;
|
||||
|
||||
int targetLayerIndex = -1;
|
||||
|
||||
private void Awake() {
|
||||
if (!string.IsNullOrEmpty(targetLayer)) {
|
||||
targetLayerIndex = LayerMask.NameToLayer(targetLayer);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerStay(Collider other) {
|
||||
if ((string.IsNullOrEmpty(targetTag) || other.CompareTag(targetTag)) && (targetLayerIndex < 0 || other.gameObject.layer == targetLayerIndex)) {
|
||||
stayCount = 2;
|
||||
stayFlag = true;
|
||||
stayObj = other.gameObject;
|
||||
}
|
||||
}
|
||||
|
||||
private void LateUpdate() {
|
||||
if (stayFlag) {
|
||||
stayCount--;
|
||||
if (stayCount <= 0) {
|
||||
stayFlag = false;
|
||||
stayObj = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable() {
|
||||
stayFlag = false;
|
||||
stayCount = 0;
|
||||
}
|
||||
|
||||
}
|
7
Script/ClimbChainTarget.cs
Normal file
7
Script/ClimbChainTarget.cs
Normal file
|
@ -0,0 +1,7 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class ClimbChainTarget : MonoBehaviour {
|
||||
|
||||
public Transform target;
|
||||
|
||||
}
|
7
Script/ClimbLookTarget.cs
Normal file
7
Script/ClimbLookTarget.cs
Normal file
|
@ -0,0 +1,7 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class ClimbLookTarget : MonoBehaviour {
|
||||
|
||||
public Transform target;
|
||||
|
||||
}
|
23
Script/ClimbTrigger.cs
Normal file
23
Script/ClimbTrigger.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ClimbTrigger : MonoBehaviour {
|
||||
|
||||
private void OnTriggerEnter(Collider other) {
|
||||
if (other.CompareTag("Player")) {
|
||||
PlayerController pCon = other.gameObject.GetComponent<PlayerController>();
|
||||
if (pCon != null) {
|
||||
pCon.climbTarget = transform;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void OnTriggerExit(Collider other) {
|
||||
if (other.CompareTag("Player")) {
|
||||
PlayerController pCon = other.gameObject.GetComponent<PlayerController>();
|
||||
if (pCon != null && pCon.climbTarget == transform) {
|
||||
pCon.climbTarget = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
122
Script/ConsoleBase.cs
Normal file
122
Script/ConsoleBase.cs
Normal file
|
@ -0,0 +1,122 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Rewired;
|
||||
|
||||
public class ConsoleBase : MonoBehaviour {
|
||||
|
||||
public GameObject balloonPrefab;
|
||||
public Vector3 balloonOffset;
|
||||
public string titleKey;
|
||||
public string[] choiceKeys;
|
||||
public int choiceCancelNumber;
|
||||
|
||||
protected Player playerInput;
|
||||
protected GameObject balloonInstance;
|
||||
protected int state;
|
||||
protected int pauseWait;
|
||||
protected bool entering;
|
||||
protected int choiceAnswer = -1;
|
||||
protected bool actionTextEnabled;
|
||||
protected const string targetTag = "ItemGetter";
|
||||
|
||||
protected void Start() {
|
||||
balloonInstance = Instantiate(balloonPrefab, transform.position + balloonOffset, transform.rotation, transform);
|
||||
playerInput = GameManager.Instance.playerInput;
|
||||
}
|
||||
|
||||
protected void Update() {
|
||||
if (CharacterManager.Instance && PauseController.Instance) {
|
||||
if (state >= 2 && CharacterManager.Instance.pCon && CharacterManager.Instance.pCon.GetNowHP() <= 0) {
|
||||
PauseController.Instance.PauseDictionary(false);
|
||||
CancelCommon();
|
||||
return;
|
||||
}
|
||||
switch (state) {
|
||||
case 1:
|
||||
if (PauseController.Instance) {
|
||||
if (PauseController.Instance.pauseGame) {
|
||||
pauseWait = 2;
|
||||
} else if (pauseWait > 0) {
|
||||
pauseWait--;
|
||||
}
|
||||
if (PauseController.Instance.returnToLibraryProcessing) {
|
||||
state = 0;
|
||||
}
|
||||
if (pauseWait <= 0 && PauseController.Instance.GetPauseEnabled() && playerInput.GetButtonDown(RewiredConsts.Action.Submit)) {
|
||||
UISE.Instance.Play(UISE.SoundName.submit);
|
||||
int choiceNum = choiceKeys.Length;
|
||||
PauseController.Instance.SetChoices(choiceNum, true, TextManager.Get(titleKey), choiceKeys[0], choiceNum > 1 ? choiceKeys[1] : "", choiceNum >2 ? choiceKeys[2] : "", choiceNum > 3 ? choiceKeys[3] : "", choiceNum > 4 ? choiceKeys[4] : "");
|
||||
choiceAnswer = -1;
|
||||
state = 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
choiceAnswer = PauseController.Instance.ChoicesControl();
|
||||
if (choiceAnswer != -1) {
|
||||
if (choiceAnswer == -2) {
|
||||
UISE.Instance.Play(UISE.SoundName.cancel);
|
||||
CancelCommon();
|
||||
} else if (choiceAnswer == choiceCancelNumber) {
|
||||
UISE.Instance.Play(UISE.SoundName.submit);
|
||||
CancelCommon();
|
||||
} else {
|
||||
UISE.Instance.Play(UISE.SoundName.submit);
|
||||
PauseController.Instance.CancelChoices();
|
||||
state = 3;
|
||||
PauseController.Instance.PauseDictionary(true);
|
||||
ConsoleStart();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
ConsoleUpdate();
|
||||
if (!PauseController.Instance.pauseGame) {
|
||||
state = 4;
|
||||
ConsoleEnd();
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
state = (entering ? 1 : 0);
|
||||
break;
|
||||
}
|
||||
bool actionTemp = (state == 1 && pauseWait <= 0 && PauseController.Instance.pauseEnabled);
|
||||
if (actionTextEnabled != actionTemp) {
|
||||
CharacterManager.Instance.SetActionType(actionTemp ? CharacterManager.ActionType.Search : CharacterManager.ActionType.None, gameObject);
|
||||
actionTextEnabled = actionTemp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void ConsoleStart() { }
|
||||
|
||||
protected virtual void ConsoleUpdate() { }
|
||||
|
||||
protected virtual void ConsoleEnd() { }
|
||||
|
||||
protected void CancelCommon() {
|
||||
PauseController.Instance.CancelChoices();
|
||||
PauseController.Instance.HideCaution();
|
||||
CharacterManager.Instance.HideGold();
|
||||
state = (entering ? 1 : 0);
|
||||
}
|
||||
|
||||
protected void OnTriggerEnter(Collider other) {
|
||||
if (other.CompareTag(targetTag)) {
|
||||
entering = true;
|
||||
if (state < 2) {
|
||||
state = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnTriggerExit(Collider other) {
|
||||
if (other.CompareTag(targetTag)) {
|
||||
entering = false;
|
||||
if (state < 2) {
|
||||
state = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
191
Script/ContainerDatabase.cs
Normal file
191
Script/ContainerDatabase.cs
Normal file
|
@ -0,0 +1,191 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
|
||||
public class ContainerDatabase : SingletonMonoBehaviour<ContainerDatabase> {
|
||||
|
||||
const int rankMax = 5;
|
||||
|
||||
public class ContainerData {
|
||||
public int id1;
|
||||
public int id2;
|
||||
public ContainerData(int id1, int id2 = -1) {
|
||||
this.id1 = id1;
|
||||
this.id2 = id2;
|
||||
}
|
||||
}
|
||||
|
||||
public ContainerData[][] containerArray = new ContainerData[rankMax][];
|
||||
|
||||
void ContainerCopy(int rank, int max, ContainerData[] tempArray) {
|
||||
containerArray[rank] = new ContainerData[max];
|
||||
for (int i = 0; i < max; i++) {
|
||||
containerArray[rank][i] = tempArray[i];
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Awake() {
|
||||
if (CheckInstance()) {
|
||||
DontDestroyOnLoad(gameObject);
|
||||
int index;
|
||||
ContainerData[] temp = new ContainerData[50];
|
||||
|
||||
index = 0;
|
||||
temp[index++] = new ContainerData(0);
|
||||
temp[index++] = new ContainerData(0);
|
||||
temp[index++] = new ContainerData(0);
|
||||
temp[index++] = new ContainerData(0);
|
||||
temp[index++] = new ContainerData(0);
|
||||
temp[index++] = new ContainerData(0);
|
||||
temp[index++] = new ContainerData(70);//1
|
||||
temp[index++] = new ContainerData(70);//1
|
||||
temp[index++] = new ContainerData(70);//1
|
||||
temp[index++] = new ContainerData(70, 70);//2
|
||||
temp[index++] = new ContainerData(20);
|
||||
temp[index++] = new ContainerData(20);
|
||||
temp[index++] = new ContainerData(41);
|
||||
temp[index++] = new ContainerData(41);
|
||||
temp[index++] = new ContainerData(40);
|
||||
ContainerCopy(0, index, temp);
|
||||
|
||||
index = 0;
|
||||
temp[index++] = new ContainerData(0, 0);
|
||||
temp[index++] = new ContainerData(0, 0);
|
||||
temp[index++] = new ContainerData(0, 0);
|
||||
temp[index++] = new ContainerData(1);
|
||||
temp[index++] = new ContainerData(1);
|
||||
temp[index++] = new ContainerData(1);
|
||||
temp[index++] = new ContainerData(70, 70);//2
|
||||
temp[index++] = new ContainerData(70, 70);//2
|
||||
temp[index++] = new ContainerData(71);//3
|
||||
temp[index++] = new ContainerData(71);//3
|
||||
temp[index++] = new ContainerData(9);
|
||||
temp[index++] = new ContainerData(21);
|
||||
temp[index++] = new ContainerData(22);
|
||||
temp[index++] = new ContainerData(23);
|
||||
temp[index++] = new ContainerData(24);
|
||||
temp[index++] = new ContainerData(41);
|
||||
temp[index++] = new ContainerData(41);
|
||||
temp[index++] = new ContainerData(42);
|
||||
temp[index++] = new ContainerData(42);
|
||||
temp[index++] = new ContainerData(53);
|
||||
temp[index++] = new ContainerData(54);
|
||||
temp[index++] = new ContainerData(86);
|
||||
ContainerCopy(1, index, temp);
|
||||
|
||||
index = 0;
|
||||
temp[index++] = new ContainerData(1);
|
||||
temp[index++] = new ContainerData(1);
|
||||
temp[index++] = new ContainerData(1, 0);
|
||||
temp[index++] = new ContainerData(1, 0);
|
||||
temp[index++] = new ContainerData(1, 0);
|
||||
temp[index++] = new ContainerData(1, 1);
|
||||
temp[index++] = new ContainerData(1, 1);
|
||||
temp[index++] = new ContainerData(71, 70);//4
|
||||
temp[index++] = new ContainerData(71, 70);//4
|
||||
temp[index++] = new ContainerData(71, 70);//4
|
||||
temp[index++] = new ContainerData(71, 70);//4
|
||||
temp[index++] = new ContainerData(9);
|
||||
temp[index++] = new ContainerData(23);
|
||||
temp[index++] = new ContainerData(24);
|
||||
temp[index++] = new ContainerData(25);
|
||||
temp[index++] = new ContainerData(26);
|
||||
temp[index++] = new ContainerData(43);
|
||||
temp[index++] = new ContainerData(44);
|
||||
temp[index++] = new ContainerData(50);
|
||||
temp[index++] = new ContainerData(50);
|
||||
temp[index++] = new ContainerData(55);
|
||||
temp[index++] = new ContainerData(56);
|
||||
temp[index++] = new ContainerData(60);
|
||||
temp[index++] = new ContainerData(61);
|
||||
temp[index++] = new ContainerData(62);
|
||||
temp[index++] = new ContainerData(87);
|
||||
ContainerCopy(2, index, temp);
|
||||
|
||||
index = 0;
|
||||
temp[index++] = new ContainerData(1, 1);
|
||||
temp[index++] = new ContainerData(1, 1);
|
||||
temp[index++] = new ContainerData(2);
|
||||
temp[index++] = new ContainerData(2);
|
||||
temp[index++] = new ContainerData(2);
|
||||
temp[index++] = new ContainerData(2, 1);
|
||||
temp[index++] = new ContainerData(2, 1);
|
||||
temp[index++] = new ContainerData(72);//5
|
||||
temp[index++] = new ContainerData(72);//5
|
||||
temp[index++] = new ContainerData(72,1);//6
|
||||
temp[index++] = new ContainerData(72,1);//6
|
||||
temp[index++] = new ContainerData(9, 9);
|
||||
temp[index++] = new ContainerData(25);
|
||||
temp[index++] = new ContainerData(26);
|
||||
temp[index++] = new ContainerData(27);
|
||||
temp[index++] = new ContainerData(28);
|
||||
temp[index++] = new ContainerData(43);
|
||||
temp[index++] = new ContainerData(44);
|
||||
temp[index++] = new ContainerData(51);
|
||||
temp[index++] = new ContainerData(51);
|
||||
temp[index++] = new ContainerData(55);
|
||||
temp[index++] = new ContainerData(56);
|
||||
temp[index++] = new ContainerData(60);
|
||||
temp[index++] = new ContainerData(61);
|
||||
temp[index++] = new ContainerData(62);
|
||||
temp[index++] = new ContainerData(88);
|
||||
ContainerCopy(3, index, temp);
|
||||
|
||||
index = 0;
|
||||
temp[index++] = new ContainerData(2, 1);
|
||||
temp[index++] = new ContainerData(2, 1);
|
||||
temp[index++] = new ContainerData(2, 1);
|
||||
temp[index++] = new ContainerData(2, 2);
|
||||
temp[index++] = new ContainerData(2, 2);
|
||||
temp[index++] = new ContainerData(2, 2);
|
||||
temp[index++] = new ContainerData(72, 70);//6
|
||||
temp[index++] = new ContainerData(72, 70);//6
|
||||
temp[index++] = new ContainerData(72, 71);//8
|
||||
temp[index++] = new ContainerData(72, 71);//8
|
||||
temp[index++] = new ContainerData(27);
|
||||
temp[index++] = new ContainerData(28);
|
||||
temp[index++] = new ContainerData(29);
|
||||
temp[index++] = new ContainerData(29);
|
||||
temp[index++] = new ContainerData(41, 42);
|
||||
temp[index++] = new ContainerData(42, 41);
|
||||
temp[index++] = new ContainerData(46);
|
||||
temp[index++] = new ContainerData(52);
|
||||
temp[index++] = new ContainerData(52);
|
||||
temp[index++] = new ContainerData(57);
|
||||
temp[index++] = new ContainerData(58);
|
||||
temp[index++] = new ContainerData(63);
|
||||
temp[index++] = new ContainerData(64);
|
||||
temp[index++] = new ContainerData(65);
|
||||
temp[index++] = new ContainerData(89);
|
||||
ContainerCopy(4, index, temp);
|
||||
}
|
||||
}
|
||||
|
||||
public int GetIDSingle(int rank) {
|
||||
int answer = -1;
|
||||
if (rank >= 0 && rank < rankMax) {
|
||||
int count = containerArray[rank].Length;
|
||||
int index = Random.Range(0, count);
|
||||
ContainerData temp = containerArray[rank][index];
|
||||
if (temp.id2 >= 0 && Random.Range(0, 2) == 1) {
|
||||
answer = temp.id2;
|
||||
} else {
|
||||
answer = temp.id1;
|
||||
}
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
|
||||
public int[] GetIDArray(int rank) {
|
||||
int[] answer = new int[2] { -1, -1 };
|
||||
if (rank >= 0 && rank < rankMax) {
|
||||
int count = containerArray[rank].Length;
|
||||
int index = Random.Range(0, count);
|
||||
ContainerData temp = containerArray[rank][index];
|
||||
answer[0] = temp.id1;
|
||||
answer[1] = temp.id2;
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
}
|
20
Script/ContainerOnlyContent.cs
Normal file
20
Script/ContainerOnlyContent.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ContainerOnlyContent : MonoBehaviour {
|
||||
|
||||
public int rank;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
bool isParenting = (StageManager.Instance && StageManager.Instance.dungeonController && StageManager.Instance.dungeonController.itemSettings.container);
|
||||
int replaceLevel = (StageManager.Instance && StageManager.Instance.dungeonController ? StageManager.Instance.dungeonController.itemReplaceLevel : 0);
|
||||
int itemID = ContainerDatabase.Instance.GetIDSingle(rank);
|
||||
ItemDatabase.Instance.GiveItem(itemID, transform.position, 5, -1, -1, -1, isParenting ? StageManager.Instance.dungeonController.itemSettings.container : null, replaceLevel);
|
||||
if (CharacterManager.Instance) {
|
||||
CharacterManager.Instance.CheckJaparimanShortage(itemID);
|
||||
}
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
32
Script/ControlMapperWrapper.cs
Normal file
32
Script/ControlMapperWrapper.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using Rewired.UI.ControlMapper;
|
||||
|
||||
public class ControlMapperWrapper : MonoBehaviour
|
||||
{
|
||||
|
||||
public ControlMapper controlMapper;
|
||||
public GameObject controlMapperActiveCheck;
|
||||
public TMP_Text controlInformationText;
|
||||
public LanguageData[] languageData;
|
||||
public ThemeSettings[] themeSettings;
|
||||
|
||||
public void InitializeTexts() {
|
||||
controlMapper.language = languageData[Mathf.Clamp(GameManager.Instance.save.language, 0, languageData.Length - 1)];
|
||||
controlMapper.themeArrange = themeSettings[Mathf.Clamp(GameManager.Instance.save.language, 0, themeSettings.Length - 1)];
|
||||
controlInformationText.text = TextManager.Get("CONFIG_KEYCONFIG");
|
||||
}
|
||||
|
||||
public void Open() {
|
||||
controlMapper.Open();
|
||||
}
|
||||
|
||||
public bool IsControlMapperActive {
|
||||
get {
|
||||
return controlMapper && controlMapperActiveCheck.activeSelf;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
42
Script/CounterDetection.cs
Normal file
42
Script/CounterDetection.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CounterDetection : MonoBehaviour {
|
||||
|
||||
public string targetTag = "EnemyAttackDetection";
|
||||
public bool ignorePlayer = false;
|
||||
|
||||
protected CharacterBase parentCBase;
|
||||
protected GameObject otherObj;
|
||||
|
||||
protected virtual void Awake() {
|
||||
parentCBase = GetComponentInParent<CharacterBase>();
|
||||
}
|
||||
|
||||
protected virtual void Action(bool isProjectile) {
|
||||
}
|
||||
|
||||
protected virtual void Check(Collider other) {
|
||||
if (parentCBase != null && other.CompareTag(targetTag)) {
|
||||
otherObj = other.gameObject;
|
||||
bool condition = true;
|
||||
bool isProjectile = false;
|
||||
AttackDetection attackDetection = otherObj.GetComponent<AttackDetection>();
|
||||
if (attackDetection) {
|
||||
isProjectile = attackDetection.isProjectile;
|
||||
if (ignorePlayer && CharacterManager.Instance.GetCharacterIsPlayer(attackDetection.GetParentCharacterBase())) {
|
||||
condition = false;
|
||||
}
|
||||
}
|
||||
if (condition) {
|
||||
Action(isProjectile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerStay(Collider other) {
|
||||
Check(other);
|
||||
}
|
||||
|
||||
}
|
36
Script/CounterDetection_AssistDodge.cs
Normal file
36
Script/CounterDetection_AssistDodge.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CounterDetection_AssistDodge : MonoBehaviour {
|
||||
|
||||
public string targetTag = "EnemyAttackDetection";
|
||||
|
||||
protected CharacterBase parentCBase;
|
||||
protected static readonly Vector3 vecForward = Vector3.forward;
|
||||
|
||||
protected virtual void Awake() {
|
||||
parentCBase = GetComponentInParent<CharacterBase>();
|
||||
}
|
||||
|
||||
void DodgeBody(Vector3 closestPoint) {
|
||||
int dodgeDir = Random.Range(-1, 2);
|
||||
if (transform.position != closestPoint) {
|
||||
closestPoint.y = transform.position.y;
|
||||
float axis = Vector3.Cross(transform.TransformDirection(vecForward), closestPoint - transform.position).y;
|
||||
if (axis > 0.001f) {
|
||||
dodgeDir = -1;
|
||||
} else if (axis < -0.001f) {
|
||||
dodgeDir = 1;
|
||||
}
|
||||
}
|
||||
parentCBase.CounterDodge(dodgeDir);
|
||||
}
|
||||
|
||||
private void OnTriggerStay(Collider other) {
|
||||
if (parentCBase != null && other.CompareTag(targetTag) && parentCBase.enabled && parentCBase.GetCanTakeDamage(false)) {
|
||||
DodgeBody(other.ClosestPoint(transform.position));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
12
Script/CounterDetection_Attack.cs
Normal file
12
Script/CounterDetection_Attack.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CounterDetection_Attack : CounterDetection {
|
||||
|
||||
protected override void Action(bool isProjectile) {
|
||||
base.Action(isProjectile);
|
||||
parentCBase.CounterAttack(otherObj, isProjectile);
|
||||
}
|
||||
|
||||
}
|
17
Script/CounterDetection_Dodge.cs
Normal file
17
Script/CounterDetection_Dodge.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CounterDetection_Dodge : CounterDetection {
|
||||
|
||||
public int dodgeDir = 0;
|
||||
public bool changeState = true;
|
||||
|
||||
protected override void Action(bool isProjectile) {
|
||||
base.Action(isProjectile);
|
||||
if (parentCBase && parentCBase.enabled && parentCBase.GetCanTakeDamage() && parentCBase.DodgeChallenge()) {
|
||||
parentCBase.CounterDodge(dodgeDir, changeState);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
119
Script/CrystalPower.cs
Normal file
119
Script/CrystalPower.cs
Normal file
|
@ -0,0 +1,119 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CrystalPower : MonoBehaviour {
|
||||
|
||||
public enum CrystalType {
|
||||
Red, Blue, Violet, GreenS, GreenM, GreenL, Crimson, White
|
||||
}
|
||||
|
||||
public CrystalType crystalType;
|
||||
public float scaleTime = 1f;
|
||||
public float maxRadius = 40f;
|
||||
public bool destroyOnComplete = true;
|
||||
|
||||
EnemyBase[] eBase;
|
||||
Transform[] eTrans;
|
||||
BombReceiverForEnemy[] bombReceiver;
|
||||
bool[] treated;
|
||||
float elapsedTime;
|
||||
float scaleSpeed;
|
||||
Transform trans;
|
||||
bool bombReceiverExist;
|
||||
int t_Count;
|
||||
|
||||
private void Start() {
|
||||
trans = transform;
|
||||
if (scaleTime > 0f) {
|
||||
scaleSpeed = maxRadius / scaleTime;
|
||||
}
|
||||
GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy");
|
||||
eBase = new EnemyBase[enemies.Length];
|
||||
eTrans = new Transform[enemies.Length];
|
||||
treated = new bool[enemies.Length];
|
||||
for (int i = 0; i < enemies.Length; i++) {
|
||||
eBase[i] = enemies[i].GetComponent<EnemyBase>();
|
||||
eTrans[i] = enemies[i].transform;
|
||||
}
|
||||
if (crystalType == CrystalType.GreenS || crystalType == CrystalType.GreenM || crystalType == CrystalType.GreenL) {
|
||||
GameObject[] bombReceiverObj = GameObject.FindGameObjectsWithTag("BombReceiver");
|
||||
if (bombReceiverObj.Length > 0) {
|
||||
bombReceiverExist = true;
|
||||
bombReceiver = new BombReceiverForEnemy[bombReceiverObj.Length];
|
||||
for (int i = 0; i < bombReceiver.Length; i++) {
|
||||
bombReceiver[i] = bombReceiverObj[i].GetComponent<BombReceiverForEnemy>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
elapsedTime += Time.deltaTime;
|
||||
float condDist = Mathf.Min(elapsedTime * scaleSpeed, maxRadius);
|
||||
float condSqrDist = condDist * condDist;
|
||||
for (int i = 0; i < eBase.Length; i++) {
|
||||
if (eBase[i] && eBase[i].enabled && !treated[i] && (eTrans[i].position - trans.position).sqrMagnitude <= condSqrDist) {
|
||||
treated[i] = true;
|
||||
switch (crystalType) {
|
||||
case CrystalType.Red:
|
||||
if (!eBase[i].isBoss) {
|
||||
eBase[i].LevelUp();
|
||||
eBase[i].SupermanEnd();
|
||||
t_Count++;
|
||||
if (t_Count == 3) {
|
||||
TrophyManager.Instance.CheckTrophy(TrophyManager.t_RedCrystal, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CrystalType.Blue:
|
||||
if (!eBase[i].isBoss) {
|
||||
eBase[i].LevelDown();
|
||||
eBase[i].SupermanEnd();
|
||||
}
|
||||
break;
|
||||
case CrystalType.Violet:
|
||||
eBase[i].SetSick(CharacterBase.SickType.Slow, 40);
|
||||
break;
|
||||
case CrystalType.GreenS:
|
||||
eBase[i].TakeDamageFixKnock(Mathf.RoundToInt(1000 + GameManager.Instance.GetLevelStatusNow() * 120f), eBase[i].GetCenterPosition(), 1500, (eTrans[i].position - trans.position).normalized, eBase[i].GetTargetExist() ? CharacterManager.Instance.pCon : null, 3, true);
|
||||
eBase[i].ResetSickToleranceAll();
|
||||
break;
|
||||
case CrystalType.GreenM:
|
||||
eBase[i].TakeDamageFixKnock(Mathf.RoundToInt(1000 + GameManager.Instance.GetLevelStatusNow() * 120f) * 2, eBase[i].GetCenterPosition(), 3000, (eTrans[i].position - trans.position).normalized, eBase[i].GetTargetExist() ? CharacterManager.Instance.pCon : null, 3, true);
|
||||
eBase[i].ResetSickToleranceAll();
|
||||
break;
|
||||
case CrystalType.GreenL:
|
||||
eBase[i].TakeDamageFixKnock(Mathf.RoundToInt(1000 + GameManager.Instance.GetLevelStatusNow() * 120f) * 4, eBase[i].GetCenterPosition(), 50000, (eTrans[i].position - trans.position).normalized, eBase[i].GetTargetExist() ? CharacterManager.Instance.pCon : null, 3, true);
|
||||
eBase[i].ResetSickToleranceAll();
|
||||
break;
|
||||
case CrystalType.Crimson:
|
||||
if (!eBase[i].isBoss && !eBase[i].isSuperman) {
|
||||
eBase[i].ReserveSuperman();
|
||||
t_Count++;
|
||||
if (t_Count == 3) {
|
||||
TrophyManager.Instance.CheckTrophy(TrophyManager.t_CrimsonCrystal, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CrystalType.White:
|
||||
if (!eBase[i].isBoss) {
|
||||
eBase[i].SupermanEnd();
|
||||
eBase[i].SetLevel(0, true, false, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bombReceiverExist) {
|
||||
for (int i = 0; i < bombReceiver.Length; i++) {
|
||||
if (bombReceiver[i] && (bombReceiver[i].transform.position - trans.position).sqrMagnitude <= condSqrDist) {
|
||||
bombReceiver[i].DestroyWithEffect();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (destroyOnComplete && elapsedTime >= scaleTime + 0.05f) {
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
54
Script/DGRandomizer.cs
Normal file
54
Script/DGRandomizer.cs
Normal file
|
@ -0,0 +1,54 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DGRandomizer : MonoBehaviour {
|
||||
|
||||
public int mapWidthRandom = 6;
|
||||
public int roomMinWidthRandom = 2;
|
||||
public int roomMinHeightRandom = 2;
|
||||
public int maxRoomsRandom = 2;
|
||||
public int bigRoomRateRandom = 20;
|
||||
public int passageSurplusRateRandom = 20;
|
||||
|
||||
private void Awake() {
|
||||
DungeonGenerator_Standard dg = GetComponent<DungeonGenerator_Standard>();
|
||||
if (dg != null) {
|
||||
int widthTemp = Random.Range(-mapWidthRandom, mapWidthRandom + 1);
|
||||
dg.width += widthTemp;
|
||||
dg.height -= widthTemp;
|
||||
dg.roomSettings.minWidth += Random.Range(-roomMinWidthRandom, roomMinWidthRandom + 1);
|
||||
if (dg.roomSettings.minWidth < 2) {
|
||||
dg.roomSettings.minWidth = 2;
|
||||
} else if (dg.roomSettings.minWidth > 10) {
|
||||
dg.roomSettings.minWidth = 10;
|
||||
}
|
||||
dg.roomSettings.minHeight += Random.Range(-roomMinHeightRandom, roomMinHeightRandom + 1);
|
||||
if (dg.roomSettings.minHeight < 2) {
|
||||
dg.roomSettings.minHeight = 2;
|
||||
} else if (dg.roomSettings.minHeight > 10) {
|
||||
dg.roomSettings.minHeight = 10;
|
||||
}
|
||||
dg.roomSettings.maxRooms += Random.Range(-maxRoomsRandom, maxRoomsRandom + 1);
|
||||
if (dg.roomSettings.maxRooms < dg.roomSettings.minRooms) {
|
||||
dg.roomSettings.maxRooms = dg.roomSettings.minRooms;
|
||||
} else if (dg.roomSettings.maxRooms < 1) {
|
||||
dg.roomSettings.maxRooms = 1;
|
||||
} else if (dg.roomSettings.maxRooms > 20) {
|
||||
dg.roomSettings.maxRooms = 20;
|
||||
}
|
||||
dg.roomSettings.bigRoomRate += Random.Range(-bigRoomRateRandom, bigRoomRateRandom + 1);
|
||||
if (dg.roomSettings.bigRoomRate < 0) {
|
||||
dg.roomSettings.bigRoomRate = 0;
|
||||
} else if (dg.roomSettings.bigRoomRate > 100) {
|
||||
dg.roomSettings.bigRoomRate = 100;
|
||||
}
|
||||
dg.roomSettings.passageSurplusRate += Random.Range(-passageSurplusRateRandom, passageSurplusRateRandom + 1);
|
||||
if (dg.roomSettings.passageSurplusRate < 0) {
|
||||
dg.roomSettings.passageSurplusRate = 0;
|
||||
} else if (dg.roomSettings.passageSurplusRate > 100) {
|
||||
dg.roomSettings.passageSurplusRate = 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
245
Script/DamageDetection.cs
Normal file
245
Script/DamageDetection.cs
Normal file
|
@ -0,0 +1,245 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DamageDetection : MonoBehaviour {
|
||||
|
||||
public GameObject[] hitEffect;
|
||||
public ParticleSystemPool.ParticleName[] poolParticleNames;
|
||||
public AudioSourcePool.AudioName[] poolAudioNames;
|
||||
public int hitEffectNum = 0;
|
||||
public float damageRate = 1.0f;
|
||||
public float defenceRate = 1.0f;
|
||||
public float knockedRate = 1.0f;
|
||||
public int characterId = -1;
|
||||
public int colorType = 0;
|
||||
public bool checkDodge = false;
|
||||
public Collider specialCollider;
|
||||
|
||||
[System.NonSerialized]
|
||||
public bool isNotCharacter;
|
||||
|
||||
protected CharacterBase parentCBase;
|
||||
protected double timeStamp;
|
||||
protected int sounded;
|
||||
protected Vector3 savePosition;
|
||||
protected Transform trans;
|
||||
protected static readonly Vector3 vecForward = Vector3.forward;
|
||||
protected static readonly Quaternion quaIden = Quaternion.identity;
|
||||
|
||||
protected virtual void Awake() {
|
||||
trans = transform;
|
||||
if (parentCBase == null) {
|
||||
parentCBase = GetComponentInParent<CharacterBase>();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Start() {
|
||||
if (parentCBase) {
|
||||
characterId = parentCBase.characterId;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetParentCharacterBase(CharacterBase cBase) {
|
||||
parentCBase = cBase;
|
||||
}
|
||||
|
||||
void DodgeBody(Vector3 closestPoint) {
|
||||
int dodgeDir = Random.Range(-1, 2);
|
||||
if (trans.position != closestPoint) {
|
||||
closestPoint.y = trans.position.y;
|
||||
float axis = Vector3.Cross(trans.TransformDirection(vecForward), closestPoint - trans.position).y;
|
||||
if (axis > 0.001f) {
|
||||
dodgeDir = -1;
|
||||
} else if (axis < -0.001f) {
|
||||
dodgeDir = 1;
|
||||
}
|
||||
}
|
||||
parentCBase.CounterDodge(dodgeDir);
|
||||
}
|
||||
|
||||
public virtual bool ReceiveDamage(ref Vector3 effectPosition, int damage, float knockAmount, ref Vector3 knockVector, AttackDetection attackDetection = null, bool penetrate = false, int overrideColorType = -1) {
|
||||
if (parentCBase && parentCBase.enabled && parentCBase.GetCanTakeDamage(penetrate)) {
|
||||
if (checkDodge && !penetrate && parentCBase.DodgeChallenge()) {
|
||||
DodgeBody(effectPosition);
|
||||
} else {
|
||||
int colorTemp = overrideColorType >= 0 ? overrideColorType : colorType;
|
||||
if (colorType == CharacterBase.damageColor_Hard && overrideColorType == CharacterBase.damageColor_Back) {
|
||||
colorTemp = CharacterBase.damageColor_HardBack;
|
||||
}
|
||||
if (hitEffectNum < poolParticleNames.Length && hitEffectNum < poolAudioNames.Length && ParticleSystemPool.Instance && AudioSourcePool.Instance) {
|
||||
float timeDifference = 0f;
|
||||
if (timeStamp != GameManager.Instance.time) {
|
||||
sounded = 0;
|
||||
timeDifference = (float)(GameManager.Instance.time - timeStamp);
|
||||
if (timeDifference > 2) {
|
||||
timeDifference = 2;
|
||||
}
|
||||
timeStamp = GameManager.Instance.time;
|
||||
}
|
||||
if (sounded > 0) {
|
||||
if (sounded == 1 || (savePosition - effectPosition).sqrMagnitude > 0.0625f) {
|
||||
ParticleSystemPool.Instance.Play(poolParticleNames[hitEffectNum], effectPosition, timeDifference);
|
||||
sounded = 2;
|
||||
}
|
||||
} else {
|
||||
ParticleSystemPool.Instance.Play(poolParticleNames[hitEffectNum], effectPosition, timeDifference);
|
||||
float volumeRate = CharacterManager.Instance.GetDamageSoundVolume(colorTemp);
|
||||
if (overrideColorType >= 0) {
|
||||
volumeRate *= 0.5f;
|
||||
}
|
||||
if (GameManager.Instance.save.config[GameManager.Save.configID_ObscureFriends] != 0 && ((parentCBase && !parentCBase.isEnemy && !parentCBase.isPlayer) || (attackDetection && attackDetection.parentCBase && !attackDetection.parentCBase.isEnemy && !attackDetection.parentCBase.isPlayer))) {
|
||||
volumeRate *= CharacterManager.Instance.GetObscureRateAudio();
|
||||
}
|
||||
if (volumeRate > 0f) {
|
||||
AudioSourcePool.Instance.Play(poolAudioNames[hitEffectNum], effectPosition, volumeRate);
|
||||
}
|
||||
savePosition = effectPosition;
|
||||
sounded = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (hitEffectNum < hitEffect.Length && hitEffect[hitEffectNum]) {
|
||||
// Instantiate(hitEffect[hitEffectNum], effectPosition, quaIden);
|
||||
}
|
||||
|
||||
/*
|
||||
if (hitEffectNum < hitEffect.Length && hitEffect[hitEffectNum]) {
|
||||
timeDifference = 0;
|
||||
effectInstance = null;
|
||||
if (timeStamp != GameManager.Instance.time) {
|
||||
sounded = 0;
|
||||
timeDifference = GameManager.Instance.time - timeStamp;
|
||||
if (timeDifference > 2) {
|
||||
timeDifference = 2;
|
||||
}
|
||||
timeStamp = GameManager.Instance.time;
|
||||
}
|
||||
if (sounded > 0) {
|
||||
if (sounded == 1 || (savePosition - effectPosition).sqrMagnitude > 0.0625f) {
|
||||
effectInstance = Instantiate(hitEffect[hitEffectNum], effectPosition, quaIden);
|
||||
AudioSource aSrc = effectInstance.GetComponent<AudioSource>();
|
||||
if (aSrc) {
|
||||
aSrc.enabled = false;
|
||||
}
|
||||
sounded = 2;
|
||||
}
|
||||
} else {
|
||||
effectInstance = Instantiate(hitEffect[hitEffectNum], effectPosition, quaIden);
|
||||
float volumeRate = CharacterManager.Instance.GetDamageSoundVolume(colorTemp);
|
||||
if (overrideColorType >= 0) {
|
||||
volumeRate *= 0.5f;
|
||||
}
|
||||
if (volumeRate > 0f && poolAudioNames.Length > hitEffectNum && AudioSourcePool.Instance) {
|
||||
AudioSourcePool.Instance.Play(poolAudioNames[hitEffectNum], effectPosition, volumeRate);
|
||||
}
|
||||
if (volumeRate >= 1f) {
|
||||
effectInstance = Instantiate(hitEffect[hitEffectNum], effectPosition, quaIden);
|
||||
} else {
|
||||
effectInstance = Instantiate(hitEffect[hitEffectNum], effectPosition, quaIden);
|
||||
AudioSource aSrc = effectInstance.GetComponent<AudioSource>();
|
||||
if (aSrc) {
|
||||
if (volumeRate <= 0f) {
|
||||
aSrc.enabled = false;
|
||||
} else {
|
||||
aSrc.volume *= volumeRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
savePosition = effectPosition;
|
||||
sounded = 1;
|
||||
}
|
||||
if (effectInstance) {
|
||||
HoldParticle holdParticle = effectInstance.GetComponent<HoldParticle>();
|
||||
if (holdParticle) {
|
||||
for (int i = 0; i < holdParticle.pSets.Length; i++) {
|
||||
if (holdParticle.pSets[i].particle) {
|
||||
var emissionModule = holdParticle.pSets[i].particle.emission;
|
||||
var particleBurst = emissionModule.GetBurst(0);
|
||||
particleBurst.count = Mathf.Clamp((int)(timeDifference * holdParticle.pSets[i].multiplier) + 1, holdParticle.pSets[i].minCount, holdParticle.pSets[i].maxCount);
|
||||
emissionModule.SetBurst(0, particleBurst);
|
||||
}
|
||||
}
|
||||
if (holdParticle.playManual && holdParticle.parentParticle) {
|
||||
holdParticle.parentParticle.Play(true);
|
||||
}
|
||||
}
|
||||
if (GameManager.Instance.save.config[GameManager.Save.configID_ObscureFriends] != 0 && ((parentCBase && !parentCBase.isEnemy && !parentCBase.isPlayer) || (attackDetection && attackDetection.parentCBase && !attackDetection.parentCBase.isEnemy && !attackDetection.parentCBase.isPlayer))) {
|
||||
AudioSource aSrc = effectInstance.GetComponent<AudioSource>();
|
||||
if (aSrc) {
|
||||
aSrc.volume *= CharacterManager.Instance.GetObscureRateAudio();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (attackDetection != null) {
|
||||
parentCBase.TakeDamage(damage, effectPosition, knockAmount * knockedRate, knockVector, attackDetection.parentCBase, colorTemp, penetrate);
|
||||
parentCBase.RegisterTargetHate(attackDetection.parentCBase, knockAmount * knockedRate);
|
||||
if (parentCBase.isEnemy){
|
||||
if (attackDetection.parentCBase == CharacterManager.Instance.pCon) {
|
||||
if (overrideColorType < 0) {
|
||||
CharacterManager.Instance.JustDodgeAmountPlus(knockAmount * Mathf.Clamp(knockedRate, 0.5f, 2f));
|
||||
}
|
||||
}
|
||||
if (attackDetection.reportType != AttackDetection.ReportType.None) {
|
||||
//CheckTrophyPart
|
||||
switch (attackDetection.reportType) {
|
||||
case AttackDetection.ReportType.Judgement:
|
||||
if (parentCBase.GetNowHP() <= 0 && CharacterManager.Instance.pCon) {
|
||||
CharacterManager.Instance.pCon.CheckTrophy_Judgement();
|
||||
}
|
||||
break;
|
||||
case AttackDetection.ReportType.Hippo:
|
||||
if (colorType == CharacterBase.damageColor_Effective && (parentCBase.GetEnemyID() == 40 || parentCBase.GetEnemyID() == 55)) {
|
||||
TrophyManager.Instance.CheckTrophy(TrophyManager.t_AlligatorClipsHippo, true);
|
||||
}
|
||||
break;
|
||||
case AttackDetection.ReportType.PrairieDog:
|
||||
if (colorType == CharacterBase.damageColor_Effective && parentCBase.GetEnemyID() == 44) {
|
||||
TrophyManager.Instance.CheckTrophy(TrophyManager.t_PrairieDog, true);
|
||||
Enemy_Akula akulaTemp = parentCBase.GetComponent<Enemy_Akula>();
|
||||
if (akulaTemp) {
|
||||
akulaTemp.SetFollowerResetTimer();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
parentCBase.TakeDamage(damage, effectPosition, knockAmount * knockedRate, knockVector, null, colorTemp, penetrate);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void ReceiveSick(CharacterBase.SickType sickType, float sickTime = -1, AttackDetection attackDetection = null) {
|
||||
if (parentCBase && parentCBase.enabled) {
|
||||
parentCBase.SetSick(sickType, sickTime, attackDetection);
|
||||
}
|
||||
}
|
||||
|
||||
public void NonDamageDodge(Vector3 pivotPosition) {
|
||||
if (parentCBase && parentCBase.enabled && parentCBase.GetCanTakeDamage(false) && checkDodge && parentCBase.DodgeChallenge()) {
|
||||
DodgeBody(pivotPosition);
|
||||
}
|
||||
}
|
||||
|
||||
public float GetDefence() {
|
||||
return parentCBase ? parentCBase.GetDefense() * defenceRate : 0f;
|
||||
}
|
||||
|
||||
public bool GetCanTakeDamage(bool penetrate = false) {
|
||||
return parentCBase && parentCBase.enabled && parentCBase.GetCanTakeDamage(penetrate);
|
||||
}
|
||||
|
||||
public CharacterBase GetCharacterBase() {
|
||||
return parentCBase;
|
||||
}
|
||||
|
||||
}
|
124
Script/DamageDetectionContainer.cs
Normal file
124
Script/DamageDetectionContainer.cs
Normal file
|
@ -0,0 +1,124 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DamageDetectionContainer : DamageDetectionNotCharacter {
|
||||
|
||||
public int rank = 0;
|
||||
public GameObject balloonPrefab;
|
||||
public int enemyMin = 1;
|
||||
public int enemyMax = 3;
|
||||
|
||||
enum Type { Item, Gold, Enemy };
|
||||
Type itemType;
|
||||
int[] itemArray;
|
||||
int goldNum;
|
||||
int enemyNum;
|
||||
GameObject balloonInstance;
|
||||
ContainerBalloonController balloonCon;
|
||||
|
||||
const int rankMax = 5;
|
||||
const float condDist = 20f;
|
||||
const float balloonHeight = 1.5f;
|
||||
const int healStarID = 352;
|
||||
const int sandstarBlockID = 354;
|
||||
static readonly int[] moneyBase = new int[] { 30, 55, 100, 180, 300 };
|
||||
|
||||
protected override void Awake() {
|
||||
base.Awake();
|
||||
trans = transform;
|
||||
}
|
||||
|
||||
protected override void Start() {
|
||||
base.Start();
|
||||
SetMapChip();
|
||||
int randMin = 0;
|
||||
if (StageManager.Instance && StageManager.Instance.dungeonController && StageManager.Instance.dungeonController.chestSettings.notCallEnemy) {
|
||||
randMin = 8;
|
||||
}
|
||||
int rate = Random.Range(randMin, 100);
|
||||
if (rate < 8) {
|
||||
itemType = Type.Enemy;
|
||||
enemyNum = Random.Range(enemyMin, enemyMax + 1);
|
||||
} else if (rate < 38) {
|
||||
if ((StageManager.Instance && StageManager.Instance.IsRandomStage) || (GameManager.Instance && GameManager.Instance.IsPlayerAnother)) {
|
||||
itemType = Type.Item;
|
||||
itemArray = new int[2] { Random.Range(0, 2) == 0 ? healStarID : sandstarBlockID, -1 };
|
||||
} else {
|
||||
itemType = Type.Gold;
|
||||
goldNum = (int)(moneyBase[rank] * Random.Range(0.75f, 1.25f));
|
||||
}
|
||||
} else {
|
||||
itemType = Type.Item;
|
||||
itemArray = ContainerDatabase.Instance.GetIDArray(rank);
|
||||
int replaceLevel = (StageManager.Instance && StageManager.Instance.dungeonController ? StageManager.Instance.dungeonController.itemReplaceLevel : 0);
|
||||
if (replaceLevel > 0) {
|
||||
for (int i = 0; i < itemArray.Length; i++) {
|
||||
for (int j = 0; j < ItemDatabase.replaceBeforeID.Length; j++) {
|
||||
if (itemArray[i] == ItemDatabase.replaceBeforeID[j]) {
|
||||
itemArray[i] = ItemDatabase.replaceAfterID[Mathf.Clamp(replaceLevel - 1, 0, ItemDatabase.replaceRows - 1), Random.Range(0, ItemDatabase.replaceColumns)];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CharacterManager.Instance) {
|
||||
for (int i = 0; i < itemArray.Length; i++) {
|
||||
CharacterManager.Instance.CheckJaparimanShortage(itemArray[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
StartCoroutine(UpdateBalloon());
|
||||
}
|
||||
|
||||
protected virtual bool CheckBalloonCondition() {
|
||||
return (CharacterManager.Instance && CharacterManager.Instance.GetFriendsEffect(CharacterManager.FriendsEffect.KeenNose) != 0 && CharacterManager.Instance.playerTrans && (CharacterManager.Instance.playerTrans.position - trans.position).sqrMagnitude <= condDist * condDist);
|
||||
}
|
||||
|
||||
IEnumerator UpdateBalloon() {
|
||||
var wait = new WaitForSeconds(0.25f);
|
||||
for (; ; ) {
|
||||
if (CheckBalloonCondition()) {
|
||||
if (balloonInstance && balloonCon) {
|
||||
balloonCon.Activate(true);
|
||||
} else {
|
||||
balloonInstance = Instantiate(balloonPrefab, trans.position + new Vector3(0f, balloonHeight, 0f), trans.rotation, trans);
|
||||
balloonCon = balloonInstance.GetComponent<ContainerBalloonController>();
|
||||
if (balloonCon) {
|
||||
int itemID = (itemType == Type.Enemy ? -2 : itemType == Type.Gold ? -1 : itemArray.Length > 0 ? itemArray[0] : -3);
|
||||
if (itemID >= -2) {
|
||||
balloonCon.SetBalloon(itemID);
|
||||
}
|
||||
balloonCon.Activate(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (balloonInstance && balloonCon) {
|
||||
balloonCon.Activate(false);
|
||||
}
|
||||
}
|
||||
yield return wait;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void SetMapChip() {
|
||||
Instantiate(MapDatabase.Instance.prefab[MapDatabase.item], transform);
|
||||
}
|
||||
|
||||
public override void WorkDamage(int damage, float knockAmount, Vector3 knockVector) {
|
||||
if (itemType == Type.Enemy) {
|
||||
if (StageManager.Instance && StageManager.Instance.dungeonController) {
|
||||
StageManager.Instance.dungeonController.SpawnEnemyPos(transform.position, 0.5f, enemyNum);
|
||||
if (TrophyManager.Instance && !TrophyManager.Instance.IsTrophyHad(TrophyManager.t_GrayWolf) && CheckBalloonCondition()) {
|
||||
TrophyManager.Instance.CheckTrophy(TrophyManager.t_GrayWolf, true);
|
||||
}
|
||||
}
|
||||
} else if (itemType == Type.Gold) {
|
||||
ItemDatabase.Instance.GiveGold(goldNum, transform);
|
||||
} else {
|
||||
ItemDatabase.Instance.GiveItem(itemArray, transform);
|
||||
}
|
||||
Destroy(transform.parent.gameObject);
|
||||
}
|
||||
|
||||
}
|
25
Script/DamageDetectionElemental.cs
Normal file
25
Script/DamageDetectionElemental.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DamageDetectionElemental : DamageDetection
|
||||
{
|
||||
|
||||
public AttackDetection.ElementalAttribute toleranceAttribute;
|
||||
public int normalHitIndex = 0;
|
||||
public int toleranceHitIndex = 1;
|
||||
public float toleranceRate = 0.5f;
|
||||
|
||||
public override bool ReceiveDamage(ref Vector3 effectPosition, int damage, float knockAmount, ref Vector3 knockVector, AttackDetection attackDetection = null, bool penetrate = false, int overrideColorType = -1) {
|
||||
if (attackDetection && attackDetection.elementalAttribute == toleranceAttribute) {
|
||||
damage = Mathf.Max(1, (int)(damage * toleranceRate));
|
||||
knockAmount = knockAmount * toleranceRate;
|
||||
hitEffectNum = toleranceHitIndex;
|
||||
} else {
|
||||
hitEffectNum = normalHitIndex;
|
||||
}
|
||||
return base.ReceiveDamage(ref effectPosition, damage, knockAmount, ref knockVector, attackDetection, penetrate, overrideColorType);
|
||||
}
|
||||
|
||||
|
||||
}
|
30
Script/DamageDetectionKnockAssort.cs
Normal file
30
Script/DamageDetectionKnockAssort.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DamageDetectionKnockAssort : DamageDetection {
|
||||
|
||||
public bool projectileTolerance;
|
||||
protected float referenceValue;
|
||||
|
||||
protected override void Start() {
|
||||
base.Start();
|
||||
if (parentCBase != null) {
|
||||
referenceValue = parentCBase.knockEndurance;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ReceiveDamage(ref Vector3 effectPosition, int damage, float knockAmount, ref Vector3 knockVector, AttackDetection attackDetection = null, bool penetrate = false, int overrideColorType = -1) {
|
||||
if (projectileTolerance && damage >= 1 && attackDetection && attackDetection.isProjectile) {
|
||||
damage = Mathf.Max(damage / 2, 1);
|
||||
}
|
||||
if (knockAmount < referenceValue * 0.5f) {
|
||||
hitEffectNum = 0;
|
||||
} else if (knockAmount < referenceValue) {
|
||||
hitEffectNum = 1;
|
||||
} else {
|
||||
hitEffectNum = 2;
|
||||
}
|
||||
return base.ReceiveDamage(ref effectPosition, damage, knockAmount, ref knockVector, attackDetection, penetrate, overrideColorType);
|
||||
}
|
||||
}
|
36
Script/DamageDetectionNotCharacter.cs
Normal file
36
Script/DamageDetectionNotCharacter.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DamageDetectionNotCharacter : DamageDetection {
|
||||
|
||||
protected override void Awake() {
|
||||
isNotCharacter = true;
|
||||
}
|
||||
|
||||
protected override void Start() {
|
||||
if (CharacterManager.Instance) {
|
||||
characterId = CharacterManager.Instance.IssueID();
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ReceiveDamage(ref Vector3 effectPosition, int damage, float knockAmount, ref Vector3 knockVector, AttackDetection attackDetection = null, bool penetrate = false, int overrideColorType = -1) {
|
||||
if (attackDetection != null && attackDetection.parentCBase == CharacterManager.Instance.pCon && overrideColorType < 0) {
|
||||
/*
|
||||
if (hitEffect != null) {
|
||||
Instantiate(hitEffect[hitEffectNum], effectPosition, Quaternion.identity);
|
||||
}
|
||||
*/
|
||||
if (hitEffectNum < poolParticleNames.Length && hitEffectNum < poolAudioNames.Length && ParticleSystemPool.Instance && AudioSourcePool.Instance) {
|
||||
ParticleSystemPool.Instance.Play(poolParticleNames[hitEffectNum], effectPosition);
|
||||
AudioSourcePool.Instance.Play(poolAudioNames[hitEffectNum], effectPosition);
|
||||
}
|
||||
WorkDamage(damage, knockAmount * knockedRate, knockVector);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void WorkDamage(int damage, float knockAmount, Vector3 knockVector) {
|
||||
}
|
||||
|
||||
}
|
23
Script/DamageDetection_BigDog.cs
Normal file
23
Script/DamageDetection_BigDog.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DamageDetection_BigDog : DamageDetection
|
||||
{
|
||||
|
||||
public int footNumber;
|
||||
Enemy_BigDog parentBigDog;
|
||||
|
||||
protected override void Awake() {
|
||||
base.Awake();
|
||||
parentBigDog = GetComponentInParent<Enemy_BigDog>();
|
||||
}
|
||||
|
||||
public override bool ReceiveDamage(ref Vector3 effectPosition, int damage, float knockAmount, ref Vector3 knockVector, AttackDetection attackDetection = null, bool penetrate = false, int overrideColorType = -1) {
|
||||
if (parentCBase && parentCBase.enabled && parentCBase.GetCanTakeDamage(penetrate)) {
|
||||
parentBigDog.ReceiveScarDamage(footNumber, damage);
|
||||
}
|
||||
return base.ReceiveDamage(ref effectPosition, damage, knockAmount, ref knockVector, attackDetection, penetrate, overrideColorType);
|
||||
}
|
||||
|
||||
}
|
35
Script/DamageDetection_ClioneGuard.cs
Normal file
35
Script/DamageDetection_ClioneGuard.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DamageDetection_ClioneGuard : DamageDetection
|
||||
{
|
||||
|
||||
public AttackDetection.ElementalAttribute weakAttribute;
|
||||
public int normalHitIndex = 0;
|
||||
public int weakHitIndex = 1;
|
||||
Enemy_Clione parentClione;
|
||||
|
||||
protected override void Awake() {
|
||||
base.Awake();
|
||||
parentClione = GetComponentInParent<Enemy_Clione>();
|
||||
}
|
||||
|
||||
public override bool ReceiveDamage(ref Vector3 effectPosition, int damage, float knockAmount, ref Vector3 knockVector, AttackDetection attackDetection = null, bool penetrate = false, int overrideColorType = -1) {
|
||||
if (parentCBase && parentCBase.enabled && parentCBase.GetCanTakeDamage(penetrate)) {
|
||||
float knockTemp = knockAmount;
|
||||
if (attackDetection && attackDetection.elementalAttribute == weakAttribute) {
|
||||
hitEffectNum = weakHitIndex;
|
||||
overrideColorType = 3;
|
||||
knockTemp *= 4;
|
||||
} else {
|
||||
hitEffectNum = normalHitIndex;
|
||||
}
|
||||
parentClione.ReceiveGuardKnock(knockTemp);
|
||||
} else {
|
||||
hitEffectNum = normalHitIndex;
|
||||
}
|
||||
return base.ReceiveDamage(ref effectPosition, damage, knockAmount, ref knockVector, attackDetection, penetrate, overrideColorType);
|
||||
}
|
||||
|
||||
}
|
18
Script/DamageDetection_DSCore.cs
Normal file
18
Script/DamageDetection_DSCore.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DamageDetection_DSCore : DamageDetection {
|
||||
|
||||
public override bool ReceiveDamage(ref Vector3 effectPosition, int damage, float knockAmount, ref Vector3 knockVector, AttackDetection attackDetection = null, bool penetrate = false, int overrideColorType = -1) {
|
||||
if (attackDetection != null && attackDetection.parentCBase != null && attackDetection.parentCBase.isPlayer) {
|
||||
if (!attackDetection.isProjectile && attackDetection.parentCBase.isSuperman) {
|
||||
knockAmount *= 8f;
|
||||
} else {
|
||||
knockAmount *= 2f;
|
||||
}
|
||||
}
|
||||
return base.ReceiveDamage(ref effectPosition, damage, knockAmount, ref knockVector, attackDetection, penetrate, overrideColorType);
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue