/// <summary> /// 状態異常除去 /// </summary> private void Remove(FishCondition condition) { this.conditionList.Remove(condition); this.hasConditionBit[1 << (int)condition.type] = false; this.cantMoveBit[1 << (int)condition.type] = false; this.conditionAction -= condition.Update; }
/// <summary> /// 状態異常追加 /// </summary> public void Add(FishCondition condition) { //死んでいるので追加出来ない if (this.HasCondition(FishConditionType.Dead)) { return; } //既に同じ状態異常にかかっているので可能なら上書き if (this.HasCondition(condition.type)) { this.GetCondition(condition.type).Merge(condition); return; } //状態異常追加 this.conditionList.Add(condition); this.hasConditionBit[1 << (int)condition.type] = true; this.cantMoveBit[1 << (int)condition.type] = !condition.canMove; this.conditionAction += condition.Update; //状態異常開始 condition.manager = this; condition.onEnd += this.Remove; condition.Start(); }
/// <summary> /// Merge /// </summary> public override void Merge(FishCondition condition) { var x = condition as FishConditionWithTime; this.maxTime = x.maxTime; this.time = x.time; }
/// <summary> /// Merge /// </summary> public override void Merge(FishCondition condition) { var x = condition as FishConditionSpeedDown; //自分の方が効果が高いので上書き不可 if (this.speedDown > x.speedDown) { return; } //低下率が同値の場合 if (this.speedDown == x.speedDown) { //自分の方が効果時間が長いので上書き不可 if (this.maxTime > x.maxTime && !x.isInfinite) { return; } } //上書き base.Merge(condition); this.isInfinite = x.isInfinite; this.speedDown = x.speedDown; this.manager.fish.moveSpeed = this.CalcMoveSpeed(); }
/// <summary> /// Merge /// </summary> public override void Merge(FishCondition condition) { var x = condition as FishConditionFreezing; //自分の方が効果時間が長いので上書き不可 if (this.time >= x.time) { return; } //上書き base.Merge(condition); }
/// <summary> /// Merge /// </summary> public virtual void Merge(FishCondition condition) { }