Ejemplo n.º 1
0
        /// <summary>
        /// Player移动到指定位置
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        private bool OnPlayerMove(OnPlayerMoveMsg msg)
        {
            isSuccess        = false;
            canTurnInfinite  = MissionData.GetLevelTurnInfinite(MissionManager.Instance.mCurLevel, MissionManager.Instance.mCurSubLevel);
            mInitialPosition = msg.mTargetPos;
            if (msg.isMoveDirectly)
            {
                gameObject.transform.position = msg.mTargetPos;
            }
            else
            {
                SetPlayerAngle(msg.mTargetPos - gameObject.transform.position, true);
                gameObject.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 1);
                gameObject.transform.Find("Particle System").transform.gameObject.SetActive(true);
                gameObject.transform.DOMove(msg.mTargetPos, 4.0f).OnComplete(() =>
                {
                    gameObject.GetComponent <BoxCollider2D>().enabled = true;
                    isMoveable = true;
                    mTurnCount = mInitinalTurnCount;
                    UIManager.Instance.SetTurnCountText(mTurnCount - 1);
                    canCountDownTurn           = true;
                    canPlayMoveSound           = true;
                    canDoSuccess               = true;
                    canMove                    = true;
                    canDreaseTurnCount         = false;
                    this.transform.eulerAngles = new Vector3(0, 0, 0);
                    isFlying                   = false;
                    StartCoroutine(CheckAndShowGuidePanel(MissionManager.Instance.mCurSubLevel, 3.0f));
                });
            }
            //小球的初始化位置变为下一个位置

            return(false);
        }
Ejemplo n.º 2
0
 void Start()
 {
     mRg2D            = GetComponent <Rigidbody2D>();
     mInitialPosition = transform.position;
     mInitialRotation = transform.rotation;
     mInitialSpeed    = mMoveSpeed;
     canTurnInfinite  = MissionData.GetLevelTurnInfinite(MissionManager.Instance.mCurLevel, MissionManager.Instance.mCurSubLevel);
     isSuccess        = false;
     StartCoroutine(ShowGamePanel());
     //if (MissionManager.Instance.mCurLevel == 1 && MissionManager.Instance.mCurSubLevel == 1)
     //{
     StartCoroutine(CheckAndShowGuidePanel(MissionManager.Instance.mCurSubLevel, 3.0f));
     //}
 }