コード例 #1
0
        private bool HandleDistanceState(Condition cond, State state, TimeState timeState)
        {
            DistanceState var1 = cond.endConditionState as DistanceState;
            MoveState     var2 = state as MoveState;

            if ((state as MoveState) != null)
            {
                if (var1.hasMoveStateFromSameTerminus(var2))
                {
                    return(Check(var1.GetUpdated(var2), cond.comparison, cond.endConditionState, timeState));
                }
            }
            return(false);
        }
コード例 #2
0
ファイル: Condition.cs プロジェクト: JinkiJung/Tasc-Unity
        public override bool Check(State state, TimeState timeState = null)
        {
            if (endConditionState == null)
            {
                throw new MissingComponentException();
            }

            if (endConditionState.GetType() == typeof(TimeState))
            {
                return(Check(TimeState.GlobalTimer, comparison, endConditionState));
            }
            else if (endConditionState.GetType() == typeof(TaskState))
            {
                TaskState taskState = endConditionState as TaskState;
                //Debug.Log("HandleTaskState : " + Check(new TaskState(taskState.task), cond.endConditionState, cond.comparison));
                return(Check(new TaskState(taskState.task), comparison, endConditionState));
            }
            else if (endConditionState.GetType() == typeof(VariableDistanceState) && state.GetType().IsSubclassOf(typeof(VariableState)))
            {
                VariableDistanceState var1 = endConditionState as VariableDistanceState;
                if ((state as VariableState) != null)
                {
                    VariableState var2 = state as VariableState;
                    return(VariableState.IsSameVariable(var1.stateVar1, var2) ? Check(new VariableDistanceState(var1, var2), comparison, endConditionState, timeState) : false);
                }
                return(false);
            }
            else if (endConditionState.GetType() == typeof(DistanceState))
            {
                DistanceState var1 = endConditionState as DistanceState;
                MoveState     var2 = state as MoveState;
                if ((state as MoveState) != null)
                {
                    return(var1.hasMoveStateFromSameTerminus(var2) ? Check(var1.GetUpdated(var2), comparison, endConditionState, timeState) : false);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(Check(state, comparison, endConditionState, timeState));
            }
        }