1
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c87a7e5bbfecd540b37e564229219cb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0bce880d4f34ad44cad0c7b839c00b40
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c3f2f49079af354a9e6a8720d14f5c8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,26 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 938875dffea6bb64195bcefab599ba64, type: 3}
|
||||
m_Name: BA_Comba_01
|
||||
m_EditorClassIdentifier:
|
||||
abilityName: head-smash
|
||||
abilityID: 0
|
||||
abilityCDTime: 7
|
||||
abilityClass: 0
|
||||
abilityVFX: {fileID: 8300000, guid: 745ff6d9880e7e54ca173e5230018748, type: 3}
|
||||
abilityIsDone: 0
|
||||
abilityDistance: 0
|
||||
maxAbilityCount: 0
|
||||
abilityOffest:
|
||||
- {x: -1.5, y: 0.5}
|
||||
- {x: 1.5, y: 0.5}
|
||||
- {x: 0, y: 0.5}
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98a239d9069b5b64faf5841e97cce79a
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,12 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "BA_Comba_01", menuName = "Ability/BossA/Comba_01")]
|
||||
public class BA_Comba_01 : CombatAblilityBase
|
||||
{
|
||||
public override void UpdateAblity(Transform target = null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 938875dffea6bb64195bcefab599ba64
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,25 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 39a345fbb2ba60549bc7be5a613d7fe3, type: 3}
|
||||
m_Name: BA_Comba_02
|
||||
m_EditorClassIdentifier:
|
||||
abilityName: trunk-strike
|
||||
abilityID: 1
|
||||
abilityCDTime: 5
|
||||
abilityClass: 1
|
||||
abilityVFX: {fileID: 0}
|
||||
abilityIsDone: 0
|
||||
abilityDistance: 0
|
||||
maxAbilityCount: 10
|
||||
abilityOffest: []
|
||||
g: {fileID: 5407042768625737065, guid: 883a2a6d0f356484093e8aaf8fc28de9, type: 3}
|
||||
p: {fileID: 0}
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e98ec405a8f8bd47a5c3aefeb8add8f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "BA_Comba_02", menuName = "Ability/BossA/Comba_02")]
|
||||
public class BA_Comba_02 : CombatAblilityBase
|
||||
{
|
||||
|
||||
public GameObject g;
|
||||
public GameObject p;
|
||||
public override void UpdateAblity(Transform target = null)
|
||||
{
|
||||
if (!this.ai.isYuancheng)
|
||||
return;
|
||||
if (currentAbilityCount>=0)
|
||||
{
|
||||
currentAbilityCount--;
|
||||
p = GameObject.Find("BulletFire");
|
||||
GameObject go = Instantiate(g);
|
||||
go.transform.position = p.transform.localPosition;
|
||||
go.GetComponent<BulletObject>().Init(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39a345fbb2ba60549bc7be5a613d7fe3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,24 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 731be78ab51c1cf4d8d0b91962d058a0, type: 3}
|
||||
m_Name: BA_Comba_03
|
||||
m_EditorClassIdentifier:
|
||||
abilityName: Ba_Comba_03
|
||||
abilityID: 2
|
||||
abilityCDTime: 8
|
||||
abilityClass: 0
|
||||
abilityVFX: {fileID: 0}
|
||||
abilityIsDone: 0
|
||||
abilityDistance: 0
|
||||
maxAbilityCount: 0
|
||||
abilityOffest:
|
||||
- {x: 0, y: 0}
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6db587830d2a5ff4ea96be28bccf951d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,22 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "BA_Comba_03", menuName = "Ability/BossA/Comba_03")]
|
||||
public class BA_Comba_03 : CombatAblilityBase
|
||||
{
|
||||
float timer = 0;
|
||||
public override void UpdateAblity(Transform target = null)
|
||||
{
|
||||
if (_animator.CheckAnimationTag("Attack_out")||_animator.CheckAnimationTag("Die")||_animator.CheckAnimationTag("summon"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
timer += Time.deltaTime;
|
||||
if(timer>=2f)
|
||||
{
|
||||
this.ai.transform.root.transform.position = target.position;
|
||||
timer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 731be78ab51c1cf4d8d0b91962d058a0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,24 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0bea07483ceab4842b793a021aad4c51, type: 3}
|
||||
m_Name: Comba_01
|
||||
m_EditorClassIdentifier:
|
||||
abilityName: Comba_01
|
||||
abilityID: 0
|
||||
abilityCDTime: 10
|
||||
abilityClass: 0
|
||||
abilityVFX: {fileID: 8300000, guid: b908de737b26207469006f83fe09ee1e, type: 3}
|
||||
abilityIsDone: 0
|
||||
abilityDistance: 3
|
||||
maxAbilityCount: 0
|
||||
abilityOffest:
|
||||
- {x: -2.6, y: 1}
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59208d2b3fbaa8e4b9c91c99092f106e
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,13 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
[CreateAssetMenu(fileName = "Comba_01", menuName = "Ability/m_2/Comba_01")]
|
||||
public class Comba_01 : CombatAblilityBase
|
||||
{
|
||||
public override void UpdateAblity(Transform target = null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0bea07483ceab4842b793a021aad4c51
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,24 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6676841996372f24788e8af0050c9e53, type: 3}
|
||||
m_Name: Comba_02
|
||||
m_EditorClassIdentifier:
|
||||
abilityName: Comba_02
|
||||
abilityID: 1
|
||||
abilityCDTime: 12
|
||||
abilityClass: 0
|
||||
abilityVFX: {fileID: 8300000, guid: 745ff6d9880e7e54ca173e5230018748, type: 3}
|
||||
abilityIsDone: 0
|
||||
abilityDistance: 3
|
||||
maxAbilityCount: 0
|
||||
abilityOffest:
|
||||
- {x: -2.5, y: 1}
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 733b0aea8b566e24681247a79093393a
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,12 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "Comba_02", menuName = "Ability/m_2/Comba_02")]
|
||||
public class Comba_02 : CombatAblilityBase
|
||||
{
|
||||
public override void UpdateAblity(Transform target = null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6676841996372f24788e8af0050c9e53
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,24 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9e2bd46305452774887ab58c9ddeef07, type: 3}
|
||||
m_Name: Comba_03
|
||||
m_EditorClassIdentifier:
|
||||
abilityName: Comba_03
|
||||
abilityID: 2
|
||||
abilityCDTime: 6
|
||||
abilityClass: 0
|
||||
abilityVFX: {fileID: 8300000, guid: 745ff6d9880e7e54ca173e5230018748, type: 3}
|
||||
abilityIsDone: 0
|
||||
abilityDistance: 1
|
||||
maxAbilityCount: 0
|
||||
abilityOffest:
|
||||
- {x: -1, y: 0.6}
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eae12eefbdbcc8540bf10c9d846d1683
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,12 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "Comba_03", menuName = "Ability/m_2/Comba_03")]
|
||||
public class Comba_03 : CombatAblilityBase
|
||||
{
|
||||
public override void UpdateAblity(Transform target = null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e2bd46305452774887ab58c9ddeef07
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,24 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 81b457857b635f442bd5f6113faac597, type: 3}
|
||||
m_Name: Comba_04
|
||||
m_EditorClassIdentifier:
|
||||
abilityName: Comba_04
|
||||
abilityID: 3
|
||||
abilityCDTime: 6
|
||||
abilityClass: 0
|
||||
abilityVFX: {fileID: 0}
|
||||
abilityIsDone: 0
|
||||
abilityDistance: 1
|
||||
maxAbilityCount: 0
|
||||
abilityOffest:
|
||||
- {x: -1, y: 0.6}
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec38341ed27661a42992dce9719b0399
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,12 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "Comba_04", menuName = "Ability/m_2/Comba_04")]
|
||||
public class Comba_04 : CombatAblilityBase
|
||||
{
|
||||
public override void UpdateAblity(Transform target = null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81b457857b635f442bd5f6113faac597
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,86 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BulletObject : MonoBehaviour
|
||||
{
|
||||
private bool initialied = false;
|
||||
|
||||
[SerializeField] private Vector2 startPos;
|
||||
private Vector2 midPos;
|
||||
private float percent = 0;
|
||||
private float percentSpeed = 0;
|
||||
[SerializeField] private float speed = 25;
|
||||
|
||||
|
||||
private Vector2 lastTargetPos;
|
||||
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void FixedUpdate()
|
||||
{
|
||||
if (initialied )
|
||||
{
|
||||
percent += percentSpeed * Time.deltaTime;
|
||||
if (percent >= 1)
|
||||
{
|
||||
percent = 1;
|
||||
}
|
||||
transform.position = UnityExpandFunction.Bezier(percent, startPos, midPos, lastTargetPos);
|
||||
}
|
||||
if(transform.position==new Vector3(lastTargetPos.x, lastTargetPos.y,0))
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
public void Init(GameObject parent)
|
||||
{
|
||||
GameObject player = GameObject.FindGameObjectWithTag("Player");
|
||||
if(player!=null)
|
||||
{
|
||||
lastTargetPos = player.transform.position;
|
||||
|
||||
startPos = parent.transform.position+new Vector3(Random.Range(0,2), Random.Range(0, 2),0);
|
||||
|
||||
midPos = GetMiddlePostion(parent.transform.position, lastTargetPos);
|
||||
|
||||
percentSpeed = speed / (lastTargetPos - startPos).magnitude;
|
||||
|
||||
transform.position = startPos;
|
||||
|
||||
percent = 0;
|
||||
initialied = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ÖÐÐĵã
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <returns></returns>
|
||||
private Vector2 GetMiddlePostion(Vector2 a, Vector2 b)
|
||||
{
|
||||
Vector2 m = Vector2.Lerp(a,b,0.1f);
|
||||
Vector2 normal = Vector2.Perpendicular(a-b).normalized;
|
||||
|
||||
float rd = Random.Range(-2f,2f);
|
||||
float curveRatio = 15f;//Æ«ÒÆÖµ
|
||||
|
||||
return m + (a - b).normalized * curveRatio * rd * normal;
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
if(collision.CompareTag("Player"))
|
||||
{
|
||||
if (collision.gameObject.GetComponentInChildren<CombaSystem>()._animator.CheckAnimationTag("Roll"))
|
||||
return;
|
||||
Debug.Log("»÷ÖÐ");
|
||||
collision.gameObject.GetComponentInChildren<CombaSystem>().TakeDamage(20);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9f66d4a955da568499421df665e614ec
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,69 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CombaSystem : MonoBehaviour
|
||||
{
|
||||
public Animator _animator;
|
||||
public AudioSource _audio;
|
||||
public AudioClip _summerClip;
|
||||
|
||||
[Header("近战攻击")]
|
||||
[SerializeField] protected Vector2 attackSize = new Vector2();
|
||||
[SerializeField] protected Vector2 AttackAreaPos;
|
||||
[Header("判定偏移")]
|
||||
[SerializeField] protected float offsetX = 1f;
|
||||
[SerializeField] protected float offsetY = 1f;
|
||||
|
||||
[SerializeField,Header("检测层级")] protected List<LayerMask> layerMasks;
|
||||
|
||||
|
||||
public float maxHp = 1800;
|
||||
public float currentHp;
|
||||
[Header("攻击")]
|
||||
public float attack = 50;
|
||||
|
||||
public Action<float> OnHit;
|
||||
|
||||
protected bool isDie = false;
|
||||
protected virtual void Awake()
|
||||
{
|
||||
currentHp = maxHp;
|
||||
}
|
||||
public virtual void MelleeAttackAnimEvent()
|
||||
{
|
||||
Debug.Log("ATTACK");
|
||||
|
||||
AttackAreaPos = transform.position;
|
||||
|
||||
AttackAreaPos.x += offsetX;
|
||||
AttackAreaPos.y += offsetY;
|
||||
|
||||
offsetX = this.transform.parent.localScale.x < 0 ? Mathf.Abs(offsetX) : -Mathf.Abs(offsetX);
|
||||
}
|
||||
|
||||
protected void OnDrawGizmos()
|
||||
{
|
||||
Gizmos.color = Color.red;
|
||||
Gizmos.DrawWireCube(AttackAreaPos, attackSize);
|
||||
}
|
||||
|
||||
public bool GetIsDie()
|
||||
{
|
||||
return isDie;
|
||||
}
|
||||
|
||||
#region 受伤
|
||||
//收到攻击
|
||||
public virtual void TakeDamage(string hitName, float attack)
|
||||
{
|
||||
}
|
||||
public virtual void TakeDamage(float attack)
|
||||
{
|
||||
}
|
||||
public virtual void TakeDamage()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39dcd5b188009fa4a9664243cee7bec0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,92 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public enum AblityClass
|
||||
{
|
||||
MelleeAttack,
|
||||
YuanChenAttack
|
||||
}
|
||||
public abstract class CombatAblilityBase : ScriptableObject
|
||||
{
|
||||
[SerializeField, Header("技能名称")] protected string abilityName;
|
||||
[SerializeField, Header("技能ID")] protected int abilityID;
|
||||
[SerializeField, Header("技能CD")] protected float abilityCDTime;
|
||||
[SerializeField, Header("技能类型")] protected AblityClass abilityClass;
|
||||
[SerializeField, Header("技能音效")] protected AudioClip abilityVFX;
|
||||
|
||||
[SerializeField, Header("技能可用")] protected bool abilityIsDone;
|
||||
[SerializeField, Header("技能释放距离")] protected float abilityDistance;
|
||||
|
||||
[SerializeField, Header("技能个数")] protected int maxAbilityCount=0;
|
||||
protected int currentAbilityCount = 0;
|
||||
|
||||
[SerializeField, Header("技能释放偏移")] protected List<Vector2> abilityOffest;
|
||||
|
||||
|
||||
private Transform pollName;
|
||||
|
||||
protected BossAI ai;
|
||||
protected Animator _animator;
|
||||
public abstract void UpdateAblity(Transform target=null);
|
||||
|
||||
public void UseAblity(CombatAblilityBase ablility)
|
||||
{
|
||||
pollName = GameObject.Find("TimerRoot").transform;
|
||||
abilityIsDone = false;
|
||||
//开始计时
|
||||
string timerPath = "Perfab/Timer";
|
||||
GameObject timer = Resloader.Load<GameObject>(timerPath);//寻找预制体
|
||||
|
||||
GameObject go = Instantiate(timer, pollName);
|
||||
if(ablility.abilityClass==AblityClass.MelleeAttack)
|
||||
{
|
||||
go.GetComponent<Timer>().CreateTime(ablility.GetAbliltyCD(), () => ablility.abilityIsDone = true, false);
|
||||
}
|
||||
else if (ablility.abilityClass == AblityClass.YuanChenAttack)
|
||||
{
|
||||
go.GetComponent<Timer>().CreateTime(ablility.GetAbliltyCD(), () => { ablility.abilityIsDone = true;
|
||||
ablility.currentAbilityCount = maxAbilityCount;
|
||||
}, false);
|
||||
}
|
||||
}
|
||||
public void Init(BossAI boss,Animator ani)
|
||||
{
|
||||
ai = boss;
|
||||
_animator = ani;
|
||||
abilityIsDone = true;
|
||||
currentAbilityCount = maxAbilityCount;
|
||||
}
|
||||
public bool GetAbliltyIsDone()
|
||||
{
|
||||
return abilityIsDone;
|
||||
}
|
||||
public void SetAbliltyIsDone(bool isDone)
|
||||
{
|
||||
abilityIsDone = isDone;
|
||||
}
|
||||
public AblityClass GetAbliltyClass()
|
||||
{
|
||||
return abilityClass;
|
||||
}
|
||||
public string GetAbliltyName()
|
||||
{
|
||||
return abilityName;
|
||||
}
|
||||
public float GetAbliltyCD()
|
||||
{
|
||||
return abilityCDTime;
|
||||
}
|
||||
public float GetAbliltyDis()
|
||||
{
|
||||
return abilityDistance;
|
||||
}
|
||||
public List<Vector2> GetAbliltyOffest()
|
||||
{
|
||||
return abilityOffest;
|
||||
}
|
||||
public AudioClip GetAbliltyVFX()
|
||||
{
|
||||
return abilityVFX;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8490e9bf7913124ba5e447788cce308
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea17276305d3c084093870a6ccf4a81f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
public enum CharacterType
|
||||
{
|
||||
Npc,
|
||||
Player,
|
||||
}
|
||||
[Serializable]
|
||||
public class DialogNode
|
||||
{
|
||||
public int npcID;
|
||||
public int ToId;
|
||||
public CharacterType type;
|
||||
public string characterName;
|
||||
public Sprite characterSprite;
|
||||
[TextArea]
|
||||
public string dialog;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8787915c22c845749a2c360aab44d4de
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,123 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a8ce42ca11e4651489ab01075c11226c, type: 3}
|
||||
m_Name: Dialogue
|
||||
m_EditorClassIdentifier:
|
||||
dialogNode:
|
||||
- npcID: 0
|
||||
ToId: 0
|
||||
type: 0
|
||||
characterName: "\u5927\u767D\u7F8A"
|
||||
characterSprite: {fileID: 21300000, guid: 6c9534d590f8fe84da19aeca85f376d8, type: 3}
|
||||
dialog: "\u4F60\u597D\u554A\uFF0C\u5C11\u5E74\uFF01\uFF01"
|
||||
- npcID: 0
|
||||
ToId: 0
|
||||
type: 1
|
||||
characterName: "\u73A9\u5BB6"
|
||||
characterSprite: {fileID: 21300000, guid: cf242bc813f581f438f1c1e8d464145a, type: 3}
|
||||
dialog: "\u5582\uFF01\u4F60\u662F\u4E2A\u4EC0\u4E48\u73A9\u610F\uFF1F"
|
||||
- npcID: 0
|
||||
ToId: 0
|
||||
type: 0
|
||||
characterName: "\u5927\u767D\u7F8A"
|
||||
characterSprite: {fileID: 21300000, guid: 6c9534d590f8fe84da19aeca85f376d8, type: 3}
|
||||
dialog: "\u7B2C\u4E00\uFF0C\u6211\u4E0D\u53EB\u5582\uFF0C\u7B2C\u4E8C\uFF0C\u6211\u4E0D\u662F\u73A9\u610F"
|
||||
- npcID: 0
|
||||
ToId: 0
|
||||
type: 0
|
||||
characterName: "\u5927\u767D\u7F8A"
|
||||
characterSprite: {fileID: 21300000, guid: 6c9534d590f8fe84da19aeca85f376d8, type: 3}
|
||||
dialog: "\u4F60\u53EF\u4EE5\u53EB\u6211\u5927\u767D\u7F8A"
|
||||
- npcID: 0
|
||||
ToId: 0
|
||||
type: 1
|
||||
characterName: "\u73A9\u5BB6"
|
||||
characterSprite: {fileID: 21300000, guid: cf242bc813f581f438f1c1e8d464145a, type: 3}
|
||||
dialog: "\u597D\u7684\uFF0C\u5927\u767D\u7F8A\u3002\u63A5\u4E0B\u6765\u6211\u8981\u5E72\u561B\uFF1F\uFF1F\uFF1F"
|
||||
- npcID: 0
|
||||
ToId: 0
|
||||
type: 0
|
||||
characterName: "\u5927\u767D\u7F8A"
|
||||
characterSprite: {fileID: 21300000, guid: 6c9534d590f8fe84da19aeca85f376d8, type: 3}
|
||||
dialog: "\u5F53\u7136\u662F\u4E0D\u65AD\u6218\u6597\u4E86\uFF0C\u56E0\u4E3A\uFF0C\u6218\u6597\uFF01\uFF01\u723D\uFF01\uFF01\uFF01"
|
||||
- npcID: 0
|
||||
ToId: 0
|
||||
type: 1
|
||||
characterName: "\u73A9\u5BB6"
|
||||
characterSprite: {fileID: 21300000, guid: cf242bc813f581f438f1c1e8d464145a, type: 3}
|
||||
dialog: "\u53EF\u662F\u6211\u4E0D\u4F1A\u6218\u6597\uFF01\uFF01\uFF01"
|
||||
- npcID: 0
|
||||
ToId: 0
|
||||
type: 0
|
||||
characterName: "\u5927\u767D\u7F8A"
|
||||
characterSprite: {fileID: 21300000, guid: 6c9534d590f8fe84da19aeca85f376d8, type: 3}
|
||||
dialog: "\u65E0\u59A8\uFF0C\u6211\u6765\u6559\u4F60\u3002"
|
||||
- npcID: 0
|
||||
ToId: 0
|
||||
type: 0
|
||||
characterName: "\u5927\u767D\u7F8A"
|
||||
characterSprite: {fileID: 21300000, guid: 6c9534d590f8fe84da19aeca85f376d8, type: 3}
|
||||
dialog: "AWSD\u79FB\u52A8\uFF0C\u9F20\u6807\u653B\u51FB\uFF0CLshift\u7FFB\u6EDA\u95EA\u907F"
|
||||
- npcID: 0
|
||||
ToId: 0
|
||||
type: 0
|
||||
characterName: "\u5927\u767D\u7F8A"
|
||||
characterSprite: {fileID: 21300000, guid: 6c9534d590f8fe84da19aeca85f376d8, type: 3}
|
||||
dialog: "Tab\u6253\u5F00\u80CC\u5305\uFF0C1\u559D\u836F\u56DE\u8840\uFF0CEsc\u4F60\u61C2\u7684"
|
||||
- npcID: 0
|
||||
ToId: 0
|
||||
type: 0
|
||||
characterName: "\u5927\u767D\u7F8A"
|
||||
characterSprite: {fileID: 21300000, guid: 6c9534d590f8fe84da19aeca85f376d8, type: 3}
|
||||
dialog: "\u5927\u6982\u5C31\u8FD9\u4E9B\uFF0C\u4E0A\u5427\uFF0C\u5C11\u5E74\uFF01\uFF01\uFF01"
|
||||
- npcID: 0
|
||||
ToId: 0
|
||||
type: 1
|
||||
characterName: "\u73A9\u5BB6"
|
||||
characterSprite: {fileID: 21300000, guid: cf242bc813f581f438f1c1e8d464145a, type: 3}
|
||||
dialog: "\uFF1F\uFF1F\uFF1F"
|
||||
- npcID: 0
|
||||
ToId: 0
|
||||
type: 0
|
||||
characterName: "\u5927\u767D\u7F8A"
|
||||
characterSprite: {fileID: 21300000, guid: 6c9534d590f8fe84da19aeca85f376d8, type: 3}
|
||||
dialog: "\u597D\u4E86\uFF0C\u4F60\u5DF2\u7ECF\u662F\u4E2A\u6210\u719F\u7684\u52C7\u58EB\u4E86\u3002\u4E0A\u5427\uFF01\uFF01\uFF01"
|
||||
- npcID: 1
|
||||
ToId: 0
|
||||
type: 0
|
||||
characterName: "\u5929\u68AF\u5546\u4EBA"
|
||||
characterSprite: {fileID: 21300000, guid: 5a38bec081c255c4a9cecabc8fbdca11, type: 3}
|
||||
dialog: "\u4F60\u597D\uFF0C\u9A9A\u5E74\u90CE\uFF01\uFF01"
|
||||
- npcID: 1
|
||||
ToId: 0
|
||||
type: 0
|
||||
characterName: "\u5929\u68AF\u5546\u4EBA"
|
||||
characterSprite: {fileID: 21300000, guid: 5a38bec081c255c4a9cecabc8fbdca11, type: 3}
|
||||
dialog: "\u5728\u6211\u8FD9\u91CC\u53EF\u4EE5\u901A\u8FC7\u6C38\u6052\u4E4B\u5FC3\u5E2E\u52A9\u4F60\u6C38\u4E45\u63D0\u5347\u5C5E\u6027\uFF01\uFF01"
|
||||
- npcID: 1
|
||||
ToId: 0
|
||||
type: 0
|
||||
characterName: "\u5929\u68AF\u5546\u4EBA"
|
||||
characterSprite: {fileID: 21300000, guid: 5a38bec081c255c4a9cecabc8fbdca11, type: 3}
|
||||
dialog: "\u6BCF\u6B21\u51FB\u8D25\u654C\u4EBA\u540E\u4F60\u90FD\u80FD\u83B7\u5F97\u6C38\u6052\u4E4B\u5FC3"
|
||||
- npcID: 1
|
||||
ToId: 0
|
||||
type: 0
|
||||
characterName: "\u5929\u68AF\u5546\u4EBA"
|
||||
characterSprite: {fileID: 21300000, guid: 5a38bec081c255c4a9cecabc8fbdca11, type: 3}
|
||||
dialog: "\u4E0D\u65AD\u5347\u7EA7\u4E4B\u540E\u4F60\u5C31\u80FD\u780D\u74DC\u5207\u83DC\u4E86"
|
||||
- npcID: 1
|
||||
ToId: 0
|
||||
type: 0
|
||||
characterName: "\u5929\u68AF\u5546\u4EBA"
|
||||
characterSprite: {fileID: 21300000, guid: 5a38bec081c255c4a9cecabc8fbdca11, type: 3}
|
||||
dialog: "\u52AA\u529B\u5427\uFF0C\u9A9A\u5E74\uFF01\uFF01\uFF01"
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22ec8072504f82a448da685ce9ed9af0
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,13 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
[CreateAssetMenu(fileName ="Dialogue")]
|
||||
public class Dialogue : ScriptableObject
|
||||
{
|
||||
public DialogNode[] dialogNode;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8ce42ca11e4651489ab01075c11226c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,95 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DialogueSystem : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Dialogue dialogue;
|
||||
|
||||
[SerializeField] private GameObject dialogBox;
|
||||
|
||||
[SerializeField] private Text dialog;
|
||||
|
||||
[SerializeField] private Text characterName;
|
||||
|
||||
[SerializeField] private Image characterSprite;
|
||||
|
||||
[SerializeField] private CharacterType type;
|
||||
|
||||
private int index;
|
||||
private bool isInTurn;
|
||||
|
||||
private int npcId;
|
||||
|
||||
public Dictionary<int, List<DialogNode>> dialogNodes = new Dictionary<int, List<DialogNode>>();
|
||||
private void Awake()
|
||||
{
|
||||
foreach (var dia in dialogue.dialogNode)
|
||||
{
|
||||
if (!dialogNodes.ContainsKey(dia.npcID))
|
||||
{
|
||||
dialogNodes.Add(dia.npcID,new List<DialogNode> { dia});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dialogNodes[dia.npcID].Add(dia);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.E) && isInTurn)
|
||||
{
|
||||
Play();
|
||||
}
|
||||
|
||||
}
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
if (collision.CompareTag("Npc"))
|
||||
{
|
||||
Debug.Log("aaa");
|
||||
isInTurn = true;
|
||||
npcId = collision.GetComponent<UITip>().GetNpcId();
|
||||
}
|
||||
|
||||
}
|
||||
private void OnTriggerExit2D(Collider2D collision)
|
||||
{
|
||||
if (collision.CompareTag("Npc"))
|
||||
{
|
||||
Debug.Log("bbb");
|
||||
isInTurn = false;
|
||||
index = 0;
|
||||
dialogBox.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
void Play()
|
||||
{
|
||||
dialogBox.SetActive(true);
|
||||
DialogNode node = dialogNodes[npcId][Mathf.Clamp(index++, 0, dialogNodes[npcId].Count - 1)];
|
||||
|
||||
if (index - 1 == dialogNodes[npcId].Count)
|
||||
{
|
||||
dialog.text = "抱歉,我很忙,你可以找一下事情做";
|
||||
}
|
||||
else
|
||||
{
|
||||
dialog.text = node.dialog;
|
||||
}
|
||||
|
||||
characterName.text = node.characterName;
|
||||
characterSprite.overrideSprite = node.characterSprite;
|
||||
|
||||
if (index - 1 == dialogNodes[npcId].Count)
|
||||
{
|
||||
dialog.text = null;
|
||||
dialogBox.SetActive(false);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 275d5d5b965cd914ebf6dd089b3887e8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,337 +0,0 @@
|
||||
using Manager;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class BossAI : CombaSystem
|
||||
{
|
||||
//基本信息类
|
||||
public BossInfo _info;
|
||||
Rigidbody2D rb;
|
||||
|
||||
//玩家信息,待优化
|
||||
PlayerControler player;
|
||||
CharacterCombat characterCombat;
|
||||
|
||||
private Transform currentTarget;
|
||||
|
||||
|
||||
//玩家与敌人的距离方向
|
||||
private float dis;
|
||||
private Vector2 dir;
|
||||
|
||||
[Header("追击与攻击距离")]
|
||||
public float cheseDistance = 3f;
|
||||
public float attackDistance = 0.8f;
|
||||
|
||||
[SerializeField, Header("技能搭配")] private List<CombatAblilityBase> abilitys = new List<CombatAblilityBase>();
|
||||
private CombatAblilityBase currentAblity;
|
||||
//判断偏移
|
||||
private List<Vector2> ablityOff;
|
||||
//攻击段数
|
||||
private int attackCount;
|
||||
|
||||
//计时器
|
||||
public GameObject timer;
|
||||
|
||||
public bool isBegin = false;
|
||||
|
||||
List<CombatAblilityBase> tempAb = new List<CombatAblilityBase>();//可用技能组
|
||||
int ran;//技能组索引
|
||||
|
||||
CameraVR cameraVR;
|
||||
|
||||
public bool isYuancheng=false;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
_animator = GetComponentInChildren<Animator>();
|
||||
rb = GetComponentInParent<Rigidbody2D>();
|
||||
currentTarget = GameObject.FindWithTag("Player").transform;
|
||||
|
||||
_info = GetComponentInParent<BossInfo>();
|
||||
|
||||
foreach (var ab in abilitys)
|
||||
{
|
||||
ab.Init(this,_animator);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
if (!_animator.CheckAnimationTag("summon")&&isBegin)
|
||||
{
|
||||
if (!isDie) //死亡或咆哮状态的时候不会进行攻击
|
||||
{
|
||||
MoveBoss();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (currentAblity != null)
|
||||
{
|
||||
currentAblity.UpdateAblity(currentTarget);
|
||||
}
|
||||
}
|
||||
private void MoveBoss()
|
||||
{
|
||||
if (_animator.CheckAnimationTag("Wake"))
|
||||
return;
|
||||
|
||||
if (_animator.CheckAnimationTag("hit") || _animator.CheckAnimationTag("Attack")||_animator.CheckAnimationTag("Attack_out"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (currentTarget == null)
|
||||
return;
|
||||
|
||||
LockTarget(currentTarget);
|
||||
|
||||
dis = Vector2.Distance(currentTarget.position, transform.position);
|
||||
if (dis < cheseDistance)
|
||||
{
|
||||
rb.velocity = Vector2.zero;
|
||||
//近战
|
||||
if (dis < attackDistance)
|
||||
{
|
||||
//_animator.Play("attack-charge");
|
||||
currentAblity = GetAblity(AblityClass.MelleeAttack);
|
||||
if (currentAblity != null)
|
||||
{
|
||||
//SoundManager.Instance.PlayEffect(_audio, currentAblity.GetAbliltyVFX());
|
||||
|
||||
_animator.Play(currentAblity.GetAbliltyName());
|
||||
|
||||
currentAblity.UseAblity(currentAblity);
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
//远程
|
||||
else
|
||||
{
|
||||
currentAblity = GetAblity(AblityClass.YuanChenAttack);
|
||||
if (currentAblity != null)
|
||||
{
|
||||
//SoundManager.Instance.PlayEffect(_audio, currentAblity.GetAbliltyVFX());
|
||||
|
||||
_animator.Play(currentAblity.GetAbliltyName());
|
||||
|
||||
currentAblity.UseAblity(currentAblity);
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_info.isCanMove)
|
||||
return;
|
||||
_animator.Play("run");
|
||||
rb.velocity = dir * _info._moveSpeed;
|
||||
}
|
||||
|
||||
}
|
||||
private void LockTarget(Transform target)
|
||||
{
|
||||
if (!_info.isLockTarget)
|
||||
return;
|
||||
dir = (target.position - transform.position).normalized;
|
||||
if(_info.isFix)
|
||||
{
|
||||
Fix(dir);
|
||||
}
|
||||
}
|
||||
private void Fix(Vector2 dir)
|
||||
{
|
||||
if (dir.x < 0)
|
||||
{
|
||||
transform.root.localScale = new Vector3(1, 1, 1);
|
||||
}
|
||||
if (dir.x > 0)
|
||||
{
|
||||
transform.root.localScale = new Vector3(-1, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Yuancheng()
|
||||
{
|
||||
isYuancheng = true;
|
||||
}
|
||||
public void OnCloseYuancheng()
|
||||
{
|
||||
isYuancheng = false;
|
||||
}
|
||||
public void TeleportEvent()
|
||||
{
|
||||
if (currentTarget == null) return;
|
||||
transform.root.transform.position = currentTarget.transform.position;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 近战攻击
|
||||
/// </summary>
|
||||
public override void MelleeAttackAnimEvent()
|
||||
{
|
||||
if (currentAblity != null)
|
||||
{
|
||||
AttackAreaPos = transform.position;
|
||||
|
||||
ablityOff = currentAblity.GetAbliltyOffest();
|
||||
|
||||
AttackAreaPos.x += ablityOff[attackCount].x;
|
||||
AttackAreaPos.y += ablityOff[attackCount].y;
|
||||
attackCount++;
|
||||
if (attackCount >= ablityOff.Count)
|
||||
{
|
||||
attackCount = 0;
|
||||
}
|
||||
|
||||
if (_info.isCanMove)
|
||||
{
|
||||
AttackAreaPos.x = this.transform.parent.localScale.x < 0 ? Mathf.Abs(offsetX) : -Mathf.Abs(offsetX);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
base.MelleeAttackAnimEvent();
|
||||
}
|
||||
|
||||
Collider2D[] hitColliders = Physics2D.OverlapBoxAll(AttackAreaPos, attackSize, 0, layerMasks[0]);
|
||||
if(currentAblity!=null&¤tAblity.GetAbliltyVFX()!=null)
|
||||
{
|
||||
SoundManager.Instance.PlayEffect(_audio, currentAblity.GetAbliltyVFX());
|
||||
}
|
||||
|
||||
foreach (Collider2D hitInfo in hitColliders)
|
||||
{
|
||||
|
||||
player = hitInfo.GetComponent<PlayerControler>();
|
||||
if (player != null && player.GetIsDodge())
|
||||
{
|
||||
Debug.Log("玩家无敌");
|
||||
_animator.speed = 0;
|
||||
StartCoroutine(ScalTime(1f));
|
||||
|
||||
return;
|
||||
}
|
||||
characterCombat = hitInfo.GetComponentInChildren<CharacterCombat>();
|
||||
//if(characterCombat._animator.CheckAnimationTag("Roll"))
|
||||
//{
|
||||
// //无敌闪避
|
||||
// _animator.speed = 0;
|
||||
// StartCoroutine(ScalTime(1f));
|
||||
// return;
|
||||
//}
|
||||
|
||||
characterCombat.TakeDamage(attack);
|
||||
Debug.Log("玩家受伤");
|
||||
}
|
||||
}
|
||||
IEnumerator ScalTime(float timer)
|
||||
{
|
||||
yield return new WaitForSeconds(timer);
|
||||
_animator.speed = 1;
|
||||
}
|
||||
public override void TakeDamage(string aniName, float attack)
|
||||
{
|
||||
|
||||
if (isDie || _animator.CheckAnimationTag("summon")||_animator.CheckAnimationTag("Wake"))//咆哮不会被攻击
|
||||
return;
|
||||
Debug.Log("被玩家攻击" + _info.attackedCount);
|
||||
|
||||
_info.attackedCount++;//耐力次数增加
|
||||
|
||||
if (_info.attackedCount > _info.maxAttackedCount)
|
||||
{
|
||||
_info.attackedCount = 0;//重新计数
|
||||
|
||||
_animator.Play("summon");
|
||||
if(_summerClip!=null)
|
||||
{
|
||||
SoundManager.Instance.PlayEffect(_audio,_summerClip);
|
||||
}
|
||||
|
||||
//吼叫
|
||||
|
||||
|
||||
//摄像机震动
|
||||
|
||||
cameraVR=UnityExpandFunction.GetCamera();
|
||||
if (cameraVR != null)
|
||||
{
|
||||
cameraVR.ShakeCamera(1f, 5);
|
||||
}
|
||||
|
||||
//回血
|
||||
currentHp += 200;
|
||||
if (currentHp >= maxHp)
|
||||
currentHp = maxHp;
|
||||
OnHit?.Invoke(currentHp);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//受伤
|
||||
currentHp -= attack;//血量减少
|
||||
OnHit?.Invoke(currentHp);//执行受伤事件,血量UI减少
|
||||
if (currentHp <= 0)
|
||||
{
|
||||
isDie = true;
|
||||
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
if(_animator.CheckAnimationTag("Attack"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
_animator.Play(aniName);
|
||||
}
|
||||
private CombatAblilityBase GetAblity(AblityClass ablity)
|
||||
{
|
||||
tempAb.Clear();
|
||||
foreach (var ab in abilitys)
|
||||
{
|
||||
if (ab.GetAbliltyIsDone() && ab.GetAbliltyClass() == ablity)
|
||||
{
|
||||
tempAb.Add(ab);
|
||||
}
|
||||
}
|
||||
if(tempAb.Count==0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ran = UnityEngine.Random.Range(0,tempAb.Count);
|
||||
if (tempAb[ran] != null)
|
||||
return tempAb[ran];
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void SetBegin(bool b)
|
||||
{
|
||||
isBegin = b;
|
||||
//开始
|
||||
_animator.Play("sleeping");
|
||||
UIManager.Instance.Show<UIEnterScene>().InitInfo(_info.bossHead, _info.bossName);
|
||||
}
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
|
||||
Gizmos.color = Color.yellow;
|
||||
Gizmos.DrawWireSphere(transform.position, cheseDistance);
|
||||
|
||||
Gizmos.color = Color.red;
|
||||
Gizmos.DrawWireSphere(transform.position, attackDistance);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d151185264385eb48b7823df0a3c2d04
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BossInfo : MonoBehaviour
|
||||
{
|
||||
|
||||
[Header("名字与头像")]
|
||||
public string bossName;
|
||||
public Sprite bossHead;
|
||||
|
||||
[Header("失衡最大次数")]
|
||||
public int maxAttackedCount;
|
||||
[Header("被攻击次数")]
|
||||
public int attackedCount=0;
|
||||
|
||||
//是否允许锁定目标
|
||||
[Header("索敌")]
|
||||
public bool isLockTarget;
|
||||
[Header("移动")]
|
||||
public bool isCanMove;
|
||||
[Header("翻转")]
|
||||
public bool isFix;
|
||||
|
||||
[Header("移动速度")]
|
||||
public float _moveSpeed;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c35bd5b6f66429b47a669052403acc96
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,30 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CameraMove : MonoBehaviour
|
||||
{
|
||||
private Transform player;
|
||||
void Start()
|
||||
{
|
||||
player = GameObject.FindGameObjectWithTag("Player").transform;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
//RaycastHit[] hits;
|
||||
|
||||
//hits = Physics.RaycastAll(ray, Mathf.Infinity, badMask);
|
||||
//for (int i = 0; i < hits.Length; i++)
|
||||
//{
|
||||
// Debug.Log(hits[i].collider.gameObject.name);
|
||||
//}
|
||||
//Debug.Log(hits.Length);
|
||||
|
||||
if (player!=null)
|
||||
{
|
||||
transform.position = new Vector3(player.position.x, player.position.y - 11, player.position.z);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 066236bbf8c0b6f4ab7929aa5dfec2bb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,63 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Cinemachine;
|
||||
|
||||
public class CameraVR : MonoBehaviour
|
||||
{
|
||||
private CinemachineVirtualCamera _cinemachineVirtualCamera;
|
||||
private CinemachineBasicMultiChannelPerlin _multiChannelPerlin;
|
||||
|
||||
//当前持续时间
|
||||
private float _shakeTime;
|
||||
//总时间
|
||||
private float _shakeTimeTotal;
|
||||
//强度
|
||||
private float _shakeIntensity;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
_cinemachineVirtualCamera = GetComponent<CinemachineVirtualCamera>();
|
||||
|
||||
_multiChannelPerlin = _cinemachineVirtualCamera.GetCinemachineComponent<CinemachineBasicMultiChannelPerlin>();
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (_shakeTime > 0)
|
||||
{
|
||||
_shakeTime -= Time.deltaTime;
|
||||
_multiChannelPerlin.m_AmplitudeGain = Mathf.Lerp(0, _shakeIntensity, _shakeTime / _shakeTimeTotal);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 抖动
|
||||
/// </summary>
|
||||
/// <param name="Time">抖动时间</param>
|
||||
/// <param name="Intensity">强度</param>
|
||||
public void ShakeCamera(float time, float intensity)
|
||||
{
|
||||
if (_cinemachineVirtualCamera != null)
|
||||
{
|
||||
_shakeTimeTotal = time;
|
||||
_shakeIntensity = intensity;
|
||||
|
||||
_shakeTime = _shakeTimeTotal;
|
||||
_multiChannelPerlin.m_AmplitudeGain = _shakeIntensity;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
Ray ray = new Ray(transform.position, transform.forward);
|
||||
Gizmos.color = Color.blue;
|
||||
|
||||
Gizmos.DrawRay(ray);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab12f70a05a6b764ca991a34facaca96
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,44 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Destructeable : MonoBehaviour
|
||||
{
|
||||
public GameObject destoryVFX;
|
||||
public GameObject big;
|
||||
public GameObject small;
|
||||
|
||||
private bool isDestory=false;
|
||||
public float reTiem = 5;
|
||||
|
||||
public void OnDestoryObject()
|
||||
{
|
||||
if (isDestory)
|
||||
return;
|
||||
if (destoryVFX != null)
|
||||
{
|
||||
Instantiate(destoryVFX,transform.position,transform.rotation);
|
||||
}
|
||||
|
||||
big.SetActive(false);
|
||||
SmallActive(true);
|
||||
isDestory = true;
|
||||
StartCoroutine(nameof(DestoryTime));
|
||||
}
|
||||
|
||||
IEnumerator DestoryTime()
|
||||
{
|
||||
yield return new WaitForSeconds(reTiem);
|
||||
big.SetActive(true);
|
||||
SmallActive(false);
|
||||
}
|
||||
|
||||
private void SmallActive(bool active)
|
||||
{
|
||||
if (small != null)
|
||||
{
|
||||
small.SetActive(active);
|
||||
isDestory = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17918bd11b9ebbe4aa8f98fc6b565daa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,155 +0,0 @@
|
||||
using Manager;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CharacterCombat : CombaSystem
|
||||
{
|
||||
|
||||
[Header("音效")]
|
||||
public AudioSource audioSource;
|
||||
public PlayerControler controler;
|
||||
|
||||
[Header("特效")]
|
||||
public GameObject effect;
|
||||
|
||||
CameraVR cameraVR;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
maxHp = PlayerInfo.Instance.info.maxHp;
|
||||
currentHp = PlayerInfo.Instance.info.currentHp;
|
||||
attack = PlayerInfo.Instance.info.testAttack;
|
||||
|
||||
audioSource = transform.root.GetComponentInChildren<AudioSource>();
|
||||
|
||||
_animator = GetComponent<Animator>();
|
||||
|
||||
PlayerInfo.Instance.OnUpdateAttrbute += OnChangeAttrbute;
|
||||
|
||||
}
|
||||
private void OnDisable()
|
||||
{
|
||||
PlayerInfo.Instance.OnUpdateAttrbute -= OnChangeAttrbute;
|
||||
}
|
||||
|
||||
public override void MelleeAttackAnimEvent()
|
||||
{
|
||||
base.MelleeAttackAnimEvent();
|
||||
|
||||
Collider2D[] hitColliders = Physics2D.OverlapBoxAll(AttackAreaPos,attackSize,0,layerMasks[0]);
|
||||
Collider2D[] destructiveColliders = Physics2D.OverlapBoxAll(AttackAreaPos, attackSize, 0,layerMasks[1]);
|
||||
Collider2D[] treeColliders = Physics2D.OverlapBoxAll(AttackAreaPos, attackSize, 0, layerMasks[2]);
|
||||
|
||||
|
||||
foreach (Collider2D hitInfo in hitColliders)
|
||||
{
|
||||
|
||||
if(hitInfo.tag=="Enemy")
|
||||
{//小怪
|
||||
}
|
||||
if (hitInfo.tag == "Boss")
|
||||
{
|
||||
|
||||
hitInfo.GetComponentInChildren<BossAI>().TakeDamage("hurt-front",GetAttack());
|
||||
if (_summerClip != null)
|
||||
SoundManager.Instance.PlayEffect(_audio, _summerClip);
|
||||
//加入卡肉,特效
|
||||
if(effect!=null)
|
||||
{
|
||||
GameObject go = Instantiate(effect);
|
||||
|
||||
go.transform.position = hitInfo.transform.position + new Vector3(0,4,0);
|
||||
|
||||
//开始计时
|
||||
string timerPath = "Perfab/Timer";
|
||||
GameObject timer = Resloader.Load<GameObject>(timerPath);//寻找预制体
|
||||
|
||||
GameObject time = Instantiate(timer);
|
||||
time.GetComponent<Timer>().CreateTime(0.2f, () =>
|
||||
{
|
||||
ManagersMode.Poll.UnSpwan("EffectPoll", effect.name, go);
|
||||
}, false);
|
||||
|
||||
}
|
||||
|
||||
cameraVR = UnityExpandFunction.GetCamera();
|
||||
if (cameraVR != null)
|
||||
{
|
||||
cameraVR.ShakeCamera(0.5f, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (Collider2D hitInfo in destructiveColliders)
|
||||
{
|
||||
|
||||
}
|
||||
foreach (Collider2D hitInfo in treeColliders)//数目
|
||||
{
|
||||
Debug.Log("攻击树木");
|
||||
hitInfo.GetComponentInChildren<Tree>().TakeDamage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//受伤
|
||||
public override void TakeDamage(float atk)
|
||||
{
|
||||
currentHp -= atk;
|
||||
|
||||
OnHit?.Invoke(currentHp);//UI显示
|
||||
|
||||
if(currentHp<=0)
|
||||
{
|
||||
//死亡
|
||||
return;
|
||||
}
|
||||
_animator.Play("hurt");
|
||||
}
|
||||
private void OnChangeAttrbute(LotteryType type, float value)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case LotteryType.Hp:
|
||||
currentHp += value;
|
||||
if(currentHp>=maxHp)
|
||||
{
|
||||
currentHp = maxHp;
|
||||
}
|
||||
OnHit?.Invoke(currentHp);
|
||||
break;
|
||||
case LotteryType.Mp:
|
||||
maxHp += value;
|
||||
OnHit?.Invoke(currentHp);
|
||||
break;
|
||||
case LotteryType.Attack:
|
||||
attack += value;
|
||||
OnHit?.Invoke(currentHp);
|
||||
break;
|
||||
case LotteryType.UpMaxHp:
|
||||
PlayerInfo.Instance.info.maxHp += value;
|
||||
maxHp += value;
|
||||
OnHit?.Invoke(currentHp);
|
||||
break;
|
||||
case LotteryType.UpHp:
|
||||
Date.Instance.ItemDate[1].value += (int)value;
|
||||
OnHit?.Invoke(currentHp);
|
||||
break;
|
||||
case LotteryType.UpAttack:
|
||||
PlayerInfo.Instance.info.attack += value;
|
||||
attack += value;
|
||||
OnHit?.Invoke(currentHp);
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 攻击力量
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public float GetAttack()
|
||||
{
|
||||
return attack + (PlayerInfo.Instance.info.Level * 10);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c801442456af8848aeddf812bf4ca75
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,86 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Managers
|
||||
{
|
||||
public class BagManager
|
||||
{
|
||||
PlayerInfo Owner;
|
||||
public BagManager(PlayerInfo owner)
|
||||
{
|
||||
this.Owner = owner;
|
||||
}
|
||||
public void AddItem(int key, int value)
|
||||
{
|
||||
if (Owner == null) return;
|
||||
if (Owner.info.BagInfo.ContainsKey(key))
|
||||
{
|
||||
Owner.info.BagInfo[key] = Owner.info.BagInfo[key] + value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Owner.info.BagInfo.Add(key, value);
|
||||
}
|
||||
|
||||
Owner.OnUpdateBagInfo?.Invoke();
|
||||
Owner.OnUpdateMainUI?.Invoke();
|
||||
}
|
||||
public void UserItem(int id, int num)
|
||||
{
|
||||
if (Owner == null) return;
|
||||
if (Owner.info.BagInfo.ContainsKey(id))
|
||||
{
|
||||
foreach (var item in Date.Instance.ItemDate)//测试使用道具
|
||||
{
|
||||
if (item.Id == id && item.type == ItemClass.User)
|
||||
{
|
||||
if(Remove(item,num))
|
||||
{
|
||||
Debug.Log("使用道具");
|
||||
item.UseItem(item);
|
||||
}
|
||||
}
|
||||
if(item.Id == id && item.type == ItemClass.Up)
|
||||
{
|
||||
Remove(item, num);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("道具缺失");
|
||||
return;
|
||||
}
|
||||
}
|
||||
private bool Remove(Item item,int num)
|
||||
{
|
||||
if (Owner.info.BagInfo[item.Id] < num)
|
||||
{
|
||||
Debug.LogFormat("UserItem [{0}] count Insufficient", item.ItemName);
|
||||
return false;
|
||||
}
|
||||
Owner.info.BagInfo[item.Id] = Owner.info.BagInfo[item.Id] - num;//背包减少
|
||||
|
||||
if (Owner.info.BagInfo[item.Id] <= 0)
|
||||
{
|
||||
Owner.info.BagInfo.Remove(item.Id);
|
||||
}
|
||||
|
||||
Owner.OnUpdateBagInfo?.Invoke();
|
||||
Owner.OnUpdateMainUI?.Invoke();
|
||||
|
||||
Owner.WriteBagInfo();
|
||||
|
||||
//保存数据
|
||||
//Debug.Log(Owner.info.BagValue[item.Id]);
|
||||
|
||||
SaveSystem.SaveDate(Owner.info.DatePath, Owner.info);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20a184ad6c4412540a4cd3c66711e074
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f25f02f574c4a34499a0402ff9393dc5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3363aa678bc5a3947aeca6018e775f7f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,53 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CanUseItem : MonoBehaviour
|
||||
{
|
||||
public Transform rectTransfrom;
|
||||
|
||||
public Text UpItemNum;
|
||||
private void OnEnable()
|
||||
{
|
||||
PlayerInfo.Instance.OnUpdateMainUI += UpdateUI;
|
||||
UpdateUI();
|
||||
}
|
||||
private void OnDisable()
|
||||
{
|
||||
PlayerInfo.Instance.OnUpdateMainUI -= UpdateUI;
|
||||
}
|
||||
public void UpdateUI()
|
||||
{
|
||||
foreach (Transform item in rectTransfrom)
|
||||
{
|
||||
Destroy(item.gameObject);
|
||||
}
|
||||
if(PlayerInfo.Instance.info.BagInfo.Count==0|| !PlayerInfo.Instance.info.BagInfo.ContainsKey(0))//背包中没有道具
|
||||
{
|
||||
UpItemNum.text = "0";
|
||||
}
|
||||
foreach (var item in PlayerInfo.Instance.info.BagInfo)
|
||||
{
|
||||
if(item.Key==Date.Instance.ItemDate[0].Id)//背包中道具Id等于道具表中的升级道具
|
||||
{
|
||||
UpItemNum.text = item.Value.ToString();
|
||||
}
|
||||
|
||||
if(Date.Instance.ItemDate[item.Key].type==ItemClass.User)//能够使用的道具
|
||||
{
|
||||
string path = "UI/Perfab/Item";
|
||||
UnityEngine.Object go = Resloader.Load<GameObject>(path);
|
||||
if (go != null)//预制体不为空
|
||||
{
|
||||
GameObject m = (GameObject)Instantiate(go, rectTransfrom);
|
||||
UIItemInfo ui = m.GetComponent<UIItemInfo>();
|
||||
ui.gameObject.SetActive(true);
|
||||
|
||||
ui.SetInfo(item.Key, item.Value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c480308bc5b87dd4193ea0174eb6d6b8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,47 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Date:Singleton<Date>
|
||||
{
|
||||
public List<Item> ItemDate = new List<Item>();
|
||||
|
||||
public List<LevelUpDefine> UpDate = new List<LevelUpDefine>();
|
||||
|
||||
}
|
||||
|
||||
public enum ItemClass
|
||||
{
|
||||
User,
|
||||
Up,
|
||||
}
|
||||
[Serializable]
|
||||
public class CharInfo
|
||||
{
|
||||
public string DatePath;
|
||||
|
||||
public string playerName;
|
||||
public int Level;
|
||||
public int exp;
|
||||
|
||||
public float maxHp;
|
||||
public float attack;
|
||||
|
||||
//局内属性
|
||||
public int currentMap;
|
||||
public float currentHp;
|
||||
public float testAttack;
|
||||
|
||||
//背包数据
|
||||
public Dictionary<int, int> BagInfo;//背包字典
|
||||
public List<int> BagKey;
|
||||
public List<int> BagValue;
|
||||
|
||||
//升级数据
|
||||
|
||||
public Dictionary<int, bool> UpInfo;//升级字典
|
||||
public List<int> UpKey;
|
||||
public List<bool> UpValue;
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0af01c0f76595044aa27ad201f2d08b0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,91 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CharacterHp : MonoBehaviour
|
||||
{
|
||||
public GameObject EndUI;
|
||||
|
||||
//UI
|
||||
public Image headImage;
|
||||
private float maxHp;
|
||||
public Slider hpBar;
|
||||
public Text bossName;
|
||||
public Text hpText;
|
||||
public Text atk;
|
||||
|
||||
private Animator _animator;
|
||||
private BossAI bossAI;
|
||||
private CharacterCombat charComba;
|
||||
private void Awake()
|
||||
{
|
||||
hpBar.value = 1;
|
||||
}
|
||||
public void Init(BossAI ai)
|
||||
{
|
||||
_animator = ai._animator;
|
||||
headImage.overrideSprite = ai._info.bossHead;
|
||||
maxHp = ai.maxHp;
|
||||
hpText.text = maxHp + "/" + maxHp;
|
||||
|
||||
bossAI = ai;
|
||||
bossName.text = ai._info.bossName;
|
||||
ai.OnHit += OnUpdate;
|
||||
}
|
||||
public void Init(CharacterCombat ch)
|
||||
{
|
||||
_animator = ch._animator;
|
||||
maxHp = ch.maxHp;
|
||||
hpText.text = ch.currentHp + "/" + maxHp;
|
||||
charComba = ch;
|
||||
atk.text = ch.attack.ToString();
|
||||
bossName.text = PlayerInfo.Instance.info.playerName;
|
||||
ch.OnHit += OnUpdate;
|
||||
}
|
||||
|
||||
private void OnUpdate(float hp)
|
||||
{
|
||||
if(bossAI==null)
|
||||
{
|
||||
maxHp = charComba.maxHp;
|
||||
atk.text = charComba.attack.ToString();
|
||||
}
|
||||
hpBar.value = hp/maxHp;
|
||||
hpText.text = hp + "/" + maxHp;
|
||||
if (hp<=0)
|
||||
{
|
||||
_animator.Play("die");
|
||||
hpText.text = "0/" + maxHp;
|
||||
if (charComba==null)//¹ÖÎչʾÖÕ½áUI
|
||||
{
|
||||
EndUI.SetActive(true);
|
||||
StartCoroutine(StartTimer(1f));
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.Instance.Show<UIGameOver>();
|
||||
}
|
||||
}
|
||||
}
|
||||
IEnumerator StartTimer(float t)
|
||||
{
|
||||
yield return new WaitForSeconds(t);
|
||||
|
||||
EndUI.SetActive(false);
|
||||
yield return new WaitForSeconds(t);
|
||||
|
||||
//½±Àø
|
||||
UIManager.Instance.Show<UILottery>();
|
||||
PlayerInfo.Instance.BagMgr.AddItem(1, 2);
|
||||
PlayerInfo.Instance.BagMgr.AddItem(0, 2);
|
||||
PlayerInfo.Instance.info.exp += 2000;
|
||||
PlayerInfo.Instance.LevelUp();
|
||||
PlayerInfo.Instance.OnUpdateLevel?.Invoke();
|
||||
//
|
||||
|
||||
this.gameObject.SetActive(false);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 25181661743cceb4dbeb94494e7f83e0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user