Пример #1
0
    /*
     * public void FixedUpdate()
     * {
     *  Dictionary<int, List<BombExplode>> m_bomb_explode = mBombExplodeFactory.mExpectedBomExplodebMap;
     *  foreach (int index in m_bomb_explode.Keys)
     *  {
     *      // bomb_explode 없는 구역은 Defulat
     *      if (!m_bomb_explode.ContainsKey(index))
     *      {
     *          mSpriteMap[index].color = new Color(255, 1, 1, 0);
     *          continue;
     *      }
     *
     *      // bomb_explode life time에 따라 투명도 조절
     *      float life_time = 0;
     *      if (mBombExplodeFactory.GetUrgentBombExplode(index))
     *          life_time = mBombExplodeFactory.GetUrgentBombExplode(index).GetLifeTime();
     *
     *      if (!mSpriteMap.ContainsKey(index)) continue;
     *
     *      WarningColor.a = life_time * 0.5f * WarningTransparent * 0.1f;
     *      mSpriteMap[index].color = WarningColor;
     *  }
     * }
     */

    public void FixedUpdate()
    {
        Dictionary <int, List <BombExplode> > m_bomb_explode = mBombExplodeFactory.mExpectedBomExplodebMap;

        foreach (int index in mSpriteMap.Keys)
        {
            // bomb_explode 없는 구역은 Defulat
            if (!m_bomb_explode.ContainsKey(index))
            {
                mSpriteMap[index].color = new Color(255, 1, 1, 0);
                continue;
            }

            // bomb_explode life time에 따라 투명도 조절
            float life_time = 0;
            if (mBombExplodeFactory.GetUrgentBombExplode(index))
            {
                life_time = mBombExplodeFactory.GetUrgentBombExplode(index).GetLifeTime();
            }

            if (!mSpriteMap.ContainsKey(index))
            {
                continue;
            }

            WarningColor.a          = life_time * 0.5f * WarningTransparent * 0.1f;
            mSpriteMap[index].color = WarningColor;
        }
    }
Пример #2
0
    void AvoidDanger(ref Dictionary <int, float> near_index_list)
    {
        int[] keys = new int[near_index_list.Count];
        near_index_list.Keys.CopyTo(keys, 0);
        int keys_count = keys.Length;

        // Expected Bomb
        for (int i = 0; i < keys_count; ++i)
        {
            BombExplode expected_bomb_explode = mBombExplodeFactory.GetUrgentBombExplode(keys[i]);
            if (expected_bomb_explode != null)
            {
                // Expected Bomb
                // 폭탄 터질 시간 (0 ~ Const.BombLifeTime)
                // life time 늘어날 수록 위험
                near_index_list[keys[i]] -= expected_bomb_explode.GetLifeTime();
            }

            // BombExplode 구간
            BombExplode bomb_explode = mBombExplodeFactory.GetBombExplode(keys[i]);
            if (bomb_explode != null)
            {
                near_index_list[keys[i]] -= Const.BombLifeTime;
            }
        }
    }