コード例 #1
0
ファイル: BlueFire.cs プロジェクト: NXLuan/Megaman
        public override void Update()
        {
            if (forwardBulletAnim.isIgnoreFrame(0) || backBulletAnim.isIgnoreFrame(0))
            {
                setPosX(getPosX() + getSpeedX());
            }
            ParticularObject Object = getGameWorld().particularObjectManager.getCollisionWidthEnemyObject(this);

            base.Update();
        }
コード例 #2
0
 public void RemoveObject(ParticularObject particularObject)
 {
     for (int id = 0; id < particularObjects.Count; id++)
     {
         ParticularObject Object = particularObjects[id];
         if (Object == particularObject)
         {
             particularObjects.RemoveAt(id);
         }
     }
 }
コード例 #3
0
ファイル: BulletManager.cs プロジェクト: NXLuan/Megaman
        public override void UpdateObjects()
        {
            base.UpdateObjects();
            for (int id = 0; id < particularObjects.Count; id++)
            {
                ParticularObject Object = particularObjects[id];

                if (Object.isObjectOutOfCameraView() || Object.getState() == ParticularObject.DEATH)
                {
                    particularObjects.RemoveAt(id);
                }
            }
        }
コード例 #4
0
ファイル: Bullet.cs プロジェクト: NXLuan/Megaman
        public override void Update()
        {
            base.Update();
            setPosX(getPosX() + getSpeedX());
            setPosY(getPosY() + getSpeedY());
            ParticularObject Object = getGameWorld().particularObjectManager.getCollisionWidthEnemyObject(this);

            if (Object != null && Object.getState() == ALIVE)
            {
                setBlood(0);
                Object.beHurt(getDamage());
            }
        }
コード例 #5
0
        public ParticularObject getCollisionWidthEnemyObject(ParticularObject Object)
        {
            for (int id = 0; id < particularObjects.Count; id++)
            {
                ParticularObject objectInList = particularObjects[id];

                if (Object.getTeamType() != objectInList.getTeamType() &&
                    Object.getBoundForCollisionWithEnemy().IntersectsWith(objectInList.getBoundForCollisionWithEnemy()))
                {
                    return(objectInList);
                }
            }
            return(null);
        }
コード例 #6
0
        public virtual void UpdateObjects()
        {
            for (int id = 0; id < particularObjects.Count; id++)
            {
                ParticularObject Object = particularObjects[id];

                if (!Object.isObjectOutOfCameraView())
                {
                    Object.Update();
                }

                if (Object.getState() == ParticularObject.DEATH)
                {
                    particularObjects.RemoveAt(id);
                }
            }
        }
コード例 #7
0
ファイル: GameWorld.cs プロジェクト: NXLuan/Megaman
        public void Update()
        {
            switch (state)
            {
            case INIT_GAME:

                break;

            case TUTORIAL:
                TutorialUpdate();

                break;

            case GAMEPLAY:
                particularObjectManager.UpdateObjects();
                bulletManager.UpdateObjects();

                physicalMap.Update();
                camera.Update();


                if (megaman.getPosX() > finalBossX && finalbossTrigger)
                {
                    finalbossTrigger = false;
                    switchState(TUTORIAL);
                    tutorialState  = MEETFINALBOSS;
                    storyTutorial  = 0;
                    openIntroGameY = 550;

                    boss = new FinalBoss(finalBossX + 700, 460, this);
                    boss.setTeamType(ParticularObject.ENEMY_TEAM);
                    boss.setDirection(ParticularObject.LEFT_DIR);
                    particularObjectManager.addObject(boss);
                }

                if (megaman.getState() == ParticularObject.DEATH)
                {
                    numberOfLife--;
                    if (numberOfLife >= 0)
                    {
                        megaman.setBlood(100);
                        megaman.setPosY(megaman.getPosY() - 50);
                        megaman.setState(ParticularObject.NOBEHURT);
                        particularObjectManager.addObject(megaman);
                    }
                    else
                    {
                        switchState(GAMEOVER);
                        bgMusic.controls.stop();
                    }
                }
                if (!finalbossTrigger && boss.getState() == ParticularObject.DEATH)
                {
                    switchState(GAMEWIN);
                }

                break;

            case GAMEOVER:

                break;

            case GAMEWIN:

                break;
            }
        }
コード例 #8
0
        public override void Update()
        {
            switch (state)
            {
            case ALIVE:
                ParticularObject Object = getGameWorld().particularObjectManager.getCollisionWidthEnemyObject(this);
                if (Object != null)
                {
                    if (Object.getDamage() > 0)
                    {
                        beHurt(Object.getDamage());
                    }
                }
                break;

            case BEHURT:
                if (behurtBackAnim == null)
                {
                    state             = NOBEHURT;
                    startTimeNoBeHurt = nanoTime();
                    if (getBlood() == 0)
                    {
                        state = FEY;
                    }
                }
                else
                {
                    behurtForwardAnim.Update(nanoTime());
                    if (behurtForwardAnim.isLastFrame())
                    {
                        behurtForwardAnim.reset();
                        state = NOBEHURT;
                        if (getBlood() == 0)
                        {
                            state = FEY;
                        }
                        startTimeNoBeHurt = nanoTime();
                    }
                }

                break;

            case FEY:

                state = DEATH;

                break;

            case DEATH:


                break;

            case NOBEHURT:
                if (nanoTime() - startTimeNoBeHurt > timeForNoBeHurt)
                {
                    state = ALIVE;
                }
                break;
            }
        }
コード例 #9
0
 public void addObject(ParticularObject particularObject)
 {
     particularObjects.Add(particularObject);
 }