예제 #1
0
 /// <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);
 }
예제 #2
0
 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>();
 }
예제 #4
0
        /// <inheritdoc />
        public void RemoveCondition(ITriggerCondition condition, bool desiredState)
        {
            int index = m_Conditions.IndexOf(condition);

            RemoveConditionAt(index);
        }
예제 #5
0
 private void GenerateConditions()
 {
     _triggerCondition = TriggerConditionFactory.Create(condition, CachedTransform, conditionParam);
     _destroyCondition = TriggerConditionFactory.Create(destroyCondition, CachedTransform, destroyConditionParam);
 }
예제 #6
0
파일: Buff.cs 프로젝트: yjq13/Easy_Moba
 public Buff(string buffID)
 {
     m_BuffID         = buffID;
     m_BuffData       = ConfigDataManager.Instance.GetData <BuffData>(ResourceIDDef.GAME_BUFF_CONFIG);
     triggerCondition = BuffConditionFactory.CreateBuffCondition(m_BuffData.TriggerTime);
 }
예제 #7
0
        /// <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);
        }
예제 #8
0
 // Use this for initialization
 void Start()
 {
     triggerConditionRef = condition.GetComponent <ITriggerCondition>();
 }