diff options
author | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
commit | 22891bf59032ba88262824255a706d652031384b (patch) | |
tree | 7595439ba9966c9402d37e37cee5e8cf098757d5 /Assets/Scripts/Unit/Controller/MonsterController.cs | |
parent | 8b04ea73e540067f83870b61d89db4868fea5e8a (diff) |
* move folder
Diffstat (limited to 'Assets/Scripts/Unit/Controller/MonsterController.cs')
-rw-r--r-- | Assets/Scripts/Unit/Controller/MonsterController.cs | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/Assets/Scripts/Unit/Controller/MonsterController.cs b/Assets/Scripts/Unit/Controller/MonsterController.cs deleted file mode 100644 index 22645b47..00000000 --- a/Assets/Scripts/Unit/Controller/MonsterController.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class MonsterController : UnitController
-{
- public override UnitType type { get { return UnitType.Monster; } }
-
- protected override void Initialize()
- {
- base.Initialize();
-
- unitState = GetOrAddUnitComponent<MonsterState>();
- unitState.Initialize();
-
- unitAnimation = GetOrAddUnitComponent<MonsterAnimation>();
- unitAnimation.Initialize();
- }
-
- public override void Update()
- {
- base.Update();
- }
-
- public override void OnHit(CollisionInfo info)
- {
- }
-
- public override void OnGetHit(CollisionInfo info)
- {
- ColliderBox hitbox = info.collider.colliderInfo.collider;
- Debug.Assert(hitbox.type == ColliderBox.EColliderType.HitBox);
-
- if(hitbox.hitResponse == ColliderBox.EHitResponse.Light)
- {
- monsterState.ChangeState(MonsterState.EUnitState.HitLight, new MonsterState.HitLightParam(), true);
- }
- else if (hitbox.hitResponse == ColliderBox.EHitResponse.HitAir)
- {
- monsterState.ChangeState(MonsterState.EUnitState.HitAir, new MonsterState.HitAirParam());
- }
- else if (hitbox.hitResponse == ColliderBox.EHitResponse.HitInAir)
- {
- monsterState.ChangeState(MonsterState.EUnitState.HitInAir, new MonsterState.HitInAirParam(), true);
- }
-
- string path = hitbox.sparkPath;
- GameObject vfx = ResourceManager.Instance.LoadAsset<GameObject>(path);
- if(vfx != null)
- {
- GameObject go = GameObject.Instantiate(vfx);
- go.transform.position = center + hitbox.sparkOffset;
- go.transform.localScale = hitbox.sparkScale;
- }
- }
-
- public override void OnGetShot(CollisionInfo info)
- {
- monsterState.ChangeState(MonsterState.EUnitState.HitLight, new MonsterState.HitLightParam(), true);
- }
-
- public virtual bool IsFacePC()
- {
- PCController pc = PCController.instance;
- float pcX = pc.transform.position.x;
- float x = transform.position.x;
- bool isface = pcX > x && isTowardRight || pcX <= x && !isTowardRight;
- return isface;
- }
-
- // 朝向PC
- public virtual void FacePC()
- {
- if (IsFacePC())
- return;
- PCController pc = PCController.instance;
- float pcX = pc.transform.position.x;
- float x = transform.position.x;
- if (pcX > x)
- {
- transform.rotation = Quaternion.Euler(0, 0, 0); - }
- else
- {
- transform.rotation = Quaternion.Euler(0, 180, 0); - }
- }
-
- public virtual void FaceToFacePC()
- {
- PCController pc = PCController.instance;
- transform.rotation = Quaternion.Euler(0, 180, 0) * pc.transform.rotation;
- }
-
-}
\ No newline at end of file |