Esempio n. 1
0
        public override void reportCollision(Object o)
        {
            if (o is Platform)
            {
                if (!hasBeenOnPlatform)
                {
                    engine.setState("textbox", "platform");
                    hasBeenOnPlatform = true;
                }
            }
            if (o is Boat && !onBoat)
            {
                onBoat = true;
                myBoat = (Boat)o;
                myBoat.setMotion(2);
            }

            if (o is DogBoogieman)
            {
                if (!o.getState())
                {
                    proportion = 0;
                }
            }
            if ((o is Ghost) && (!o.getState()))
            {
                damageProportion(0.3);
            }
            if (o is ChalkboardTop)
            {
                if (!readingChalkboard)
                {
                    collideChalkboard = (ChalkboardTop)o;
                    playerChalkboard  = new Chalkboard(0, 0, collideChalkboard.getGate());
                    Game1.updateMiscObjects.Add(playerChalkboard);
                }
                readingChalkboard = true;
            }
            if (o is BoxTop)
            {
                if (!accessingBox)
                {
                    playerBox = ((BoxTop)o).getBox();
                    Game1.updateMiscObjects.Add(playerBox);
                    collideBoxtop = (BoxTop)o;
                }
                accessingBox = true;
            }



            if (o.getSolid())
            {
                //currentlyMove = false;
            }

            base.reportCollision(o);
            if (o is FlowerTentacles && !o.getState())
            {
                //proportion -= 0.001;
                damageProportion(0.2);
            }
            if (o is Item)
            {
                if (o is Diary)
                {
                    engine.setState("textbox", "diaryExposition");
                }
                if (o is Knife)
                {
                    engine.setState("textbox", "knifeExposition");
                }
                if (o is Rose)
                {
                    engine.setState("textbox", "roseExposition");
                }



                pickUp((Item)o);
                Textures.sounds["pickup"].Play();
            }
            if (o is GoodTile)
            {
                if (!state)
                {
                    engine.switchStates();
                }
            }
            if (o is BadTile)
            {
                if (state)
                {
                    engine.switchStates();
                }
            }
            if (o is LockTile)
            {
                if (stateLocked == false)
                {
                    Textures.sounds["lock"].Play();
                }
                stateLocked = true;
                if (!hasBeenLocked)
                {
                    engine.setState("textbox", "shiftLock");
                    hasBeenLocked = true;
                }
            }
            if (o is UnlockTile)
            {
                if (stateLocked == true)
                {
                    Textures.sounds["unlock"].Play();
                }
                stateLocked = false;
            }
            if (o is LevelTile)
            {
                if (this.x == o.getX() && this.y == o.getY())
                {
                    engine.setLevel(((LevelTile)o));
                    //engine.saveGame(((LevelTile)o));
                }
            }
        }
Esempio n. 2
0
        public override void reportCollision(Object o)
        {
            if (o is Platform)
            {
                if(!hasBeenOnPlatform)
                {
                    engine.setState("textbox", "platform");
                    hasBeenOnPlatform = true;
                }

            }
            if (o is Boat && !onBoat)
            {
                onBoat = true;
                myBoat = (Boat)o;
                myBoat.setMotion(2);
            }

            if (o is DogBoogieman)
            {
                if (!o.getState())
                {
                    proportion = 0;
                }
            }
            if ((o is Ghost) && (!o.getState()))
            {
                damageProportion(0.3);
            }
            if(o is ChalkboardTop)
            {

                if(!readingChalkboard)
                {
                    collideChalkboard = (ChalkboardTop)o;
                    playerChalkboard = new Chalkboard(0, 0, collideChalkboard.getGate());
                    Game1.updateMiscObjects.Add(playerChalkboard);
                }
                readingChalkboard = true;

            }
            if(o is BoxTop)
            {
                if(!accessingBox)
                {
                    playerBox = ((BoxTop)o).getBox();
                    Game1.updateMiscObjects.Add(playerBox);
                    collideBoxtop = (BoxTop)o;

                }
                accessingBox = true;
            }

            if(o.getSolid())
            {
                //currentlyMove = false;
            }

            base.reportCollision(o);
            if(o is FlowerTentacles && !o.getState())
            {
                //proportion -= 0.001;
                damageProportion(0.2);
            }
            if (o is Item)
            {
                if(o is Diary)
                {
                    engine.setState("textbox", "diaryExposition");
                }
                if(o is Knife)
                {
                    engine.setState("textbox", "knifeExposition");
                }
                if(o is Rose)
                {
                    engine.setState("textbox", "roseExposition");
                }

                pickUp((Item)o);
                Textures.sounds["pickup"].Play();
            }
            if (o is GoodTile)
            {
                if (!state)
                {
                    engine.switchStates();
                }
            }
            if(o is BadTile)
            {
                if (state)
                {
                    engine.switchStates();
                }
            }
            if (o is LockTile)
            {
                if (stateLocked == false)
                    Textures.sounds["lock"].Play();
                stateLocked = true;
                if(!hasBeenLocked)
                {
                    engine.setState("textbox", "shiftLock");
                    hasBeenLocked = true;
                }

            }
            if(o is UnlockTile)
            {
                if (stateLocked == true)
                    Textures.sounds["unlock"].Play();
                stateLocked = false;

            }
            if(o is LevelTile)
            {
                if(this.x == o.getX() && this.y == o.getY())
                {
                    engine.setLevel(((LevelTile)o));
                    //engine.saveGame(((LevelTile)o));
                }
            }
        }