/// <inheritdoc /> public void AddCondition(ITriggerCondition condition, bool desiredState) { if (m_Conditions.Contains(condition)) { return; } condition.conditionStateChanged.AddListener(OnConditionsChanged); m_Conditions.Add(condition); m_DesiredStates.Add(desiredState); }
private void Awake() { _openCondition = GetComponent <ITriggerCondition>(); _spriteRenderer = GetComponent <SpriteRenderer>(); _animator = GetComponent <MovableDoorAnimator>(); _boxColliders = GetComponents <BoxCollider2D>(); foreach (BoxCollider2D box in _boxColliders) { if (!box.isTrigger && !(box.size.x == 3)) { box.enabled = false; } } }
private void Awake() { _successOutcome = GetComponent <ISuccessOutcome>(); _triggerCondition = GetComponent <ITriggerCondition>(); }
/// <inheritdoc /> public void RemoveCondition(ITriggerCondition condition, bool desiredState) { int index = m_Conditions.IndexOf(condition); RemoveConditionAt(index); }
private void GenerateConditions() { _triggerCondition = TriggerConditionFactory.Create(condition, CachedTransform, conditionParam); _destroyCondition = TriggerConditionFactory.Create(destroyCondition, CachedTransform, destroyConditionParam); }
public Buff(string buffID) { m_BuffID = buffID; m_BuffData = ConfigDataManager.Instance.GetData <BuffData>(ResourceIDDef.GAME_BUFF_CONFIG); triggerCondition = BuffConditionFactory.CreateBuffCondition(m_BuffData.TriggerTime); }
/// <summary> /// 解析条件 /// </summary> /// <param name="triggerType"></param> /// <param name="condition"></param> /// <returns></returns> private static ITriggerCondition ParseCondition(int ID, int triggerType, string condition) { ITriggerCondition triggerCondition = null; if (triggerType == (int)BossAITriggerTypes.BirthOn) { triggerCondition = new BirthOnCondition() { TriggerType = (BossAITriggerTypes)triggerType, }; } else if (triggerType == (int)BossAITriggerTypes.BloodChanged) { triggerCondition = new BloodChangedCondition() { TriggerType = (BossAITriggerTypes)triggerType, }; string[] fields = condition.Split('-'); if (fields.Length != 2) //报错 { LogManager.WriteLog(LogTypes.Error, string.Format("服务器端配置的Boss AI项,条件配置错误 ID={0}", ID)); return(null); } (triggerCondition as BloodChangedCondition).MinLifePercent = Global.SafeConvertToDouble(fields[0]); (triggerCondition as BloodChangedCondition).MaxLifePercent = Global.SafeConvertToDouble(fields[1]); } else if (triggerType == (int)BossAITriggerTypes.Injured) { triggerCondition = new InjuredCondition() { TriggerType = (BossAITriggerTypes)triggerType, }; } else if (triggerType == (int)BossAITriggerTypes.Dead) { triggerCondition = new DeadCondition() { TriggerType = (BossAITriggerTypes)triggerType, }; } else if (triggerType == (int)BossAITriggerTypes.Attacked) { triggerCondition = new AttackedCondition() { TriggerType = (BossAITriggerTypes)triggerType, }; } else if (triggerType == (int)BossAITriggerTypes.DeadAll) { triggerCondition = new AllDeadCondition() { TriggerType = (BossAITriggerTypes)triggerType, }; string[] fields = condition.Split(','); for (int i = 0; i < fields.Length; i++) { (triggerCondition as AllDeadCondition).MonsterIDList.Add(Global.SafeConvertToInt32(fields[i])); } } else if (triggerType == (int)BossAITriggerTypes.LivingTime) { triggerCondition = new LivingTimeCondition() { TriggerType = (BossAITriggerTypes)triggerType, }; (triggerCondition as LivingTimeCondition).LivingMinutes = Global.SafeConvertToInt32(condition); } return(triggerCondition); }
// Use this for initialization void Start() { triggerConditionRef = condition.GetComponent <ITriggerCondition>(); }