示例#1
0
        void Hovered(SelectionControllerEventArgs args)
        {
            TargetStateType prevState = State;

            TargetStateType newState = TargetStateType.HoveredSolution;

            if (args.IsConflict)
            {
                newState = TargetStateType.HoveredConflicted;
            }

            if (args.IsConflictSolution)
            {
                newState = TargetStateType.HoveredSolution;
            }

            if (newState != prevState)
            {
                all_SynchState(newState.ToString(), Highlighted);
                if (Network.isClient)
                {
                    networkView.RPC("all_SynchState", RPCMode.Others, newState.ToString(), Highlighted);
                }

                //only client and standalone
                if (!Network.isServer)
                {
                    if (prevState != TargetStateType.HoveredSolution && prevState != TargetStateType.HoveredConflicted)
                    {
                        NotifyEventListeners(SelectionEventArgs.SelectionEventType.Hovered, args);
                    }
                }
            }
        }
示例#2
0
        void all_SynchState(string state, bool hl)
        {
            State       = (TargetStateType)System.Enum.Parse(typeof(TargetStateType), state);
            highlighted = hl;

            if (inFeedback)
            {
                return;
            }

            Color additional = Color.black;

            if (highlighted)
            {
                additional = HighlightedColor;
            }

            switch (State)
            {
            case TargetStateType.HoveredSolution:
                renderer.material.SetColor(ColorField, HoveredColor + additional);
                break;

            case TargetStateType.HoveredConflicted:
                renderer.material.SetColor(ColorField, ConflictedColor + additional);
                break;

            case TargetStateType.Normal:
            default:
                renderer.material.SetColor(ColorField, Highlighted ? HighlightedColor : BaseColor);
                break;
            }
        }
示例#3
0
        void NotHovered(SelectionControllerEventArgs args)
        {
            TargetStateType newState = TargetStateType.Normal;

            all_SynchState(newState.ToString(), Highlighted);
            if (Network.isClient)
            {
                networkView.RPC("all_SynchState", RPCMode.Others, newState.ToString(), Highlighted);
            }

            //only client and standalone
            if (!Network.isServer)
            {
                NotifyEventListeners(SelectionEventArgs.SelectionEventType.Unhovered, args);
            }
        }
示例#4
0
    public static bool CheckTargetInImpactExcept(GameObject target, SkillImpactInfos impacts)
    {
        TargetStateType stateType = GetTargetStateType(target);

        if (impacts != null && impacts.ExceptTargetState != null && impacts.ExceptTargetState.Count > 0)
        {
            foreach (TargetStateType tState in impacts.ExceptTargetState)
            {
                if (stateType == tState)
                {
                    return(true);
                }
            }
        }
        return(false);
    }
示例#5
0
    public static ImpactInfo ExtractBestImpactInfo(GameObject target, SkillImpactInfos impacts)
    {
        TargetStateType stateType = GetTargetStateType(target);

        if (impacts == null || CheckTargetInImpactExcept(target, impacts))
        {
            return(null);
        }
        if (impacts.ImpactList != null && impacts.ImpactList.Count > 0)
        {
            foreach (SkillImpactInfoData data in impacts.ImpactList)
            {
                if (data != null && data.TargetStateType == stateType)
                {
                    return(data.ImpactInfo);
                }
            }
        }
        return(impacts.ImpactDefault);
    }
 private void OnTargetUp()
 {
     TargetState = TargetStateType.Idle;
     TargetTargetJoint.enabled = false;
 }
 private void OnTargetDown()
 {
     TargetState = TargetStateType.Move;
     TargetTargetJoint.enabled = true;
 }