コード例 #1
0
    private void OnDisable()
    {
        if (m_CurrentTarget == null)
        {
            return;
        }
        switch (m_CurrentType)
        {
        case eMapPointType.FISH:
            FishAI fish = m_CurrentTarget.GetComponent <FishAI>();
            fish.OnSpawn -= ShowPoint;
            fish.OnDeath -= HidePoint;
            break;

        case eMapPointType.PATROL:
            PatrolAI patrol = m_CurrentTarget.GetComponent <PatrolAI>();
            patrol.OnSpawn -= ShowPoint;
            patrol.OnDeath -= HidePoint;
            break;

        case eMapPointType.FISHVARIANT:
            FishVariantAI fishVariant = m_CurrentTarget.GetComponent <FishVariantAI>();
            fishVariant.OnSpawn -= ShowPoint;
            fishVariant.OnDeath -= HidePoint;
            break;

        case eMapPointType.TANK:
            TankAI tank = m_CurrentTarget.GetComponent <TankAI>();
            tank.OnSpawn -= ShowPoint;
            tank.OnDeath -= HidePoint;
            break;
            //case eMapPointType.PLAYER:
            //    m_CurrentPlayer.OnSpawnBegin -= ShowPoint;
            //    m_CurrentPlayer.OnDeathBegin -= HidePoint;
            //    break;
        }
        UIPanelRadar.Instance.UpdatePoint -= UpdatePosition;
    }
コード例 #2
0
    public void Init(GameObject target, eMapPointType type)
    {
        m_CurrentTarget = target;
        m_CurrentType   = type;
        m_Image         = this.GetComponent <Image>();
        m_Color         = m_Image.color;
        FindRadarCenter();
        CalculatePosition();
        switch (m_CurrentType)
        {
        case eMapPointType.FISH:
            FishAI fish = target.GetComponent <FishAI>();
            fish.OnSpawn += ShowPoint;
            fish.OnDeath += HidePoint;
            break;

        case eMapPointType.PATROL:
            PatrolAI patrol = target.GetComponent <PatrolAI>();
            patrol.OnSpawn += ShowPoint;
            patrol.OnDeath += HidePoint;
            break;

        case eMapPointType.FISHVARIANT:
            FishVariantAI fishVariant = target.GetComponent <FishVariantAI>();
            fishVariant.OnSpawn += ShowPoint;
            fishVariant.OnDeath += HidePoint;
            break;

        case eMapPointType.TANK:
            TankAI tank = target.GetComponent <TankAI>();
            tank.OnSpawn += ShowPoint;
            tank.OnDeath += HidePoint;
            break;
        }
        UIPanelRadar.Instance.UpdatePoint += UpdatePosition;
    }