Character extends from FreeMovingSprite, adding behavior for movement and inventory. Each character also has an Inventory (all his/her items).
상속: FreeMovingSprite
예제 #1
0
        public FootballField()
            : base()
        {
            roomExclusives = new List<Sprite>();
            fbplayer1 = new Character(11 * TILE_SIZE, 6 * TILE_SIZE);
            fbplayer2 = new Character(11 * TILE_SIZE, 8 * TILE_SIZE);
            fbplayer3 = new Character(11 * TILE_SIZE, 10 * TILE_SIZE);
            fbplayer4 = new Character(11 * TILE_SIZE, 12 * TILE_SIZE);
            fbplayer5 = new Character(11 * TILE_SIZE, 14 * TILE_SIZE);  //offensive line
            fbplayer6 = new Character(9 * TILE_SIZE, 9 * TILE_SIZE);    //qb
            fbplayer7 = new Character(9 * TILE_SIZE, 11 * TILE_SIZE);   //rb
            fbplayer8 = new Character(10 * TILE_SIZE, 4 * TILE_SIZE);   //wr
            fbplayer9 = new Character(10 * TILE_SIZE, 16 * TILE_SIZE);   //wr

            fbplayer10 = new Character(13 * TILE_SIZE, 6 * TILE_SIZE);
            fbplayer11 = new Character(13 * TILE_SIZE, 8 * TILE_SIZE);
            fbplayer12 = new Character(13 * TILE_SIZE, 10 * TILE_SIZE);
            fbplayer13 = new Character(13 * TILE_SIZE, 12 * TILE_SIZE);
            fbplayer14 = new Character(13 * TILE_SIZE, 14 * TILE_SIZE); //d line
            fbplayer15 = new Character(15 * TILE_SIZE, 9 * TILE_SIZE);
            fbplayer16 = new Character(15 * TILE_SIZE, 11 * TILE_SIZE); //lbs
            fbplayer17 = new Character(16 * TILE_SIZE, 4 * TILE_SIZE);
            fbplayer18 = new Character(16 * TILE_SIZE, 16 * TILE_SIZE); //lbs

            football = new FreeMovingSprite(9 * TILE_SIZE, 9 * TILE_SIZE);
            football.setVisible(false);
            coach = new Character(20 * TILE_SIZE, 16 * TILE_SIZE);  //coach

            roomExclusives.Add(fbplayer1);
            roomExclusives.Add(fbplayer2);
            roomExclusives.Add(fbplayer3);
            roomExclusives.Add(fbplayer4);
            roomExclusives.Add(fbplayer5);
            roomExclusives.Add(fbplayer6);
            roomExclusives.Add(fbplayer7);
            roomExclusives.Add(fbplayer8);
            roomExclusives.Add(fbplayer9);
            roomExclusives.Add(fbplayer10);
            roomExclusives.Add(fbplayer11);
            roomExclusives.Add(fbplayer12);
            roomExclusives.Add(fbplayer13);
            roomExclusives.Add(fbplayer14);
            roomExclusives.Add(fbplayer15);
            roomExclusives.Add(fbplayer16);
            roomExclusives.Add(fbplayer17);
            roomExclusives.Add(fbplayer18);
            roomExclusives.Add(football);
            roomExclusives.Add(coach);
        }
예제 #2
0
파일: Hero.cs 프로젝트: ErraticUnicorn/MOSH
 public void loadInteraction(Character c)
 {
     interaction = c.script;
     if (interaction != null)
     {
         current = interaction.getStartingLine();
         say = renewPanelContent();
         cursor = 0;   // puts cursor at top
         scrollTextIndex = 0;
         responseShowPauseTimer = 0.0f;
         advanceArrowFlashTimer = 0.0f;
     }
 }
예제 #3
0
파일: Hero.cs 프로젝트: ErraticUnicorn/MOSH
 /// <summary>
 /// Begins the pickpocketing minigame with the given character as the target
 /// </summary>
 /// <param name="character">The targeted Character</param>
 public void startPickpocket(Character character)
 {
     if (!ppActive)
     {
         ppSystem.randomize();
         ppActive = true;
         ppTarget = character;   //assigns pointer
     }
 }
예제 #4
0
파일: Hero.cs 프로젝트: ErraticUnicorn/MOSH
 public void converse(Character c)
 {
     if (c.script != null)
     {
         dialogue.talking = true;
         dialogue.loadInteraction(c);
         dialogue.end = false;
     }
 }
예제 #5
0
        public static void loadContent(ContentManager content)
        {
            mCharMap = new Dictionary<PersonID, Character>();
            mRoomMap = new Dictionary<PersonID, PlaceID>();

            //initialize all the games characters
            //NOTE: their initial positions are specified in SaveManager's unpackDefaultData class
            Character phil = new Character();
            phil.loadImage(content, Directories.CHARACTERS + "sprite_ffwriter");
            phil.setScript(Directories.INTERACTIONS + "Phil.txt");
            phil.inventory.addItem(Item.PokeBall);
            mCharMap[PersonID.Phil] = phil;

            Character librarian = new Character();
            librarian.loadImage(content, Directories.CHARACTERS_TEMP + "teacher");
            librarian.setScript(Directories.INTERACTIONS + "Librarian.txt");
            mCharMap[PersonID.Librarian] = librarian;

            Character bill = new Character();
            bill.loadImage(content, Directories.CHARACTERS_TEMP + "jock");
            bill.setScript(Directories.INTERACTIONS + "Bill.txt");
            bill.inventory.addItem(Item.SmallDumbell);
            mCharMap[PersonID.Bill] = bill;

            Character artie = new Character();
            artie.loadImage(content, Directories.CHARACTERS_TEMP + "prep");
            artie.setScript(Directories.INTERACTIONS + "Artie.txt");
            artie.inventory.addItem(Item.Cologne);
            mCharMap[PersonID.Artie] = artie;

            Character claude = new Character();
            claude.loadImage(content, Directories.CHARACTERS_TEMP + "slacker");
            claude.setScript(Directories.INTERACTIONS + "Claude.txt");
            claude.inventory.addItem(Item.SomeSubstance);
            mCharMap[PersonID.Claude] = claude;

            Character jay1 = new Character();
            jay1.loadImage(content, Directories.CHARACTERS_TEMP + "bully");
            jay1.setScript(Directories.INTERACTIONS + "Jay1.txt");
            mCharMap[PersonID.Jay1] = jay1;
            Character jay2 = new Character();
            jay2.loadImage(content, Directories.CHARACTERS_TEMP + "bully");
            jay2.setScript(Directories.INTERACTIONS + "Jay2.txt");
            mCharMap[PersonID.Jay2] = jay2;
            Character jay3 = new Character();
            jay3.loadImage(content, Directories.CHARACTERS_TEMP + "bully");
            jay3.setScript(Directories.INTERACTIONS + "Jay3.txt");
            mCharMap[PersonID.Jay3] = jay3;
            Character jay4 = new Character();
            jay4.loadImage(content, Directories.CHARACTERS_TEMP + "bully");
            jay4.setScript(Directories.INTERACTIONS + "Jay4.txt");
            mCharMap[PersonID.Jay4] = jay4;

            Character braceface = new BraceFace();
            braceface.loadContent(content);
            braceface.loadImage(content, Directories.CHARACTERS + "sprite_brace_face_temp");
            braceface.setScript(Directories.INTERACTIONS + "BraceFace.txt");
            braceface.inventory.addItem(Item.PokeBall);
            mCharMap[PersonID.BraceFace] = braceface;

            Character fitz = new Character();
            fitz.loadImage(content, Directories.CHARACTERS_TEMP + "nerd");
            fitz.setScript(Directories.INTERACTIONS + "Fitz.txt");
            fitz.inventory.addItem(Item.PokeBall);
            mCharMap[PersonID.Fitz] = fitz;

            Character rob = new Character();
            rob.loadImage(content, Directories.CHARACTERS_TEMP + "nerd2");
            rob.setScript(Directories.INTERACTIONS + "ROB.txt");
            rob.inventory.addItem(Item.PokeBall);
            mCharMap[PersonID.ROB] = rob;

            Character enforcer = new Character();
            enforcer.loadImage(content, Directories.CHARACTERS + "sprite_enforcer");
            enforcer.setScript(Directories.INTERACTIONS + "Enforcer.txt");
            enforcer.inventory.addItem(Item.LightSaber);
            mCharMap[PersonID.Enforcer] = enforcer;

            Character tyke = new Character();
            tyke.loadImage(content, Directories.CHARACTERS_TEMP + "bully");
            tyke.setScript(Directories.INTERACTIONS + "Tyke.txt");
            tyke.inventory.addItem(Item.LunchMoney);
            mCharMap[PersonID.Tyke] = tyke;

            Character dyke = new Character();
            dyke.loadImage(content, Directories.CHARACTERS_TEMP + "bully2");
            dyke.setScript(Directories.INTERACTIONS + "Dyke.txt");
            dyke.inventory.addItem(Item.LunchMoney);
            mCharMap[PersonID.Dyke] = dyke;

            Character shaq = new Character();
            shaq.loadImage(content, Directories.CHARACTERS_TEMP + "jock");
            shaq.setScript(Directories.INTERACTIONS + "Shaq.txt");
            shaq.inventory.addItem(Item.SmallDumbell);
            mCharMap[PersonID.Shaq] = shaq;

            Character herbert = new Character();
            herbert.loadImage(content, Directories.CHARACTERS + "sprite_herbert_front");
            herbert.setScript(Directories.INTERACTIONS + "Herbert.txt");
            herbert.inventory.addItem(Item.PokeBall);
            mCharMap[PersonID.Herbert] = herbert;

            Character avery = new Character();
            avery.loadImage(content, Directories.CHARACTERS_TEMP + "prep");
            avery.setScript(Directories.INTERACTIONS + "Avery.txt");
            avery.inventory.addItem(Item.Cologne);
            mCharMap[PersonID.Avery] = avery;

            Character boris = new Character();
            boris.loadImage(content, Directories.CHARACTERS_TEMP + "prep2");
            boris.setScript(Directories.INTERACTIONS + "Boris.txt");
            boris.inventory.addItem(Item.Cologne);
            mCharMap[PersonID.Boris] = boris;

            Character jarvis = new Character();
            jarvis.loadImage(content, Directories.CHARACTERS_TEMP + "slacker");
            jarvis.setScript(Directories.INTERACTIONS + "Jarvis.txt");
            jarvis.inventory.addItem(Item.SomeSubstance);
            mCharMap[PersonID.Jarvis] = jarvis;

            Character zeke = new Character();
            zeke.loadImage(content, Directories.CHARACTERS_TEMP + "slacker2");
            zeke.setScript(Directories.INTERACTIONS + "Zeke.txt");
            zeke.inventory.addItem(Item.SomeSubstance);
            mCharMap[PersonID.Zeke] = zeke;
        }
예제 #6
0
 /// <summary>
 /// Ts Character movement in 8 directions; call this method in the Game's update
 /// cycle (AFTER calling KeyboardManager.update())
 /// </summary>
 /// <param name="character">The character to control (presumably main character)</param>
 /// <param name="elapsed">The time that elapsed since the last update</param>
 public static void handleCharacterMovement(Character character, float elapsed)
 {
     nullCheck();
     int dirFlags = 0;
     if (KeyboardManager.isKeyDown(keyTypes[(int)KeyInputType.MoveNorth]))
         dirFlags |= 1;
     if (KeyboardManager.isKeyDown(keyTypes[(int)KeyInputType.MoveSouth]))
         dirFlags |= 2;
     if (KeyboardManager.isKeyDown(keyTypes[(int)KeyInputType.MoveEast]))
         dirFlags |= 4;
     if (KeyboardManager.isKeyDown(keyTypes[(int)KeyInputType.MoveWest]))
         dirFlags |= 8;
     Direction xaxis = Direction.Undefined;
     Direction yaxis = Direction.Undefined;
     if ((dirFlags & 1) > 0 ^ (dirFlags & 2) > 0)
     {
         if ((dirFlags & 1) > 0) yaxis = Direction.North;
         else yaxis = Direction.South;
     }
     if ((dirFlags & 4) > 0 ^ (dirFlags & 8) > 0)
     {
         if ((dirFlags & 4) > 0) xaxis = Direction.East;
         else xaxis = Direction.West;
     }
     if (!xaxis.Equals(Direction.Undefined) && !yaxis.Equals(Direction.Undefined))
     {
         if (yaxis.Equals(Direction.North))
             if (xaxis.Equals(Direction.East))
                 character.move(Direction.NorthEast, elapsed);
             else
                 character.move(Direction.NorthWest, elapsed);
         else
             if (xaxis.Equals(Direction.East))
                 character.move(Direction.SouthEast, elapsed);
             else
                 character.move(Direction.SouthWest, elapsed);
     }
     else if (!xaxis.Equals(Direction.Undefined))
     {
         character.move(xaxis, elapsed);
     }
     else if (!yaxis.Equals(Direction.Undefined))
     {
         character.move(yaxis, elapsed);
     }
 }
예제 #7
0
 /// <summary>
 /// Checks if two Characters are facing each other
 /// </summary>
 /// <param name="other">The other Character</param>
 /// <returns>True if both characters are facing each other, false if not</returns>
 public bool bothFacing(Character other)
 {
     return this.facing(other) && other.facing(this);
 }