Esempio n. 1
0
 protected WorldObject(Player owner, BattleField battfield) 
 {
     this.Owner = owner;
     this.battleField = battfield;
     //fsmMachine = new FSMMachine(this);
     //this.IsSelected = false;
 }
Esempio n. 2
0
 public static void Restart()
 {
     instance = null;
     players = null;
     allEnemies.Clear();
     SceneManager.LoadScene(0, LoadSceneMode.Single);
 }
Esempio n. 3
0
        public Map(BattleField region)
        {
            this.region = region;

            FileLocation fl = FileSystem.Instance.Locate("grad.bit", GameFileLocs.Nature);

            gradMap = new BitTable(32);
            gradMap.Load(fl);

            pathFinder = new PathFinderManager(gradMap);

            fl = FileSystem.Instance.Locate("mapheight.raw", GameFileLocs.Nature);

            heightData = new ushort[HeightMapHeight][];
            ContentBinaryReader br = new ContentBinaryReader(fl);
            for (int i = 0; i < HeightMapHeight; i++)
            {
                heightData[i] = new ushort[HeightMapWidth];
                for (int j = 0; j < HeightMapWidth; j++) 
                {
                    heightData[i][j] = br.ReadUInt16();
                }
            }
            br.Close();
        }
Esempio n. 4
0
 protected override void _OnSceneWasLoaded()
 {
     theField = GameObject.FindObjectOfType<BattleField>();
     if (theField == null)
     {
         Logger.instance.Error("can't found battle field! scene : {0}\n", table.baseid);
         return;
     }
 }
Esempio n. 5
0
        public ManagerController()
        {
            this.playerFactory    = new PlayerFactory();
            this.playerRepository = new PlayerRepository();

            this.cardFactory    = new CardFactory();
            this.cardRepository = new CardRepository();

            this.battleField = new BattleField();
        }
Esempio n. 6
0
        public Vector2 ResistanceForse(Rectangle mesh)
        {
            Entity collision = BattleField.GetInstance().Intersects(mesh);

            if (!object.ReferenceEquals(collision, this) && collision != null)
            {
                return(collision.GetResistenceForce(Position, Direction));
            }
            return(Vector2.Zero);
        }
Esempio n. 7
0
 //Returns true to signal that Battlemanager should pause
 public override bool onTrigger(BattleField state)
 {
     if (interruptScene != null)
     {
         Debug.Log("Interrupt triggered: " + interruptScene.name);
         state.addSceneToQueue(interruptScene);
     }
     triggered = true;
     return(true);
 }
Esempio n. 8
0
    public void SendDamage(Damage dmg)
    {
        Block block = BattleField.GetBlock(dmg.target);

        if (block.linkedBlock != null && block.linkedBlock.GetHeroInfo() != null &&
            block.state == Block.BlockState.Hero)
        {
            block.linkedBlock.GetHeroInfo().parent.RecieveDamage(dmg);
        }
    }
Esempio n. 9
0
        public void Start()
        {
            EventLog.WriteEntry(EventSource, "Opening HttpApiService server.");
            _server.OpenAsync();
            BattleField battleField = new BattleField();

            battleField.WaitForWarriors();
            Console.WriteLine("Both connected");
            battleField.Start();
        }
Esempio n. 10
0
        public override bool OnConditionCheck(Condition condition, ConditionSourceInfo sourceInfo)
        {
            BattleField wintergrasp = Global.BattleFieldMgr.GetBattlefieldByBattleId(BattlefieldIds.WG);

            if (wintergrasp.IsEnabled() && wintergrasp.GetDefenderTeam() == TeamId.Horde)
            {
                return(true);
            }
            return(false);
        }
Esempio n. 11
0
 void DestroyAll()
 {
     Destroy(cardSelect.gameObject);
     cardSelect = null;
     Destroy(myDeck.gameObject);
     myDeck = null;
     Destroy(yourDeck.gameObject);
     yourDeck = null;
     Destroy(battleField.gameObject);
     battleField = null;
 }
        public string Fight(string attackUser, string enemyUser)
        {
            var attacker = players.Players.FirstOrDefault(p => p.Username == attackUser);
            var enemy    = players.Players.FirstOrDefault(p => p.Username == enemyUser);

            BattleField battleField = new BattleField();

            battleField.Fight(attacker, enemy);

            return($"{string.Format(ConstantMessages.FightInfo, attackUser, enemyUser)}");
        }
        public static BattleBaseData CreateInstance(BattleUnit battleUnit, BattleField battleField)
        {
            BattleBaseData item = new BattleBaseData();

            item.hostBattleUnit  = battleUnit;
            item.battleField     = battleField;
            item.ownBattleTeam   = battleUnit.battleTeam;
            item.enemyBattleTeam = battleField.GetBattleTeam(battleUnit, false);

            return(item);
        }
Esempio n. 14
0
        public async void SaveBattleFild(XmlDocument doc)
        {
            var fieldModel = new BattleField {
                Shema = doc
            };

            UnitOfWork.Instance.DbContext.Fields.Add(fieldModel);
            // _dbContext.Fields.Add(fieldModel);
            //  await SaveAsync();
            await UnitOfWork.Instance.DbContext.SaveChangesAsync();
        }
Esempio n. 15
0
        public SceneryObject(BattleField btfld)
            : base(btfld)
        {


            //float lng = sect.GetSingle("Longitude");
            //float lat = sect.GetSingle("Latitude");
            //lng = MathEx.Degree2Radian(lng);
            //lat = MathEx.Degree2Radian(lat);

        }
Esempio n. 16
0
        public string Fight(string attackUser, string enemyUser)
        {
            IPlayer attacker = this.players.Find(attackUser);
            IPlayer enemy    = this.players.Find(enemyUser);

            BattleField battleField = new BattleField();

            battleField.Fight(attacker, enemy);

            return($"Attack user health {attacker.Health} - Enemy user health {enemy.Health}");
        }
        protected virtual Vector3 calcProtecterPos(Vector3 close4)
        {
            BattleField battleField = BattleTaskManager.GetBattleField();
            Vector3     vector      = Vector3.Lerp(this._listBattleShip.get_Item(0).spPointOfGaze, close4, 0.58f);
            float       num         = this._listBattleShip.get_Item(0).get_transform().get_position().x - this._listBattleShip.get_Item(0).spPointOfGaze.x - (this._listBattleShip.get_Item(1).get_transform().get_position().x - this._listBattleShip.get_Item(1).spPointOfGaze.x);
            Vector3     position    = this._listBattleShip.get_Item(0).get_transform().get_position();

            position.y = battleField.seaLevelPos.y;
            position.z = vector.z;
            return(position);
        }
        public string Fight(string attackUser, string enemyUser)
        {
            IPlayer attacker = this.playerRepository.Find(attackUser);
            IPlayer enemy    = this.playerRepository.Find(enemyUser);

            IBattleField battleField = new BattleField();

            battleField.Fight(attacker, enemy);

            return(string.Format(OutputMessages.FightInfo, attacker.Health, enemy.Health));
        }
Esempio n. 19
0
        public string Fight(string attackUser, string enemyUser)
        {
            IPlayer attacker = playerRepository.Find(attackUser);
            IPlayer enemy    = playerRepository.Find(enemyUser);

            BattleField battleField = new BattleField();

            battleField.Fight(attacker, enemy);

            return(result = string.Format(ConstantMessages.FightInfo, attacker.Health, enemy.Health));
        }
Esempio n. 20
0
        public string Fight(string attackUser, string enemyUser)
        {
            IPlayer attacker = playerRepository.Players.FirstOrDefault(x => x.Username == attackUser);
            IPlayer enemy    = playerRepository.Players.FirstOrDefault(x => x.Username == enemyUser);

            BattleField battleField = new BattleField();

            battleField.Fight(attacker, enemy);

            return($"Attack user health {attacker.Health} - Enemy user health {enemy.Health}");
        }
Esempio n. 21
0
 public void MeetEnemyAtBlock(theHero hero, BattleField battle)
 {
     if (hero.getStandBlock().getMob_Count() != 0)
     {
         theBattle b = new theBattle();
         battle.setMyHero(hero);
         battle.setTheMobList(hero.getStandBlock().getMob_list());
         b.Tag = battle;
         b.ShowDialog();
     }
 }
Esempio n. 22
0
 public ChessParty()
 {
     Bat                 = new BattleField(8, 8);
     Round               = 1;
     CurrentPlayer       = Color.White;
     Finished            = false;
     Check               = false;
     VulnerableEnPassant = null;
     pieces              = new HashSet <Piece>();
     captureds           = new HashSet <Piece>();
 }
Esempio n. 23
0
        public BattleBlock(BattleField bfield, UIHost uihost)
        {
            InitializeComponent();
            this.MouseEnter        += new MouseEventHandler(BattleBlock_MouseEnter);
            this.MouseLeave        += new MouseEventHandler(BattleBlock_MouseLeave);
            this.MouseLeftButtonUp += new MouseButtonEventHandler(BattleBlock_MouseLeftButtonUp);
            battleField             = bfield;
            this.uiHost             = uihost;

            ResetColor();
        }
Esempio n. 24
0
        public string Fight(string attackUser, string enemyUser)
        {
            var attackPlayer = this.playerRepo.Find(attackUser);
            var enemyPlayer  = this.playerRepo.Find(enemyUser);
            var battleField  = new BattleField();

            battleField.Fight(attackPlayer, enemyPlayer);
            string result = $"Attack user health {attackPlayer.Health} - Enemy user health {enemyPlayer.Health}";

            return(result);
        }
Esempio n. 25
0
        /// <summary>
        /// Send by client when exited battlefield
        /// </summary>
        //[WorldPacketHandler(ClientOpcodes.BfMgrQueueExitRequest)]
        void HandleBfExitRequest(BFMgrQueueExitRequest bfMgrQueueExitRequest)
        {
            BattleField bf = Global.BattleFieldMgr.GetBattlefieldByQueueId(bfMgrQueueExitRequest.QueueID);

            if (bf == null)
            {
                return;
            }

            bf.AskToLeaveQueue(GetPlayer());
        }
Esempio n. 26
0
 public override bool checkTrigger(BattleField state)
 {
     foreach (CastData d in state.last_enemy_cast)
     {
         if (d.isStun)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 27
0
 // Konstruktor klasy, poza przypisaniem odpowiednich wartości do zmiennych,
 //  wywołuje również metody odpowiedzialne za przygotowanie pola bitwy.
 public BattleArea(int length, int width)
 {
     Length           = length;
     Width            = width;
     ActualBattleArea = new BattleField[Length, Width];
     NextBattleArea   = new BattleField[Length, Width];
     Ratio            = (float)Width / Length;
     SetMap(ActualBattleArea);
     EmptyArea(NextBattleArea);
     MakeFormation();
 }
Esempio n. 28
0
    void OnSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
        _battleField      = FindObjectOfType <BattleField>();
        _battleSystem     = FindObjectOfType <BattleSystem>();

        _battleField.SetupBattleField(_characterDatabase._partyMembersObjects, _characterDatabase._enemyObjects);
        _characterDatabase.InitializeCharacterDatabase(_battleField._playerCharacters);
        _battleSystem.InitializeBattleSystem();

        _characterDatabase.UpdateBattlerCharacterStats();
    }
Esempio n. 29
0
        public void BattleFieldAddThreeShips()
        {
            var battlefield = new BattleField();

            var addShip1 = battlefield.AddShip(new Battleship());
            var addShip2 = battlefield.AddShip(new Destroyer());
            var addShip3 = battlefield.AddShip(new Destroyer());

            Assert.IsTrue(addShip1);
            Assert.IsTrue(addShip2);
            Assert.IsTrue(addShip3);
        }
Esempio n. 30
0
    //Method for processing CastData (most effects now happen in SpellEffects.cs)
    //Called by Cast in the SUCCESS CastStatus case, possibly on BOTCH in the future
    private void processCast(List <CastData> data, SpellData s, List <Transform> noTargetPositions, BattleField.FieldPosition casterPos)
    {
        if (casterPos == BattleField.FieldPosition.PLAYER)
        {
            field.last_player_cast  = data;
            field.last_player_spell = s;
        }
        else if (BattleField.isEnemy(casterPos))
        {
            field.last_enemy_cast  = data;
            field.last_enemy_spell = s;
        }
        uiManager.battle_log.stop();
        float delay = 0;

        foreach (Transform t in noTargetPositions)
        {
            spellEffects.StartCoroutine(spellEffects.noTargetEffects(t, delay));
            //delay += 0.1f;
        }
        if (noTargetPositions.Count > 0 && data.Count == 0)
        {
            AudioPlayer.main.playSFX("sfx_miss");
        }
        //Process the data here
        foreach (CastData d in data)
        {
            spellEffects.StartCoroutine(spellEffects.playEffects(d, s, delay));
            delay += 0.1f;
            if (!d.isHit)
            {
                continue;
            }
            //Learn intel if applicable
            if (d.Target.CasterType == ICasterType.ENEMY)
            {
                EnemyIntel.main.learnIntel(d.Target.Stats.name, d.element);
            }
            else if (d.Caster.CasterType == ICasterType.ENEMY && d.Target.CasterType == ICasterType.PLAYER && d.repel)
            {
                EnemyIntel.main.learnIntel(d.Caster.Stats.name, d.element);
            }
        }
        //Register unregistered keywords here
        bool[] regData = spellDict.safeRegister(spellBook, s);
        if (regData[0] || regData[1] || regData[2])
        {
            StartCoroutine(learnSFX());
        }
        field.last_register = regData;
        //Process regData (for register graphics) here.
        //format is bool [3], where regData[0] is true if s.element is new, regData[1] is true if s.root is new, and regData[2] is true if s.style is new
    }
Esempio n. 31
0
        public AIDecision(BattleField world, AIPlayer player)
        {
            this.world  = world;
            this.player = player;
            this.area   = player.Area;


            helper = new AIDecisionHelper(world);

            area.NewCity  += PlayerArea_NewCity;
            area.LostCity += PlayerArea_RemoveCity;
        }
        public void Defence(string battleFieldId, string robotId, ActionStrength defenceStrength)
        {
            BattleField battleField = BattleFields.GetBattleField(battleFieldId);

            if (battleField.BattleState == BattleState.Running)
            {
                Robot robot = battleField.GetRobot(robotId);

                _robotAction = new RobotActions(robot, defenceStrength);
                new DefenceAction(_robotAction).Execute();
            }
        }
Esempio n. 33
0
    IEnumerator CalculateAICor()
    {
        strategyList.Clear();

        SimBlock[] moveRange = parent.Move.GetMoveRange();

        for (int i = 0; i < moveRange.Length; ++i)
        {
            for (int k = 0; k < 4; ++k)
            {
                if (!moveRange[i].Equals(parent.TemSimpleBlock))                    // do not move to tem block
                {
                    strategyList.Add(new StrategyData(moveRange[i], (Direction)k));
                }
            }
        }

        yield return(new WaitForEndOfFrame());

        for (int k = 0; k < 4; ++k)
        {
            BattleField.StartVirtual();
            for (int i = strategyList.Count / 4 * k; i < strategyList.Count / 4 * (k + 1); ++i)
            {
                int range = parent.GetAttackRangeInTarget(
                    strategyList[i].simBlock,
                    strategyList[i].direction
                    ).Length;
                strategyList [i].SetAttackRange(range);
            }
            BattleField.EndVirtual();
            yield return(new WaitForEndOfFrame());
        }

        while (true)
        {
            BattleField.StartVirtual();

            for (int i = 0; i < SimulationPerFrame; ++i)
            {
                StrategyData data = strategyList[Random.Range(0, strategyList.Count)];
                data.AddResult(GetWinTime(data.simBlock, data.direction, 1));
            }

//			UpdateTarget ();

            BattleField.EndVirtual();

            yield return(new WaitForEndOfFrame());
        }

        Debug.Log("========= End AI ==========");
    }
Esempio n. 34
0
        private void Move_v1(int row, int col, BattleField warrior)
        {
            if ((BattleArea.Ratio * row >= col) && (BattleArea.Width - BattleArea.Ratio * row >= col))
            {
                if (BattleArea.NextBattleArea[row, col + 1] == BattleField.Walkable)
                {
                    BattleArea.NextBattleArea[row, col + 1] = warrior;
                    BattleArea.NextBattleArea[row, col]     = BattleField.Walkable;
                }

                else
                {
                    BattleArea.NextBattleArea[row, col] = warrior;
                }
            }
            else if ((BattleArea.Ratio * row < col) && (BattleArea.Width - BattleArea.Ratio * row > col))
            {
                if (BattleArea.NextBattleArea[row + 1, col] == BattleField.Walkable)
                {
                    BattleArea.NextBattleArea[row + 1, col] = warrior;
                    BattleArea.NextBattleArea[row, col]     = BattleField.Walkable;
                }
                else
                {
                    BattleArea.NextBattleArea[row, col] = warrior;
                }
            }
            else if ((BattleArea.Ratio * row <= col) && (BattleArea.Width - BattleArea.Ratio * row <= col))
            {
                if (BattleArea.NextBattleArea[row, col - 1] == BattleField.Walkable)
                {
                    BattleArea.NextBattleArea[row, col - 1] = warrior;
                    BattleArea.NextBattleArea[row, col]     = BattleField.Walkable;
                }
                else
                {
                    BattleArea.NextBattleArea[row, col] = warrior;
                }
            }
            else if ((BattleArea.Ratio * row > col) && (BattleArea.Width - BattleArea.Ratio * row < col))
            {
                if (BattleArea.NextBattleArea[row - 1, col] == BattleField.Walkable)
                {
                    BattleArea.NextBattleArea[row - 1, col] = warrior;
                    BattleArea.NextBattleArea[row, col]     = BattleField.Walkable;
                }
                else
                {
                    BattleArea.NextBattleArea[row, col] = warrior;
                }
            }
        }
Esempio n. 35
0
    public void Run()
    {
        //将战场的格子密铺(并未连接渲染器),然后创建了两个Team
        singleBattle = BattleFiledCreator.Instance.Create(
            mapSize.x, mapSize.y,
            teamA, teamB);

        //重置摄像头
        ResetBattleCamera();

        //Gird连接渲染器,加载棋子模型,并连接渲染器
        singleBattle.ConnectRenderer(BattleFieldRenderer.Instance);
    }
Esempio n. 36
0
        public GatherCity(BattleField btfld, Player owner, CityType type)
            : base(btfld, owner, type)
        {
            harvester = new Harvester(this, btfld.Map);
            harvester.GotHome += Harv_Home;
            harvester.GotThere += Harv_Dest;

            Harvester.Props hprop = getHarvProps();
            harvester.SetProps(hprop);

            
            if (this.Type == CityType.Oil)
            {
                gatherDistance = RulesTable.OilGatherDistance;
            }
            else if (this.Type == CityType.Green)
            {
                gatherDistance = RulesTable.GreenGatherDistance;
            }
           
        }
Esempio n. 37
0
        public AIDecisionHelper(BattleField world)
        {
            cityDataTable = new Dictionary<City, CityData>(world.CityCount);

            for (int i = 0; i < world.CityCount; i++)
            {
                City cc = world.Cities[i];
                Vector2 myPos = new Vector2(cc.Latitude, cc.Longitude);

                CityData data = new CityData();
                data.city = cc;


                GatherCity gc = cc as GatherCity;

                if (gc != null)
                {
                    data.ResourceCount = gc.GetNearResourceCount();
                }


                //data.NearbyCity = new FastList<City>();
                //for (int j = 0; j < world.CityCount; j++)
                //{
                //    City cc2 = world.GetCity(j);
                //    if (cc != cc2)
                //    {
                //        Vector2 pos = new Vector2(cc2.Latitude, cc2.Longitude);
                //        float dist = Vector2.Distance(pos, myPos);

                //        if (dist < PlayerArea.CaptureDistanceThreshold)
                //        {
                //            data.NearbyCity.Add(cc2);
                //        }
                //    }
                //}
                cityDataTable.Add(cc, data);
            }
        }
Esempio n. 38
0
   protected NaturalResource(BattleField btfld)
       : base(btfld)
   {
 
   }
Esempio n. 39
0
        public ForestObject(BattleField btfld)
            : base(btfld)
        {
           

        }
Esempio n. 40
0
        //public float GetTotalDevelopment()
        //{
        //    float result = 0;
        //    for (int i = 0; i < cities.Count; i++)
        //    {
        //        result += cities[i].Development;
        //    }
        //    return result;
        //}

        public PlayerArea(BattleField region, Player player)
        {
            this.simulator = region;
            this.owner = player;
        }
Esempio n. 41
0
        public AIDecision(BattleField world, AIPlayer player)
        {
            this.world = world;
            this.player = player;
            this.area = player.Area;


            helper = new AIDecisionHelper(world);

            area.NewCity += PlayerArea_NewCity;
            area.LostCity += PlayerArea_RemoveCity;

        }
Esempio n. 42
0
        public OilFieldObject(BattleField btfld)
            : base(btfld)
        {
            frameIdx = Randomizer.GetRandomInt(OilFrameCount - 1);

        }
Esempio n. 43
0
        public GameState(Player[] localPlayer)
        {
            this.battleField = new BattleField();// srcState.Field;
            //PluginFactory = srcState.PluginFactory;

            this.localPlayerArea = new PlayerArea[localPlayer.Length];
            this.localPlayers = localPlayer;


        }
Esempio n. 44
0
        public City(BattleField btfld, Player owner, CityType type)
            : base(owner, btfld)
        {
            this.battleField = btfld;
            this.Type = type;


            BoundingSphere.Radius = CityRadius;
        }
Esempio n. 45
0
 public ProductionCity(BattleField btfld, Player owner, CityType type)
     : base(btfld, owner, type)
 {
     generateRBallTime = ResetGenerateRBallCD(Type);
     generateRBallCD = generateRBallTime;
 }
Esempio n. 46
0
        public SelectionMarker(RenderSystem rs, BattleField btfld, Player player)
            : base(false)
        {
            this.battleField = btfld;
            this.player = player;
            this.linkArrow = new Model[4];
            this.nodeLinks = new Model[BattleField.MaxCities];

            string fileName = "linkarrow.mesh";
            {
                FileLocation fl2 = FileSystem.Instance.Locate(fileName, GameFileLocs.Model);
                ResourceHandle<ModelData> mdlData = ModelManager.Instance.CreateInstance(rs, fl2);
                for (int i = 0; i < linkArrow.Length; i++)
                {
                    linkArrow[i] = new Model(mdlData);                    
                }
                for (int i = 0; i < nodeLinks.Length; i++)
                {
                    nodeLinks[i] = new Model(mdlData);                    
                }
            }
            FileLocation fl = FileSystem.Instance.Locate("citysel_inner.mesh", GameFileLocs.Model);
            inner_marker = new Model(ModelManager.Instance.CreateInstance(rs, fl));

            fl = FileSystem.Instance.Locate("citysel_outter.mesh", GameFileLocs.Model);
            outter_marker = new Model(ModelManager.Instance.CreateInstance(rs, fl));

            BoundingSphere.Radius = float.MaxValue;
            Transformation = Matrix.Identity;
        }
Esempio n. 47
0
 protected WorldObject(BattleField battfield)
 {
     this.battleField = battfield;
     //fsmMachine = new FSMMachine(this);
 }
Esempio n. 48
0
    float mRetryTime; ////----

    void Awake()
    {
        instance = this;
    }