Beispiel #1
0
        public void updateFrames(long currentFrameNumber)
        {
            long currentFrame = currentFrameNumber;
            AnimationParametersFrame firstAPFrame = peek();

            for (int j = 0; j < apFramesList.Count; j++)
            {
                AnimationParametersFrame apFrame = apFramesList[j];
                if (apFrame.getFrameNumber() > currentFrame)
                {
                    break;
                }
                if (apFrame != firstAPFrame)
                {
                    for (int i = 0; i < apFrame.size(); i++)
                    {
                        AnimationParameter ap = apFrame.getAnimationParametersList()[i];

                        if (ap.getMask())
                        {
                            firstAPFrame.setValue(i, ap.getValue());
                            firstAPFrame.setMask(i, true);
                        }
                    }

                    apFramesList.RemoveAt(j);
                    j--;
                }
            }
            // add as peek frame
            firstAPFrame.setFrameNumber(currentFrame);

            //apFramesList.Insert (0, firstAPFrame);
        }
Beispiel #2
0
 public void init(int size)
 {
     for (int i = 0; i < size; i++)
     {
         AnimationParameter ap = new AnimationParameter();
         APVector.Add(ap);
         ap.setMask(false);
     }
 }
Beispiel #3
0
        public void afficheFirstFrame()
        {
            AnimationParametersFrame firstAPFrame = peek();
            String strMask  = "";
            String strValue = "";

            for (int i = 0; i < firstAPFrame.size(); i++)
            {
                AnimationParameter ap = firstAPFrame.getAnimationParametersList()[i];
                strMask += ap.getMask() + " ";
                if (ap.getMask())
                {
                    strValue += ap.getValue() + " ";
                }
            }
            Debug.Log("firstAPFrame Mask: \n" + strMask + "\nand value: \n" + strValue);
        }
Beispiel #4
0
        public void addFrame(AnimationParametersFrame apFrame)
        {
            // Debug.Log("addFrame number: " + apFrame.getFrameNumber());
            int  framesListLenght  = apFramesList.Count;
            long numberOfLastFrame = apFramesList[framesListLenght - 1].getFrameNumber();

            if (numberOfLastFrame >= apFrame.getFrameNumber())
            {
                for (int i = framesListLenght - 1; i >= 0; i--)
                {
                    if (apFrame.getFrameNumber() > apFramesList[i].getFrameNumber())
                    {
                        apFramesList.Insert(i + 1, apFrame);
                        break;
                    }
                    if (apFrame.getFrameNumber() == apFramesList[i].getFrameNumber())
                    {
                        for (int j = 0; j < apFrame.size(); j++)
                        {
                            AnimationParameter ap = apFrame.getAnimationParametersList()[j];

                            if (ap.getMask())
                            {
                                apFramesList[i].setValue(j, ap.getValue());
                                apFramesList[i].setMask(j, true);
                            }
                        }
                        //apFramesList [i] = apFrame;
                        break;
                    }
                }
            }
            else
            {
                apFramesList.Add(apFrame);
            }
        }
Beispiel #5
0
        public String AnimationParametersFrame2String(long frameNum)
        {
            String buffer = "";
            String mask   = "";

            buffer = frameNum + " ";

            for (int i = 0; i < APVector.Count; ++i)
            {
                AnimationParameter ap = APVector[i];
                if (ap.getMask())
                {
                    mask   += "1 ";
                    buffer += ap.getValue() + " ";
                }
                else
                {
                    mask += "0 ";
                }
            }
            String apbuffer = mask + "\n" + buffer + "\n";

            return(apbuffer);
        }
Beispiel #6
0
 public void setAnimationParameter(int number, AnimationParameter ap)
 {
     APVector[number].set(ap.getMask(), ap.getValue());
 }
Beispiel #7
0
 protected AnimationParameter copyAnimationParameter(AnimationParameter ap)
 {
     return(new AnimationParameter(ap));
 }