Beispiel #1
0
 public ControlMode(ControlModeEnum type, Action <Hex> onMouseOver, Action onMouseNotOverMap, Action <Hex> onLeftClick, Action <Hex> onRightClick, Action onTabPressed, Action onEnteringMode, Action onLeavingMode, bool autoOnly, Func <bool> checkValidity = null)
 {
     this.type              = type;
     this.onMouseOver       = onMouseOver;
     this.onMouseNotOverMap = onMouseNotOverMap;
     this.onLeftClick       = onLeftClick;
     this.onRightClick      = onRightClick;
     this.onTabPressed      = onTabPressed;
     this.onEnteringMode    = onEnteringMode;
     this.onLeavingMode     = onLeavingMode;
     this.AutoOnly          = autoOnly;
     this.CheckValidity     = checkValidity;
 }
    IEnumerator Action(Action <float> a, float time)
    {
        a(time);

        //disable buttons

        //here is where you might move the camera, start an animation etc.

        yield return(new WaitForSeconds(time));

        ControlModeType = ControlModeEnum.Move;
        SelectNext(this.Selected);
    }
Beispiel #3
0
        /// <summary>
        /// 解析処理
        /// </summary>
        /// <param name="data">解析対象バイト配列</param>
        /// <param name="startIndex">解析開始インデックス</param>
        /// <returns>解析済みインデックス</returns>
        public override int Analyze(byte[] data, int startIndex)
        {
            int retVal = 0;
            int index  = startIndex;

            int value = BitConverter.ToInt32(data, index);

            this.State = (ControlModeEnum)value;
            index     += sizeof(int);

            retVal = index;

            return(retVal);
        }
    public void ThrowToTarget(float time)
    {
        TargetSelectorMode <ICatcher> tsm = ((TargetSelectorMode <ICatcher>)currentControlMode);

        ICatcher        currentTarget = tsm.CurrentTarget;
        List <ICatcher> targets       = tsm.Targets;

        if (currentTarget != null)
        {
            ICatcher catcher = (ICatcher)currentTarget;

            if (targets.Contains(catcher))
            {
                selected.Ball.RegisterOnFinishedLaunch(() => {
                    ControlModeType = ControlModeEnum.Move;
                });

                selected.Ball.ThrowToCatcher(selected, catcher, tsm.TargetProbabilities[catcher], time);
            }
        }
    }