Exemple #1
0
        public void DoMove(Vector3 dir)
        {
            if (m_CanMove)
            {
                m_LastDir = dir;

                Vector3 origin = m_Cube.transform.position;

                RaycastHit outHit;

                //if there isn´t any obstacle, than is possible to move this cube
                if (!Physics.Linecast(origin, origin + dir, out outHit))
                {
                    CubeManager.Instance.RegisterMove(this);

                    CreateSplash();

                    //You can replace with iTween or any tweener you like
                    Tweener.MoveTo(this.gameObject, transform.position, transform.position + dir, m_MoveSpeed, 0, Tweener.TweenerEaseType.EaseOutSine, Complete);

                    return;
                }
            }

            //if is not possible to move, then try to shake it
            DoShake();
        }
Exemple #2
0
        private void DoSlide(Vector3 dir)
        {
            m_LastDir = dir;

            CreateSplash();

            //You can replace with iTween or any tweener you like
            Tweener.MoveTo(this.gameObject, transform.position, transform.position + dir, m_MoveSpeed, 0, Tweener.TweenerEaseType.EaseOutSine, Complete);
        }