/// <summary> /// 监听buff状态变化回调 /// </summary> /// <param name="iBuffState"></param> /// <param name="buffName"></param> private void CallbackBuffState(IBuffState iBuffState, string buffName) { if (string.Equals(buffName, GameState.Instance.GetFieldName <IBuffState, BuffState>(temp => temp.Jiasu)))//如果是加速 { SetStateListMove(iBuffState.Jiasu, buffName); } if (string.Equals(buffName, GameState.Instance.GetFieldName <IBuffState, BuffState>(temp => temp.Minjie)))//如果是敏捷 { SetStateListMove(iBuffState.Minjie, buffName); } }
void Start() { _rb = GetComponent <Rigidbody2D>(); CenterProcess = GameObject.Find("CenterProcess").GetComponent <CenterProcess>(); _anime = GetComponent <Animator>(); //获取动画 _buffRender = BuffSprite.GetComponent <SpriteRenderer>(); if (gameObject.CompareTag("Monster")) //如果单位的Tag为Monster,则向CenterProcess执行添加怪物数量操作(用于当前怪物数量统计面板) { CenterProcess._monsterCol++; } _internalBuffState = new NormalBuffState(this); //初始化Buff状态 if (IsAvatar) //如果当前无敌开关开启则直接转向无敌Buff状态 { _internalBuffState = new AvatarBuffState(this); } StartCoroutine(BuffDamage()); //初始化计算Buff伤害的协程 }
public void SetBuff(IBuffState state) //设置Buff状态 { this._internalBuffState = state; }