예제 #1
0
        public static Notice create(float x, float y,
                                    double disappear_time,
                                    MySprite.Kind kind,
                                    MySprite.Type type,
                                    bool blink)
        {
            int cnt = 0;

            while (pool_[pool_index_].alive_)
            {
                ++pool_index_;
                if (pool_index_ >= POOL_MAX)
                {
                    pool_index_ = 0;
                }
                ++cnt;
                if (cnt >= POOL_MAX)
                {
                    Debug.LogError("EXCEED Notice POOL!");
                    break;
                }
            }
            var obj = pool_[pool_index_];

            obj.init(x, y, disappear_time, kind, type, blink);
            return(obj);
        }
예제 #2
0
        public void renderUpdate(int front, ref Vector3 pos, ref Vector2 size, MySprite.Kind kind, Type type)
        {
            if (index_ >= RECT_MAX)
            {
                Debug.LogError("EXCEED sprite POOL!");
                return;
            }
            int sprite_id = (int)kind;

            if (sprite_id >= uv_list_.Length)
            {
                Debug.LogError("VRSprite out of range.");
                return;
            }
            int idx = index_ * 4;

            vertices_[front][idx + 0] = pos;
            vertices_[front][idx + 1] = pos;
            vertices_[front][idx + 2] = pos;
            vertices_[front][idx + 3] = pos;
            float width  = size.x * 0.5f;
            float height = size.y * 0.5f;

            normals_[front][idx + 0] = new Vector3(-width, -height, (float)type);
            normals_[front][idx + 1] = new Vector3(width, -height, (float)type);
            normals_[front][idx + 2] = new Vector3(-width, height, (float)type);
            normals_[front][idx + 3] = new Vector3(width, height, (float)type);
            uvs_[front][idx + 0]     = uv_list_[sprite_id][0];
            uvs_[front][idx + 1]     = uv_list_[sprite_id][1];
            uvs_[front][idx + 2]     = uv_list_[sprite_id][2];
            uvs_[front][idx + 3]     = uv_list_[sprite_id][3];
            ++index_;
        }
예제 #3
0
 public static Notice create(float x, float y,
                             MySprite.Kind kind,
                             MySprite.Type type,
                             bool blink)
 {
     return(create(x, y, -1f /* disappear_time */, kind, type, blink));
 }
예제 #4
0
파일: HUD.cs 프로젝트: xxyzfd/AnotherThread
        public void renderUpdate(int front)
        {
            MySprite.Instance.put(front, ref location_rect_, MySprite.Kind.Location, MySprite.Type.Half);
            MySprite.Instance.put(front, ref maxlockon_rect_, MySprite.Kind.MaxLockon, MySprite.Type.Half);

            // lockon gauge
            int lock_num   = LockTarget.getCurrentLockNum();
            int fired_num  = LockTarget.getCurrentFiredNum();
            int charge_num = lock_num - fired_num;
            int idx        = 0;

            for (var i = 0; i < gauge_rect_L_list_.Length; ++i)
            {
                MySprite.Kind kind = (idx < charge_num ? MySprite.Kind.GaugeRL : MySprite.Kind.GaugeBL);
                MySprite.Instance.put(front, ref gauge_rect_L_list_[i], kind, MySprite.Type.Half);
                ++idx;
            }
            for (var i = 0; i < gauge_rect_M_list_.Length; ++i)
            {
                MySprite.Kind kind = (idx < charge_num ? MySprite.Kind.GaugeRM : MySprite.Kind.GaugeBM);
                MySprite.Instance.put(front, ref gauge_rect_M_list_[i], kind, MySprite.Type.Half);
                ++idx;
            }
            for (var i = 0; i < gauge_rect_S_list_.Length; ++i)
            {
                MySprite.Kind kind = (idx < charge_num ? MySprite.Kind.GaugeRS : MySprite.Kind.GaugeBS);
                MySprite.Instance.put(front, ref gauge_rect_S_list_[i], kind, MySprite.Type.Half);
                ++idx;
            }

            // unitychan
            if (unitychan_width_ratio_ > 0f)
            {
                var rect = new Rect(unitychan_rect_.x,
                                    unitychan_rect_.y,
                                    unitychan_rect_.width * unitychan_width_ratio_,
                                    unitychan_rect_.height * unitychan_height_ratio_);
                MySprite.Instance.put(front, ref rect, unitychan_kind_, MySprite.Type.Full);
            }

            // weapon & damage
            MySprite.Instance.put(front, ref weapon_rect_, MySprite.Kind.Weapon, MySprite.Type.Half);
            if (damage_mark_on_)
            {
                var rect = weapon_rect_;
                rect.x     += damage_mark_position_.x;
                rect.y     += damage_mark_position_.y;
                rect.width  = 32f;
                rect.height = 32f;
                MySprite.Instance.put(front, ref rect, MySprite.Kind.DamageMark, MySprite.Type.GuardMark);
            }
        }
예제 #5
0
 private void init(float x, float y,
                   double disappear_time,
                   MySprite.Kind kind,
                   MySprite.Type type,
                   bool blink)
 {
     base.init();
     x_ = x;
     y_ = y;
     disappear_time_ = disappear_time;
     kind_           = kind;
     type_           = type;
     blink_          = blink;
     blink_time_     = 0f;
     blink_rest_     = 10;
     display_        = true;
 }
예제 #6
0
파일: HUD.cs 프로젝트: Gstavo/AnotherThread
        private IEnumerator unitychan_act()
        {
            float wait_sec;
            for (;;) {
            wait_sec = MyRandom.Range(5f, 15f);
            for (var i = new Utility.WaitForSeconds(wait_sec, update_time_); !i.end(update_time_);) {
                yield return null;
            }
            unitychan_height_ratio_ = 4f/128f;
            for (unitychan_width_ratio_ = 0f;
                 unitychan_width_ratio_ < 1f;
                 unitychan_width_ratio_ += 8f * current_dt_) {
                yield return null;
            }
            unitychan_width_ratio_ = 1f;

            for (;
                 unitychan_height_ratio_ < 1f;
                 unitychan_height_ratio_ += 8f * current_dt_) {
                yield return null;
            }
            unitychan_height_ratio_ = 1f;

            DrawBuffer.SE voice = DrawBuffer.SE.VoiceIkuyo;
            switch (MyRandom.Range(0, 5)) {
                case 0:
                    voice = DrawBuffer.SE.VoiceIkuyo;
                    unitychan_kind_ = MySprite.Kind.UnityChanLaugh;
                    break;
                case 1:
                    voice = DrawBuffer.SE.VoiceUwaa;
                    unitychan_kind_ = MySprite.Kind.UnityChanOuch;
                    break;
                case 2:
                    voice = DrawBuffer.SE.VoiceSorosoro;
                    unitychan_kind_ = MySprite.Kind.UnityChanLaugh;
                    break;
                case 3:
                    voice = DrawBuffer.SE.VoiceOtoto;
                    unitychan_kind_ = MySprite.Kind.UnityChanGrin;
                    break;
                case 4:
                    voice = DrawBuffer.SE.VoiceYoshi;
                    unitychan_kind_ = MySprite.Kind.UnityChanGrin;
                    break;
            }
            SystemManager.Instance.registSound(voice);
            wait_sec = MyRandom.Range(2f, 3f);
            for (var i = new Utility.WaitForSeconds(wait_sec, update_time_); !i.end(update_time_);) {
                yield return null;
            }

            for (;
                 unitychan_height_ratio_ > 4f/128f;
                 unitychan_height_ratio_ -= 8f * current_dt_) {
                yield return null;
            }
            unitychan_height_ratio_ = 4f/128f;
            for (;
                 unitychan_width_ratio_ > 0f;
                 unitychan_width_ratio_ -= 8f * current_dt_) {
                yield return null;
            }
            unitychan_width_ratio_ = 0f;
            }
        }
예제 #7
0
파일: HUD.cs 프로젝트: xxyzfd/AnotherThread
        private IEnumerator unitychan_act()
        {
            float wait_sec;

            for (;;)
            {
                wait_sec = MyRandom.Range(5f, 15f);
                for (var i = new Utility.WaitForSeconds(wait_sec, update_time_); !i.end(update_time_);)
                {
                    yield return(null);
                }
                unitychan_height_ratio_ = 4f / 128f;
                for (unitychan_width_ratio_ = 0f;
                     unitychan_width_ratio_ < 1f;
                     unitychan_width_ratio_ += 8f * current_dt_)
                {
                    yield return(null);
                }
                unitychan_width_ratio_ = 1f;

                for (;
                     unitychan_height_ratio_ < 1f;
                     unitychan_height_ratio_ += 8f * current_dt_)
                {
                    yield return(null);
                }
                unitychan_height_ratio_ = 1f;

                DrawBuffer.SE voice = DrawBuffer.SE.VoiceIkuyo;
                switch (MyRandom.Range(0, 5))
                {
                case 0:
                    voice           = DrawBuffer.SE.VoiceIkuyo;
                    unitychan_kind_ = MySprite.Kind.UnityChanLaugh;
                    break;

                case 1:
                    voice           = DrawBuffer.SE.VoiceUwaa;
                    unitychan_kind_ = MySprite.Kind.UnityChanOuch;
                    break;

                case 2:
                    voice           = DrawBuffer.SE.VoiceSorosoro;
                    unitychan_kind_ = MySprite.Kind.UnityChanLaugh;
                    break;

                case 3:
                    voice           = DrawBuffer.SE.VoiceOtoto;
                    unitychan_kind_ = MySprite.Kind.UnityChanGrin;
                    break;

                case 4:
                    voice           = DrawBuffer.SE.VoiceYoshi;
                    unitychan_kind_ = MySprite.Kind.UnityChanGrin;
                    break;
                }
                SystemManager.Instance.registSound(voice);
                wait_sec = MyRandom.Range(2f, 3f);
                for (var i = new Utility.WaitForSeconds(wait_sec, update_time_); !i.end(update_time_);)
                {
                    yield return(null);
                }

                for (;
                     unitychan_height_ratio_ > 4f / 128f;
                     unitychan_height_ratio_ -= 8f * current_dt_)
                {
                    yield return(null);
                }
                unitychan_height_ratio_ = 4f / 128f;
                for (;
                     unitychan_width_ratio_ > 0f;
                     unitychan_width_ratio_ -= 8f * current_dt_)
                {
                    yield return(null);
                }
                unitychan_width_ratio_ = 0f;
            }
        }