religion/Assets/Scripts/DiZang.cs
Roman 83f327571f 任务:搭建基本的系统
1.搭建地藏测试场景
(1.放置单向平台
(2.限制摄像机范围
(3.设置相机跟踪
(4.放置图片素材

2.编写地藏boss逻辑
(1.继承自Enemy(内含基本的变量和事件)
(2.当玩家进入戒备范围,startContinue攻击功能

3.创建塞钱箱脚本
2021-12-08 18:56:47 +08:00

94 lines
2.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Sirenix.OdinInspector;
/// <summary>
/// 地藏Boss类继承于Enemy
/// </summary>
public class DiZang : Enemy
{
// _____ _ _ _
// | __ \ | | | (_)
// | |__) | _| |__ | |_ ___
// | ___/ | | | '_ \| | |/ __|
// | | | |_| | |_) | | | (__
// |_| \__,_|_.__/|_|_|\___|
/// <summary>
/// 攻击之间的间隔时间
/// </summary>
[Header("攻击之间的间隔时间")][FoldoutGroup("地藏")]
public float timeBetweenAttacks;
/// <summary>
/// 塞钱箱
/// </summary>
private MoneyBox moneyBox;
private delegate IEnumerator Action();
private enum PlayerState{,};
private MyPlayer player;
/// <summary>
/// 到底在上面还是下面生成爱欲品的玩家位置Y轴的界限
/// </summary>
[Header("到底在上面还是下面生成爱欲品的玩家位置Y轴的界限")]
public float aiYuPinBuildLimit;
private void Init(){
moneyBox = FindObjectOfType<MoneyBox>();
player = FindObjectOfType<MyPlayer>();
}
protected override void OnFindThePlayer(Transform target){
if(state == State.wander){
state = State.atk;
StartCoroutine("ATK");
}
}
void Start(){
Init();
}
private new IEnumerator ATK(){
//等待攻击间隔
yield return new WaitForSeconds(timeBetweenAttacks);
//决定行动
//如果有钱,则执行拿钱
if(moneyBox.hasMoney)StartCoroutine(TakeTheMoney());
else{
//否则,随机执行召唤或者敲钟
Action action =
((Random.Range(-1f,1f) > 0) ? (Action)RingTheBell : (Action)CallAiYuPin);
StartCoroutine(action());
}
}
/// <summary>
/// 召唤爱欲品的时候Call这个
/// </summary>
private IEnumerator CallAiYuPin(){
yield return new WaitForEndOfFrame();
//确定玩家在上半边还是下半边
PlayerState playerState =
((player.transform.position.y > aiYuPinBuildLimit) ? PlayerState.: PlayerState.);
}
/// <summary>
/// 敲钟的时候Call这个
/// </summary>
private IEnumerator RingTheBell(){
yield return new WaitForEndOfFrame();
Debug.Log("地藏正在敲钟");
}
/// <summary>
/// 拿钱的时候Call这个
/// </summary>
private IEnumerator TakeTheMoney(){
yield return new WaitForEndOfFrame();
Debug.Log("地藏正在拿钱");
}
}