Ejemplo n.º 1
0
        public override bool Tick()
        {
            //Debug.Log("current_frame " + current_frame + " current_node_index " + current_node_index + " pre_node_index " + pre_node_index);

            if (final_path_node == null || final_path_node.Count == 0)
            {
                return(true);
            }

            if (current_frame == frame_at_node[current_node_index])
            {
                ++current_node_index;
                ++pre_node_index;
            }

            // 已经到最后一个陆经点
            if (current_node_index == final_path_node.Count)
            {
                return(true);
            }

            BLIntVector3 next_position = final_path_node[current_node_index];
            BLIntVector3 pre_position  = final_path_node[pre_node_index];

            int frame_span          = frame_at_node[current_node_index] - frame_at_node[pre_node_index];
            int frame_from_pre_node = current_frame - frame_at_node[pre_node_index];

            BLIntVector3 now_position = BLIntVector3.Lerp(pre_position, next_position, frame_from_pre_node, frame_span);

            //Debug.Log("pre_position " + pre_position + " next_position " + next_position + " now_position " + now_position);

            hero_unit.pre_position = hero_unit.position;
            hero_unit.position     = now_position;

            current_dir = (next_position - pre_position).Vector3Value();

            hero_unit.dir = current_dir;

            ++current_frame;

            return(false);
        }
Ejemplo n.º 2
0
        public bool Tick()
        {
            if (remain_frames <= 0)
            {
                EventManager.Instance().PostEvent(EventConfig.EVENT_L2R_BULLET_END, new object[] { bullet_id });

                // 发送销毁子弹粒子的事件
                if (end_call_back != null)
                {
                    end_call_back.Invoke(this);
                }

                return(true);
            }
            else
            {
                pre_position = now_position;
                now_position = BLIntVector3.Lerp(start_postion, end_position, total_frames - remain_frames, total_frames);

                remain_frames--;
            }

            return(false);
        }