private void HeroWayPointMove()
    {
        if (m_heroUnitType.GetCreatureType().Equals(CommonTypes.MinionTeam.MINION_TEAM_USER_HERO) &&
            m_heroUnitType.GetStatusType().Equals(CommonTypes.StatusType.STATUS_TYPE_PLAY))
        {
            m_wayPoint = m_objectList.GetMapGameObject().GetWayPoint(Center);
            if (m_wayPoint == null)
            {
                return;
            }
        }
        else if (m_heroUnitType.GetCreatureType().Equals(CommonTypes.MinionTeam.MINION_TEAM_ENEMY_HERO) &&
                 m_heroUnitType.GetStatusType().Equals(CommonTypes.StatusType.STATUS_TYPE_PLAY))
        {
            m_wayPoint = m_objectList.GetMapGameObject().GetWayPoint(Center);
            if (m_wayPoint == null)
            {
                return;
            }
        }
        if (m_heroUnitType.GetGameStatusType().Equals(CommonTypes.GameStatusType.GAMESTATUS_TYPE_PAUSE))
        {
            return;
        }

        float   unitMoveSpeed = m_heroUnitObject.GetComponent <HeroUnit_c>().GetUserUnitMoveSpeed();
        Vector3 targetPos     = new Vector3(m_wayPoint.transform.position.x, m_wayPoint.transform.position.y, HoldZ);
        Vector3 movePos       = Vector3.MoveTowards(m_heroUnitObject.transform.position, targetPos, Time.deltaTime * unitMoveSpeed);

        m_heroUnitObject.transform.position = movePos;
    }
Exemple #2
0
    private void WayPointMove(Collider col)
    {
        if (m_unitType.GetCreatureType().Equals(CommonTypes.MinionTeam.MINION_TEAM_USER))
        {
            int userCurWayPointIndex = m_unitObject.GetComponent <Creature_p>().GetUserCurWayPointIndex();
            userCurWayPointIndex++;
            if (userCurWayPointIndex == 5)
            {
                return;
            }
            m_unitObject.GetComponent <Creature_p>().SetUserWayPointIndex(userCurWayPointIndex);
        }

        else if (m_unitType.GetCreatureType().Equals(CommonTypes.MinionTeam.MINION_TEAM_ENEMY))
        {
            int enemyCurWayPoint = m_unitObject.GetComponent <Creature_p>().GetEnemyCurWayPointIndex();
            enemyCurWayPoint--;
            m_unitObject.GetComponent <Creature_p>().SetEnemyWayPointIndex(enemyCurWayPoint);
        }
    }
    private void UnitToWayPointMove()
    {
        if (m_unitType.GetStatusType().Equals(CommonTypes.StatusType.STATUS_TYPE_PLAY))
        {
            if (m_unitType.GetCreatureType().Equals(CommonTypes.MinionTeam.MINION_TEAM_USER))
            {
                int curWayPointIndex = m_unitObject.GetComponent <Creature_p>().GetUserCurWayPointIndex();

                if (curWayPointIndex == -1)
                {
                    curWayPointIndex++;
                    m_unitObject.GetComponent <Creature_p>().SetUserWayPointIndex(curWayPointIndex);
                }
                m_wayPoint = m_objectList.GetMapGameObject().GetWayPoint(curWayPointIndex);
                if (m_wayPoint == null)
                {
                    return;
                }
            }
            else if (m_unitType.GetCreatureType().Equals(CommonTypes.MinionTeam.MINION_TEAM_ENEMY))
            {
                int Enemy_curWayPointIndex = m_unitObject.GetComponent <Creature_p>().GetEnemyCurWayPointIndex();

                if (Enemy_curWayPointIndex == 4)
                {
                    Enemy_curWayPointIndex--;
                    m_unitObject.GetComponent <Creature_p>().SetEnemyWayPointIndex(Enemy_curWayPointIndex);
                }
                m_wayPoint = m_objectList.GetMapGameObject().GetWayPoint(Enemy_curWayPointIndex);
                if (m_wayPoint == null)
                {
                    return;
                }
            }
            Vector3 targetPos = new Vector3(m_wayPoint.transform.position.x, m_wayPoint.transform.position.y, HoldZ);
            Moving(targetPos);
        }
    }
    public bool First_SightColliderCheck()
    {
        if (m_unitType == null || m_colObj == null)
        {
            return(false);
        }
        else if (m_unitType.GetCreatureType().Equals(CommonTypes.MinionTeam.MINION_TEAM_USER) && m_colObj.tag.Equals("Enemy_Sight"))
        {
            // Now is Object User
            m_UserSightList.Add(m_colObj.transform.parent);
            m_unitType.SetStatusType(CommonTypes.StatusType.STATUS_TYPE_PAUSE);
            return(true);
        }
        else if (m_unitType.GetCreatureType().Equals(CommonTypes.MinionTeam.MINION_TEAM_ENEMY) && m_colObj.tag.Equals("User_Sight"))
        {
            // Now is Object Enmey
            m_EnemySighttList.Add(m_colObj.transform.parent);
            m_unitType.SetStatusType(CommonTypes.StatusType.STATUS_TYPE_PAUSE);
            return(true);
        }

        return(true);
    }