当前位置: 首页>>代码示例>>C#>>正文


C# Combatant类代码示例

本文整理汇总了C#中Combatant的典型用法代码示例。如果您正苦于以下问题:C# Combatant类的具体用法?C# Combatant怎么用?C# Combatant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Combatant类属于命名空间,在下文中一共展示了Combatant类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StartThreadToFindTilesInRange

 public void StartThreadToFindTilesInRange(Combatant combatant, MapManager map)
 {
     this.combatant = combatant;
     this.map = map;
     thread = new System.Threading.Thread(FindTilesInRange);
     thread.Start();
 }
开发者ID:Shnagenburg,项目名称:TacticsGame,代码行数:7,代码来源:ThreadedFindTiles.cs

示例2: AddCombatant

    public void AddCombatant(Combatant combatant)
    {
        List<SkillButton> buttons;
        _buttons.TryGetValue(combatant, out buttons);

        if (buttons == null) {
            buttons = new List<SkillButton>();

            foreach (ISkill skill in combatant.Skills) {
                SkillButton newButton = CreateButton(skill);
                buttons.Add(newButton);
            }

            _buttons[combatant] = buttons;
        } else {
            foreach (ISkill skill in combatant.Skills.Except(buttons.Select(b => b.Skill))) {
                SkillButton newButton = CreateButton(skill);
                buttons.Add(newButton);
            }
        }

        if (_combatant == null) {
            _combatant = combatant;
            _page = SetPage(0);
        }
    }
开发者ID:RolandMQuiros,项目名称:Lost-Generation,代码行数:26,代码来源:PlayerSkillTray.cs

示例3: CalcDamage

    double CalcDamage(Combatant attacker, Combatant defender, Attack attack)
    {
        System.Random gen = new System.Random();
        double crit = 1.0;
        double attackPower = 0.0;
        double defensePower = 0.0;

        //does hit
        if(gen.NextDouble() * 100 > (attack.accuracy + attacker.perception))
        {
            return 0.0;
        }
        //is crit

        if(gen.NextDouble()*100 < (0.05+0.02 * attacker.luck))
        {
            crit = 1.5;
        }
        //do damage
        attackPower = attack.power * attacker.strength;
        defensePower = defender.defense + defender.getArmorValue();

        //return

        return (attackPower / defensePower) * crit;
    }
开发者ID:uwgb-socsc,项目名称:FetchQuest,代码行数:26,代码来源:Combat.cs

示例4: ThreadedCalculateAIOrder

 public ThreadedCalculateAIOrder(Combatant combatant, MapManager map)
 {
     this.combatant = combatant;
     this.map = map;
     thread = new System.Threading.Thread(Calculate);
     thread.Start();
 }
开发者ID:Shnagenburg,项目名称:TacticsGame,代码行数:7,代码来源:ThreadedCalculateAIOrder.cs

示例5: OnSkillActivated

    private void OnSkillActivated(Combatant combatant, ISkill skill)
    {
        // Unbind delegates from old skill
        if (_ranged != null) {
            _ranged.TargetChanged -= OnTargetChanged;
        } else if (_directional != null) {
            _directional.DirectionChanged -= OnDirectionChanged;
        }

        // Figure out origin from ActionQueue
        PawnAction lastAction = _combatant.LastAction;
        _origin = (lastAction == null) ? _combatant.Position : lastAction.PostRunPosition;

        // Figure out what kind of skill it is
        _ranged = skill as RangedSkill;
        _directional = skill as DirectionalSkill;

        // Bind delegates to new skill
        if (_ranged != null) {
            _ranged.TargetChanged += OnTargetChanged;
            OnTargetChanged(_ranged.Target);
        } else if (_directional != null) {
            _directional.DirectionChanged += OnDirectionChanged;
            OnDirectionChanged(_directional.Direction);
        }
    }
开发者ID:RolandMQuiros,项目名称:Lost-Generation,代码行数:26,代码来源:SkillView.cs

示例6: ApplyCondition

    /*
    ============================================================================
    Condition functions
    ============================================================================
    */
    public void ApplyCondition(Combatant c)
    {
        if(DataHolder.BattleSystem().IsActiveTime())
        {
            c.timeBar = this.timebar;
            if(c.timeBar > DataHolder.BattleSystem().maxTimebar)
            {
                c.timeBar = DataHolder.BattleSystem().maxTimebar;
            }
        }

        for(int i=0; i<this.setStatus.Length; i++)
        {
            if(this.setStatus[i])
            {
                c.status[i].SetValue(this.status[i], true, false, false);
            }
        }

        for(int i=0; i<this.effect.Length; i++)
        {
            if(SkillEffect.ADD.Equals(this.effect[i]))
            {
                c.AddEffect(i, c);
            }
            else if(SkillEffect.REMOVE.Equals(this.effect[i]))
            {
                c.RemoveEffect(i);
            }
        }
    }
开发者ID:hughrogers,项目名称:RPGQuest,代码行数:36,代码来源:GroupCondition.cs

示例7: StationaryMelee

        public void StationaryMelee()
        {
            Board board = new Board(BoardCommon.GRID_12X8);
            Combatant attacker = new Combatant("Attacker", board, new Point(5, 4));
            Combatant defender = new Combatant("Defender", board, new Point(7, 4));
            board.AddPawn(attacker);
            board.AddPawn(defender);

            attacker.Health = 10;
            defender.Health = 10;

            attacker.BaseStats = new Stats() {
                Attack = 10,
                Stamina = 10
            };

            MeleeAttackSkill attack = new MeleeAttackSkill(attacker, new Point[] { Point.Right, 2 * Point.Right }) {
                ActionPoints = 3
            };
            attack.SetDirection(CardinalDirection.East);

            attacker.AddSkill(attack);
            attack.Fire();

            board.BeginTurn();
            Assert.AreEqual(10, attacker.ActionPoints);

            board.Turn();
            Assert.AreEqual(0, defender.Health);
            Assert.AreEqual(7, attacker.ActionPoints);
        }
开发者ID:RolandMQuiros,项目名称:Lost-Generation,代码行数:31,代码来源:ApproachAndAttackTests.cs

示例8: OnSkillDeactivated

 private void OnSkillDeactivated(Combatant combatant, ISkill skill)
 {
     _gridField.ClearPoints();
     _gridField.RebuildMesh();
     _ranged = null;
     _directional = null;
 }
开发者ID:RolandMQuiros,项目名称:Lost-Generation,代码行数:7,代码来源:SkillView.cs

示例9: MeleeAttackSkill

        /// <summary>
        /// Contruct a new MeleeAttackSkill.
        /// </summary>
        /// <param name="attacker">Reference to Attacking Combatant</param>
        /// <param name="areaOfEffect">
        /// Collection of Point offsets indicating which tiles around the attacker are affected by the attack.
        /// These offsets are rotated based on this skill's Direction attribute, and are defined based on the
        /// attacker facing east.
        /// </param>
        public MeleeAttackSkill(Combatant attacker, IEnumerable<Point> areaOfEffect = null)
            : base(attacker, "Melee Attack", "Attack an adjacent space")
        {
            if (areaOfEffect == null) {
                _areaOfEffect = new List<Point>();
            } else {
                _areaOfEffect = new List<Point>(areaOfEffect);
            }

            for (CardinalDirection d = CardinalDirection.East; d < CardinalDirection.Count; d++) {
                _transforms[d] = new Point[_areaOfEffect.Count];
            }

            for (int i = 0; i < _areaOfEffect.Count; i++) {
                Point east = _areaOfEffect[i];
                Point south = new Point(-east.Y, east.X);
                Point west = new Point(-east.X, -east.Y);
                Point north = new Point(east.Y, -east.X);

                _transforms[CardinalDirection.East][i] = east;
                _transforms[CardinalDirection.South][i] = south;
                _transforms[CardinalDirection.West][i] = west;
                _transforms[CardinalDirection.North][i] = north;

                _fullAreaOfEffect.Add(east);
                _fullAreaOfEffect.Add(south);
                _fullAreaOfEffect.Add(west);
                _fullAreaOfEffect.Add(north);
            }
        }
开发者ID:RolandMQuiros,项目名称:Lost-Generation,代码行数:39,代码来源:MeleeAttackSkill.cs

示例10: MoveAction

 public MoveAction(Combatant owner, Point start, Point end, bool isContinuous)
     : base(owner)
 {
     _start = start;
     _end = end;
     _isContinuous = isContinuous;
 }
开发者ID:RolandMQuiros,项目名称:Lost-Generation,代码行数:7,代码来源:MoveAction.cs

示例11: SquadUnit

 public SquadUnit(Combatant unit)
 {
     Unit = unit;
     Goal = new StateOffset();
     IsManual = true;
     Planner = new Planner(StateOffset.Heuristic);
 }
开发者ID:RolandMQuiros,项目名称:Lost-Generation,代码行数:7,代码来源:PlayerSquadController.cs

示例12: SetCombatant

    public void SetCombatant(Combatant combatant)
    {
        this.combatant = combatant;

        leftPane = CharacterPane.FindLeftPane();
        EnablePane();
        CreateBattleOrder();
    }
开发者ID:Shnagenburg,项目名称:TacticsGame,代码行数:8,代码来源:AIDirector.cs

示例13: BattleAction

 public BattleAction(AttackSelection t, Combatant u, int tID, int id, int ul)
 {
     this.type = t;
     this.user = u;
     this.targetID = tID;
     this.useID = id;
     this.useLevel = ul;
 }
开发者ID:hughrogers,项目名称:RPGQuest,代码行数:8,代码来源:BattleAction.cs

示例14: CharacterController

 public CharacterController(Combatant owner)
 {
     _owner = owner;
     _approachDecision = new Decision.ApproachMeleeRange(_owner);
     _planner.AddDecision(_approachDecision);
     _attackDecision = new Decision.AttackWithMelee(_owner);
     _planner.AddDecision(_attackDecision);
 }
开发者ID:RolandMQuiros,项目名称:Lost-Generation,代码行数:8,代码来源:CharacterPlanner.cs

示例15: Initialize

    public void Initialize(Combatant combatant, BoardGridField gridField)
    {
        _combatant = combatant;
        _combatant.SkillActivated += OnSkillActivated;
        _combatant.SkillDeactivated += OnSkillDeactivated;

        _gridField = gridField;
    }
开发者ID:RolandMQuiros,项目名称:Lost-Generation,代码行数:8,代码来源:SkillView.cs


注:本文中的Combatant类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。