Ejemplo n.º 1
0
        public override bool ChangeState()
        {
            var rayList = Utilities.instance.CreateRays(m_Character.position,
                                                        m_Handler.velocity.normalized, RAY_ANGLE, RAY_COUNT);

            foreach (Ray2D ray in rayList)
            {
                RaycastHit2D[] hits = Physics2D.RaycastAll(ray.origin, ray.direction,
                                                           RAY_LENGTH, m_ObstacleMask);    //, 1 << NameManager.instance.ObstacleMask);


                if (Utilities.instance.IsDebug)
                {
                    Debug.DrawLine(ray.origin, ray.origin + ray.direction * RAY_LENGTH, Color.red);
                }

                foreach (var hit in hits)
                {
                    if (hit.transform.GetInstanceID() != m_Character.GetInstanceID())
                    {
                        Debug.Log(SCRIPT_NAME + ": switching state to: " + goToState);
                        m_Controller.SetTransistion(transition);
                        return(true);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        public override bool ChangeState()
        {
            if (!CloseToObject(m_Target.position, m_Character.position, m_Range))                // Player not in  range.
            {
                Debug.Log(SCRIPT_NAME + ": switching state to: " + goToState);
                m_Controller.SetTransistion(transition);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 3
0
        public override bool ChangeState()
        {
            if (Utilities.instance.LayerInPath(m_Target.position, m_Character.position, m_ObstacleMask))
            {
                Debug.Log(SCRIPT_NAME + ": switching state to: " + goToState);
                m_Controller.SetTransistion(transition);
                return(true);
            }

            return(false);
        }