public void LoadResources()
    {
        //Load some landscaping static resources
        groundLeft       = Object.Instantiate(Resources.Load("Prefabs/Solid"), new Vector3(-3.75f, -0.4f, -5.5f), Quaternion.identity) as GameObject;
        groundLeft.name  = "GroundLeft";
        groundRight      = Object.Instantiate(Resources.Load("Prefabs/Solid"), new Vector3(3.75f, -0.4f, -5.5f), Quaternion.identity) as GameObject;
        groundRight.name = "GroundRight";
        river            = Object.Instantiate(Resources.Load("Prefabs/River"), new Vector3(0, -0.81f, -5.5f), Quaternion.identity) as GameObject;
        river.name       = "River";

        //Load important game objects
        boat = new Boat(1);
        Vector3[] priestLandPos = new Vector3[3] {
            new Vector3(-2.9f, 1.1f, -5.5f), new Vector3(-3.4f, 1.1f, -5.5f), new Vector3(-3.9f, 1.1f, -5.5f)
        };
        for (int i = 0; i < 3; i++)
        {
            objPriest[i] = new Priest(i, priestLandPos[i]);
        }
        Vector3[] devilLandPos = new Vector3[3] {
            new Vector3(-4.4f, 1.0f, -5.5f), new Vector3(-4.9f, 1.0f, -5.5f), new Vector3(-5.4f, 1.0f, -5.5f)
        };
        for (int i = 0; i < 3; i++)
        {
            objDevil[i] = new Devil(i, devilLandPos[i]);
        }
        judgement.startTimer();
        //StartCoroutine(waitForOneSecond());
    }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Angel      angel      = new Angel();
            Devil      devil      = new Devil();
            Arbalester arbalester = new Arbalester();
            Lich       lich       = new Lich();

            UnitsStack        stack1      = new UnitsStack(angel, 3);
            UnitsStack        stack2      = new UnitsStack(devil, 3);
            UnitsStack        stack3      = new UnitsStack(arbalester, 3);
            UnitsStack        stack4      = new UnitsStack(lich, 3);
            List <UnitsStack> unitsStacks = new List <UnitsStack>()
            {
                stack1, stack2, stack3, stack4
            };
            Army usArmy = new Army(unitsStacks);
            List <BattleUnitsStack> battleUnitsStacks = new List <BattleUnitsStack>();

            foreach (var stack in usArmy.StacksList)
            {
                battleUnitsStacks.Add(new BattleUnitsStack(stack));
            }
            BattleArmy fbusArmy = new BattleArmy(battleUnitsStacks, "first");
            BattleArmy sbusArmy = new BattleArmy(battleUnitsStacks, "second");
            Battle     game     = new Battle(fbusArmy, sbusArmy);
        }
        public override void OnCast()
        {
            if (CheckSequence())
            {
                double time = DamagingSkill(Caster) * 2;
                if (time > 480)
                {
                    time = 480.0;
                }
                if (time < 120)
                {
                    time = 120.0;
                }

                TimeSpan duration = TimeSpan.FromSeconds(time);

                BaseCreature m_Devil = new Devil();
                m_Devil.ControlSlots = 5;
                SpellHelper.Summon(m_Devil, Caster, 0x216, duration, false, false);
                m_Devil.FixedParticles(0x3728, 8, 20, 5042, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, EffectLayer.Head);
                Server.Misc.Research.ConsumeScroll(Caster, true, spellIndex, false);

                KarmaMod(Caster, ((int)RequiredSkill + RequiredMana));
            }

            FinishSequence();
        }
Esempio n. 4
0
    public void GenGameObjects()
    {
        for (int i = 0; i < 6; i++)
        {
            On_Shore_l [i] = i;
            On_Shore_r [i] = 6;
        }
        for (int i = 0; i < 2; i++)
        {
            On_Boat [i] = 6;
        }

        movetheboat = false;

        Shore_l      = GameObject.CreatePrimitive(PrimitiveType.Cube);
        Shore_l.name = "Shore_l";
        Shore_l.transform.position   = new Vector3(-20f, 0, 0);
        Shore_l.transform.localScale = new Vector3(12f, 4.5f, 0);

        Shore_r      = GameObject.CreatePrimitive(PrimitiveType.Cube);
        Shore_r.name = "Shore_r";
        Shore_r.transform.position   = new Vector3(20f, 0, 0);
        Shore_r.transform.localScale = new Vector3(12f, 4.5f, 0);

        Boat      = GameObject.CreatePrimitive(PrimitiveType.Cube);
        Boat.name = "Boat";
        Boat.transform.position   = new Vector3(-10f, -2.25f, 0);
        Boat.transform.localScale = new Vector3(8f, 0.5f, 4);

        GameObject Priest;
        float      Priest_position_x = -25f;

        for (int i = 0; i < 3; i++)
        {
            Priest = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            Priest.transform.localScale = new Vector3(1, 1, 1);
            Priest.transform.position   = new Vector3(Priest_position_x, 3f, 0);
            Priest_position_x          += 2;
            Priest.AddComponent <On_Off> ();
            Priest.name = i.ToString();
            dp [i]      = Priest;
        }

        GameObject Devil;
        float      Devil_position_x = -19f;

        for (int i = 3; i < 6; i++)
        {
            Devil = GameObject.CreatePrimitive(PrimitiveType.Cube);
            Devil.transform.localScale = new Vector3(1, 1, 1);
            Devil.transform.position   = new Vector3(Devil_position_x, 3f, 0);
            Devil_position_x          += 2;
            Devil.AddComponent <On_Off> ();
            Devil.name = i.ToString();
            dp [i]     = Devil;
        }
    }
Esempio n. 5
0
        public ReadManager(Variables var, Game1 g) // Placement of created instances of object.
        {
            pClass = PlayerClass.Mage;
            List <string> strings = new List <string>();
            StreamReader  sr      = new StreamReader("map.txt");

            while (!sr.EndOfStream)
            {
                strings.Add(sr.ReadLine());
            }
            sr.Close();

            tiles = new Tile[strings[0].Length, strings.Count];
            for (int i = 0; i < tiles.GetLength(0); i++)
            {
                for (int j = 0; j < tiles.GetLength(1); j++)
                {
                    if (strings[j][i] == 'f')
                    {
                        tiles[i, j] = new Tile(var.floor, new Vector2(32 * i, 32 * j), true, var.floorRec);
                        tileList.Add(tiles[i, j]);
                        gameObjects.Add(tiles[i, j]);
                    }
                    else if (strings[j][i] == '-')
                    {
                    }
                    else if (strings[j][i] == 'h')
                    {
                        if (pClass == PlayerClass.Warrior)
                        {
                            warrior = new Warrior(var.hero, new Vector2(32 * i, 32 * j), false, var.heroRec, this, g.Content);
                            heroes.Add(warrior);
                        }
                        else if (pClass == PlayerClass.Mage)
                        {
                            mage = new Mage(var.hero, new Vector2(32 * i, 32 * j), false, var.heroRec, this, g.Content);
                            heroes.Add(mage);
                        }
                    }
                    else if (strings[j][i] == 'g')
                    {
                        green = new Goblin(var.greenMonster, new Vector2(32 * i, 32 * j), false, var.greenMonsterRec, this);
                        monsters.Add(green);
                    }
                    else if (strings[j][i] == 'd')
                    {
                        devil = new Devil(var.greenMonster, new Vector2(32 * i, 32 * j), false, var.greenMonsterRec, this);
                        monsters.Add(devil);
                    }
                }
            }
        }
Esempio n. 6
0
        static void Main()
        {
            try
            {
                Angel      angel      = new Angel();
                Devil      devil      = new Devil();
                Arbalester arbalester = new Arbalester();
                Lich       lich       = new Lich();

                UnitsStack        stack1      = new UnitsStack(angel, 3);
                UnitsStack        stack2      = new UnitsStack(devil, 3);
                UnitsStack        stack3      = new UnitsStack(arbalester, 3);
                UnitsStack        stack4      = new UnitsStack(lich, 3);
                List <UnitsStack> unitsStacks = new List <UnitsStack>()
                {
                    stack1, stack2, stack3, stack4
                };

                Console.WriteLine("list before editing:");
                foreach (var stack in unitsStacks)
                {
                    Console.WriteLine(stack);
                }
                Console.WriteLine("\n\n");


                Army gg = new Army(unitsStacks);
                Console.WriteLine(gg);
                Console.WriteLine("\n\n");

                unitsStacks.Add(new UnitsStack(angel, 9));
                Console.WriteLine("list after editing:");
                foreach (var stack in unitsStacks)
                {
                    Console.WriteLine(stack);
                }
                Console.WriteLine("\n\n");

                Console.WriteLine("army after editing list:");
                Console.WriteLine(gg);

                var ex = gg.StacksList;
                ex.Add(new UnitsStack(angel, 3));
                Console.WriteLine("army after editing got list:");
                Console.WriteLine(gg);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Esempio n. 7
0
        private Mob createMob(Vector2 position, MonsterType typeOfMob)
        {
            Mob mob = null;

            if (typeOfMob == MonsterType.Devil)
            {
                mob = new Devil(content, position, this.ghostsInRange, this.mobDeathFinish, this.collisionCheck);
            }
            else if (typeOfMob == MonsterType.Yeti)
            {
                mob = new Yeti(content, position, this.ghostsInRange, this.mobDeathFinish, this.collisionCheck);
            }
            return(mob);
        }
Esempio n. 8
0
 public void LoadResources()
 {
     //Load Priests and Devils
     for (int i = 0; i < 3; i++)
     {
         Priest p = new Priest(new Vector3(13.5f + i * 1.2f, 3.5f, 0));
         priestsList.Add(p);
         Devil d = new Devil(new Vector3(17.6f + 2f * i, 3.5f, 0));
         devilsList.Add(d);
     }
     // Load river, boat, bank
     river     = new River(River.riverPos);
     boat      = new Boat(Boat.rightBoatPos);
     leftBank  = new Bank(Bank.rightBankPos);
     rightBank = new Bank(Bank.leftBankPos);
 }
Esempio n. 9
0
 public Room(TheGame game)
     : base(game)
 {
     _bullet = new Bullet(Game, this);
     _hero   = new Hero(Game, this, _bullet);
     _hero.OnChestHappened += OnHeroChestHappened;
     _hero.OnLifeFired     += OnHeroLifeFired;
     _hero.OnRoomFinished  += OnHeroRoomFinished;
     _biomass               = new Biomass(Game, this);
     _wall                  = new Wall(Game, this);
     _devil1                = new Devil(Game, this, _hero, DevilNumberEnum.First);
     _devil2                = new Devil(Game, this, _hero, DevilNumberEnum.Second);
     _devil1.OnLifeFired   += OnHeroLifeFired;
     _devil2.OnLifeFired   += OnHeroLifeFired;
     _hero.OnReportPostion += OnCheckCollision;
     Reset();
 }
Esempio n. 10
0
 private void SpawnEnemy()
 {
     if (enemiesCreated != 0 && enemiesCreated % devilSpawnRatio == 0)
     {
         var devil = PoolManager.Instance.GetPool("Devil").GetItem();
         if (devil != null)
         {
             Devil createdDevil = devil.gameObject.GetComponent <Devil>();
             createdDevil.startPosition = ChangeDevilSpawnPosition();
             createdDevil.topLeft       = topLeft;
             createdDevil.downRight     = downRight;
             devil.gameObject.SetActive(true);
         }
     }
     else if (enemiesCreated != 0 && enemiesCreated % juggernautSpawnRatio == 0)
     {
         var juggernaut = PoolManager.Instance.GetPool("Juggernaut").GetItem();
         if (juggernaut != null)
         {
             Juggernaut createdJuggernaut = juggernaut.gameObject.GetComponent <Juggernaut>();
             createdJuggernaut.startPosition = ChangeJuggernautSpawnPosition();
             createdJuggernaut.topLeft       = topLeft;
             createdJuggernaut.downRight     = downRight;
             juggernaut.gameObject.SetActive(true);
         }
     }
     else
     {
         var zombie = PoolManager.Instance.GetPool("Zombie").GetItem();
         if (zombie != null)
         {
             Zombie createdZombie = zombie.gameObject.GetComponent <Zombie>();
             createdZombie.startPosition = ChangeZombieSpawnPosition();
             createdZombie.topLeft       = topLeft;
             createdZombie.downRight     = downRight;
             zombie.gameObject.SetActive(true);
         }
     }
 }
    public void MoveDevil(Devil devil)
    {
        Vector3    destination = devil.getDestination();
        GameObject gameObject  = devil.devil;
        Vector3    startPos    = gameObject.transform.position;
        Vector3    middlePos   = destination;

        if (startPos.y > destination.y)
        {
            middlePos.y = startPos.y;
        }
        else
        {
            middlePos.x = startPos.x;
        }
        SSAction         action1 = CCMoveToAction.GetSSAction(gameObject, middlePos, AnimateSpeed, null);
        SSAction         action2 = CCMoveToAction.GetSSAction(gameObject, destination, AnimateSpeed, null);
        CCSequenceAction action  = CCSequenceAction.GetSSAction(1, 0, new List <SSAction> {
            action1, action2
        }, this);

        addAction(action);
    }
Esempio n. 12
0
 void Awake()
 {
     devilAI = GetComponentInParent <Devil> ();
 }
Esempio n. 13
0
 private void Awake()
 {
     inst = this;
 }
Esempio n. 14
0
        public ReadManager(Variables var, Game1 g, Enums enums) // Placement of created instances of object.
        {
            this.enums   = enums;
            enums.pClass = PlayerClass.Mage;
            im           = new InventoryManager(this);
            List <string> strings = new List <string>();
            StreamReader  sr      = new StreamReader("map.txt");

            while (!sr.EndOfStream)
            {
                strings.Add(sr.ReadLine());
            }
            sr.Close();

            tiles = new Tile[strings[0].Length, strings.Count];
            for (int i = 0; i < tiles.GetLength(0); i++)
            {
                for (int j = 0; j < tiles.GetLength(1); j++)
                {
                    if (strings[j][i] == 'f')
                    {
                        tiles[i, j] = new Tile(var.floor, new Vector2(32 * i, 32 * j), true, var.floorRec);
                        tileList.Add(tiles[i, j]);
                        gameObjects.Add(tiles[i, j]);
                    }
                    else if (strings[j][i] == '-')
                    {
                    }
                    else if (strings[j][i] == 'h')
                    {
                        if (enums.pClass == PlayerClass.Warrior)
                        {
                            warrior = new Warrior(var.hero, new Vector2(32 * i, 32 * j), false, var.heroRec, this, g.Content, var.fakeTextureHero);
                            heroes.Add(warrior);
                        }
                        else if (enums.pClass == PlayerClass.Mage)
                        {
                            mage = new Mage(var.hero, new Vector2(32 * i, 32 * j), false, var.heroRec, this, g.Content, var.fakeTextureHero);
                            heroes.Add(mage);
                        }
                    }
                    else if (strings[j][i] == 'g')
                    {
                        green = new Goblin(var.greenMonster, new Vector2(32 * i, 32 * j), false, var.greenMonsterRec, this);
                        monsters.Add(green);
                    }
                    else if (strings[j][i] == 'd')
                    {
                        devil = new Devil(var.greenMonster, new Vector2(32 * i, 32 * j), false, var.greenMonsterRec, this);
                        monsters.Add(devil);
                    }
                    else if (strings[j][i] == 'c')
                    {
                        chest = new Chests(var.chestClosed, new Vector2(32 * i, 32 * j), false, var.chestRec, im, false, false, var.chestOpen, g);
                        chestList.Add(chest);
                    }
                    else if (strings[j][i] == 'i')
                    {
                        tiles[i, j] = new Tile(var.floor, new Vector2(32 * i, 32 * j), false, var.floorRec);
                        invisibleTiles.Add(tiles[i, j]);
                    }
                    else if (strings[j][i] == 's')
                    {
                        dSpikeTrap = new DynamicSpikeTrap(var.spikeTrapSS, new Vector2(32 * i, (32 * j) + 15), false, var.spikeRec, var.fakeTextureSpike, this);
                        spikeList.Add(dSpikeTrap);
                        dGameObjects.Add(dSpikeTrap);
                    }
                    else if (strings[j][i] == 'r')
                    {
                        rBlock = new RestorationBlock(var.restoFloor, new Vector2(32 * i, 32 * j), true, var.floorRec, this);
                        restoList.Add(rBlock);
                        gameObjects.Add(rBlock);
                    }
                    else if (strings[j][i] == 'l')
                    {
                        lever = new Lever(var.leverTex, new Vector2(32 * i, (32 * j) + 15), false, var.leverRec);
                        leverList.Add(lever);
                        gameObjects.Add(lever);
                    }
                }
            }
        }