Ejemplo n.º 1
0
    public StateGoriyaBoomerangForward(Goriya _p, GoriyaBoomerang _b, float _speed)
    {
        b     = _b;
        speed = _speed;

        p = _p;
        if (p.current_direction == Direction.NORTH)
        {
            direction_offset = new Vector3(0, 1, 0);
        }
        else if (p.current_direction == Direction.EAST)
        {
            direction_offset = new Vector3(1, 0, 0);
        }
        else if (p.current_direction == Direction.SOUTH)
        {
            direction_offset = new Vector3(0, -1, 0);;
        }
        else if (p.current_direction == Direction.WEST)
        {
            direction_offset = new Vector3(-1, 0, 0);
        }

        b.GetComponent <Rigidbody>().velocity = direction_offset * speed;
    }
Ejemplo n.º 2
0
 public void Update()
 {
     if (timer > 0)
     {
         timer--;
     }
     if (hurtTimer > 0)
     {
         hurtTimer--;
     }
     myState.Update();
     mySprite.Update();
     drawLocation = drawLocation + velocity;
     if (timer <= 0 && myState.currentState != GoriyaStateMachine.CurrentState.spawning)
     {
         timer     = 300;
         boomerang = new GoriyaBoomerang(game, this, myState);
         game.projectileHandler.Add(boomerang);
         throwing       = true;
         myState.moving = false;
     }
     if (health <= 0)
     {
         boomerang.collided = true;
     }
     collisionRectangle.X      = (int)drawLocation.X + HITBOX_OFFSET;
     collisionRectangle.Y      = (int)drawLocation.Y + HITBOX_OFFSET;
     collisionRectangle.Width  = (int)(spriteSize.X * spriteScalar) - HITBOX_SUBTRACT * HITBOX_OFFSET;
     collisionRectangle.Height = (int)(spriteSize.Y * spriteScalar) - HITBOX_SUBTRACT * HITBOX_OFFSET;
     if (myState.currentState != GoriyaStateMachine.CurrentState.dying)
     {
         game.collisionManager.collisionEntities[this] = collisionRectangle;
     }
 }
Ejemplo n.º 3
0
    //Changed this

    public StateGoriyaBoomerangReturning(Goriya _p, GoriyaBoomerang _b, float _speed, GameObject _pickedUpObject = null) {
        b = _b;
        speed = _speed;
        p = _p;
        pickedUpObject = _pickedUpObject;

        b.GetComponent<BoxCollider>().isTrigger = true;
    }
Ejemplo n.º 4
0
    //Changed this

    public StateGoriyaBoomerangReturning(Goriya _p, GoriyaBoomerang _b, float _speed, GameObject _pickedUpObject = null)
    {
        b              = _b;
        speed          = _speed;
        p              = _p;
        pickedUpObject = _pickedUpObject;

        b.GetComponent <BoxCollider>().isTrigger = true;
    }
Ejemplo n.º 5
0
 public EnemyGoriya(ZeldaGame game, Vector2 spawnLocation)
 {
     this.game          = game;
     this.spriteFactory = new GoriyaSpriteFactory(game);
     this.mySprite      = this.spriteFactory.GoriyaIdleDown();
     drawLocation       = spawnLocation;
     myState            = new GoriyaStateMachine(this);
     game.collisionManager.collisionEntities.Add(this, collisionRectangle);
     boomerang         = new GoriyaBoomerang(game, this, myState);
     this.spriteScalar = game.util.spriteScalar;
     health            = health * game.util.difficultyMult;
 }
Ejemplo n.º 6
0
    public StateGoriyaBoomerangForward(Goriya _p, GoriyaBoomerang _b, float _speed) {
        b = _b;
        speed = _speed;

        p = _p;
        if (p.current_direction == Direction.NORTH) {
            direction_offset = new Vector3(0, 1, 0);
        } else if (p.current_direction == Direction.EAST) {
            direction_offset = new Vector3(1, 0, 0);
        } else if (p.current_direction == Direction.SOUTH) {
            direction_offset = new Vector3(0, -1, 0);;
        } else if (p.current_direction == Direction.WEST) {
            direction_offset = new Vector3(-1, 0, 0);
        }

        b.GetComponent<Rigidbody>().velocity = direction_offset * speed;
    }
Ejemplo n.º 7
0
        public static Room RoomParse(Game1 game, string roomID)
        {
            int    i, j, k;
            string grabType;
            int    row;
            int    column;
            string roomTextureID;

            string[] readLine;

            bool              isChestContents = false;
            bool              chestFlag       = false;
            Chest             grabChest       = null;
            string            parsedID        = roomID.Substring(0, 3);
            string            roomFile        = parsedID + ".csv";
            string            roomPath        = Path.Combine(roomCSVPath, roomFile);
            List <INpc>       npcHolder       = new List <INpc>();
            List <IObstacle>  obstacleHolder  = new List <IObstacle>();
            List <IWorldItem> worldItemHolder = new List <IWorldItem>();

            object[] args;
            INpc     goriyaBoomerang1;
            INpc     goriyaBoomerang2;
            INpc     goriyaBoomerang3;
            INpc     topFireball;
            INpc     midFireball;
            INpc     botFireball;

            using (TextFieldParser csvParser = new TextFieldParser(roomPath))
            {
                csvParser.CommentTokens = commentTokens;
                csvParser.SetDelimiters(delimiters);

                //Read first line to grab RoomID for texture
                readLine      = csvParser.ReadFields();
                roomTextureID = readLine[0];

                goriyaBoomerang1 = new GoriyaBoomerang();
                goriyaBoomerang2 = new GoriyaBoomerang();
                goriyaBoomerang3 = new GoriyaBoomerang();
                topFireball      = new Fireball();
                midFireball      = new Fireball();
                botFireball      = new Fireball();

                while (!csvParser.EndOfData)
                {
                    i = 0;
                    j = 0;
                    k = 0;
                    // Read current line fields, pointer moves to the next line.
                    readLine = csvParser.ReadFields();
                    while (i < readLine.Length)
                    {
                        grabType = readLine[i];
                        i++;
                        row = Int32.Parse(readLine[i]);
                        i++;
                        column = Int32.Parse(readLine[i]);

                        float[] coords = RowsColumns.ConvertRowsColumns(row, column);

                        Type resolvedType = Type.GetType(grabType);

                        if (resolvedType == typeof(Goriya))
                        {
                            if (j == 0)
                            {
                                args = new object[] { coords[0], coords[1], (GoriyaBoomerang)goriyaBoomerang1, game };
                            }
                            else if (j == 1)
                            {
                                args = new object[] { coords[0], coords[1], (GoriyaBoomerang)goriyaBoomerang2, game };
                            }
                            else
                            {
                                args = new object[] { coords[0], coords[1], (GoriyaBoomerang)goriyaBoomerang3, game };
                            }
                        }
                        else if (resolvedType == typeof(Boss))
                        {
                            args = new object[] { coords[0], coords[1], (Fireball)topFireball, (Fireball)midFireball, (Fireball)botFireball, game };
                        }
                        else if (resolvedType == typeof(Chest))
                        {
                            chestFlag = true;
                            args      = new object[] { coords[0], coords[1] };
                        }
                        else if (resolvedType == typeof(Gel) || resolvedType == typeof(Bat) || resolvedType == typeof(Skeleton))
                        {
                            args = new object[] { coords[0], coords[1], game };
                        }
                        else
                        {
                            args = new object[] { coords[0], coords[1] };
                        }

                        object grabObj = (Activator.CreateInstance(resolvedType, args));

                        if (grabObj is INpc)
                        {
                            npcHolder.Add((INpc)grabObj);
                            Type npcType = grabObj.GetType();
                            if (npcType == typeof(Goriya))
                            {
                                if (j == 0)
                                {
                                    npcHolder.Add(goriyaBoomerang1);
                                }
                                else if (j == 1)
                                {
                                    npcHolder.Add(goriyaBoomerang2);
                                }
                                else
                                {
                                    npcHolder.Add(goriyaBoomerang3);
                                }
                            }
                            else if (npcType == typeof(Boss))
                            {
                                npcHolder.Add(topFireball);
                                npcHolder.Add(midFireball);
                                npcHolder.Add(botFireball);
                            }

                            Debug.Print("Added NPC");
                        }
                        else if (grabObj is IObstacle)
                        {
                            obstacleHolder.Add((IObstacle)grabObj);
                            Debug.Print("Added Obstacle");
                        }
                        else if (grabObj is IWorldItem && isChestContents)
                        {
                            isChestContents = false;
                            grabChest.putItemInChest((IWorldItem)grabObj);
                            Debug.Print("Added item into Chest");
                        }
                        else if (grabObj is IWorldItem && chestFlag)
                        {
                            grabChest = (Chest)grabObj;
                            worldItemHolder.Add(grabChest);
                            Debug.Print("Added Chest Item");
                        }
                        else if (grabObj is IWorldItem)
                        {
                            worldItemHolder.Add((IWorldItem)grabObj);
                            Debug.Print("Added World Item");
                        }
                        else
                        {
                            Debug.Print("Couldn't finalize interface of Object");
                        }

                        if (chestFlag)
                        {
                            chestFlag       = false;
                            isChestContents = true;
                        }
                        i++;
                        j++;
                        k++;
                    }
                }
            }

            return(new Room(game, npcHolder, obstacleHolder, worldItemHolder, roomTextureID));
        }
Ejemplo n.º 8
0
 public void GoriyaBoomerangAttack(GoriyaBoomerang boomerang)
 {
     boomerang.mySprite = new UniversalSprite(game, enemySpriteSheet, new Rectangle(290, 11, 8, 16), Color.White, SpriteEffects.None, new Vector2(1, 3), enemyLimiter, linkLayerDepth);
 }