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


C# Units.Unit类代码示例

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


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

示例1: getAvailablePassives

        // Gets all the passives available to the profession
        public override List<PassiveInfo> getAvailablePassives(Unit unit)
        {
            // Variables
            List<PassiveInfo>	info=	new List<PassiveInfo>();

            return info;
        }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:8,代码来源:Fisherman.cs

示例2: updateNTCD

        // Updates the stat effect without messing the turn countdown thing
        public void updateNTCD(Unit unit, ref BattleMap map)
        {
            if(effectEvent== null)
                return;

            effectEvent(ref unit, ref map);
        }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:8,代码来源:StatEffect.cs

示例3: weakShock

 // Deals a weak shock to the unit
 public static bool weakShock(ref Unit unit, int x, int y, Trap trap, ref BattleMap map, ref Unit parent)
 {
     if(unit== null)
         return false;
     unit.health-=	8;
     Console.WriteLine("Dealt 8 damage, Unit's hp: "+unit.health);
     return true;
 }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:9,代码来源:Trap.cs

示例4: Trap

        internal static int ntid = 0; // New Trap ID

        #endregion Fields

        #region Constructors

        // --- Constructors ---
        public Trap(ActivateTrapEvent pmTrapEvent, int pmTeamID, string pmName, ref Unit pmParent)
        {
            trapEvent=	pmTrapEvent;
            teamID=	pmTeamID;
            trapID=	Trap.getNextTrapID();
            parent=	pmParent;
            name=	pmName;
        }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:15,代码来源:Trap.cs

示例5: calculateCriticalChance

 // Calculates the critical chance between the two units
 public static float calculateCriticalChance(ref Unit attacker, ref Unit defender)
 {
     return MathHelper.Clamp(
         (((float)(attacker.speed)/2f+((attacker.health< 0.25f*attacker.originalHealth) ? 16f : 1f)-(float)(defender.speed)/4f)-16f)/100f,
         0f,
         1f
     );
 }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:9,代码来源:AttackInfo.cs

示例6: createDefault

        // Creates a new default trap of the given id
        public static Trap createDefault(string id, int teamID, ref Unit parent)
        {
            switch(id.ToLower())
            {
                case "weak_shock":	return new Trap(weakShock, teamID, id, ref parent);
            }

            return new Trap(weakShock, teamID, id, ref parent);
        }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:10,代码来源:Trap.cs

示例7: activate

        // --- Methods ---
        // Activates the trap on the given victim. Returns if actually activated or not
        public bool activate(ref Unit victim, ref BattleMap map)
        {
            if(teamID== map.getTeamID(victim.mapPos))
                return false;
            if(trapEvent== null)
                return false;

            return trapEvent(ref victim, victim.mapPos[0], victim.mapPos[1], this, ref map, ref parent);
        }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:11,代码来源:Trap.cs

示例8: calculateAccuracy

        // Calculates the accuracy between the two units
        public static float calculateAccuracy(ref Unit attacker, ref Unit defender, ref BattleMap map)
        {
            // Variables
            int	adjacentAlliesAttacker=	map.findAllies(defender.mapPos[0], defender.mapPos[1], 1, 1, map.getTeamID(attacker.mapPos)).size;
            int	adjacentAlliesDefender=	map.findAllies(attacker.mapPos[0], attacker.mapPos[1], 1, 1, map.getTeamID(defender.mapPos)).size;
            int	distance=	(defender.level-attacker.level);

            return MathHelper.Clamp((100f-2f*distance-4*adjacentAlliesDefender+4*adjacentAlliesAttacker)/100f, 0f, 1f);
        }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:10,代码来源:AttackInfo.cs

示例9: ai_attackUnit

 // Attacks the unit
 public virtual void ai_attackUnit(Unit unit, BattleMap map, AttackInfo info, bool isUncontrollable)
 {
     map.attackSearch(unit.mapPos[0], unit.mapPos[1], info.range[0], info.range[1]);
     System.Threading.Thread.Sleep(1000);
     map.gstate.attackDecisionGui.open(ref info);
     System.Threading.Thread.Sleep(2500);
     game.gui.close("attack_decision");
     map.gstate.stage=	0;
     map.makeUnitAttack(map.getFullUnitID(unit.mapPos), map.getUnitX(info.defenderID), map.getUnitY(info.defenderID), ref info);
 }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:11,代码来源:Profession.cs

示例10: ai_getTarget

        // Gets the target
        public virtual void ai_getTarget(Unit unit, BattleMap map, bool isUncontrollable, out int[] target, out int[] spotToMoveTo, out AttackInfo info)
        {
            info=	new AttackInfo();
            info.range=	new int[] {1, 1};

            map.aiSearch(unit.mapPos[0], unit.mapPos[1], unit.move, info.range[1], isUncontrollable, map.getTeamID(unit.mapPos), info);

            spotToMoveTo=	map.findAISpot(unit.mapPos[0], unit.mapPos[1], info.range, map.aggressiveAI);
            target=	map.tiles.items[spotToMoveTo[0], spotToMoveTo[1]].t;
            info=	AttackInfo.createBasicAttack(map.getFullUnitID(unit.mapPos), target, ref map);
        }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:12,代码来源:Profession.cs

示例11: update

        // --- Methods ---
        // Updates the stat effect, and returns if the effect should be destroyed or not
        public bool update(Unit unit, ref BattleMap map)
        {
            if(effectEvent== null)
                return true;

            effectEvent(ref unit, ref map);

            turnsLeft--;

            return (turnsLeft== 0);
        }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:13,代码来源:StatEffect.cs

示例12: getAvailableSkills

        // Gets all the skills available to the profession
        public override List<SkillInfo> getAvailableSkills(Unit unit)
        {
            // Variables
            List<SkillInfo>	info=	new List<SkillInfo>();

            info.add(new SkillInfo(
                "Basic Attack",
                "basic_attack",
                "Deals physical attack",
                0
            ));

            return info;
        }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:15,代码来源:Fisherman.cs

示例13: attackUnit

        // Makes the unit attack the given unit, given that unit's coords on the map, the name of the attack, and a reference to the map
        public override bool attackUnit(Unit unit, bool initiatedAttack, ref Unit victim, int x, int y, ref AttackInfo info, ref BattleMap map)
        {
            switch(info.skillID)
            {
                case "basic_attack":
                case "precise_strike":
                case "serpent\'s_sting":
                case "vigilant_strike":
                case "lethal_strike":
                {
                    if(victim== null)
                        break;

                    victim.takeDamage(ref info, ref unit, ref map);
                    unit.mana=	info.projAttackerStats[1];

                    if(!info.missed && unit.isAlive && !unit.isAI)
                        unit.gainExp(ref victim, ref map);
                };return true;

                case "meditation":	{
                    unit.health=	info.projAttackerStats[0];
                    unit.mana=	info.projAttackerStats[1];
                    unit.attack=	info.projAttackerStats[2];
                    unit.originalAttack=	info.projAttackerStats[2];
                };return true;

                case "hone_skill":	{
                    isSkillHoned=	true;
                };return true;

                case "sun\'s_might":	{
                    if(victim== null)
                        break;

                    victim.takeDamage(ref info, ref unit, ref map);
                    unit.health=	Math.Max((int)(unit.health+(0.15f*info.damage)), unit.originalHealth);
                    unit.mana=	Math.Max((int)(info.projAttackerStats[1]+(0.15f*info.damage)), unit.originalMana);

                    if(!info.missed && unit.isAlive && !unit.isAI)
                        unit.gainExp(ref victim, ref map);
                };return true;
            }

            return false;
        }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:47,代码来源:Samurai.cs

示例14: open

        // Opens up the gui
        public void open(ref Unit pmUnit)
        {
            unit=	pmUnit;

            // Unit's name
            name.text=	unit.name;

            // Unit's level
            level.text=	"Lv. "+unit.level;
            level.bounds.X=	game.Window.ClientBounds.Width-24-(int)(level.font.MeasureString(level.text).X);

            // HP
            statsLbl[0].text=	"HP:    "+spaceOutEvenly(unit.health)+"  +"+unit.getStatDifference("hp");
            stats[0].isEnabled=	(unit.statVariance.hp< 12);

            // Mana
            statsLbl[1].text=	"Mana:  "+spaceOutEvenly(unit.mana)+"  +"+unit.getStatDifference("mana");
            stats[1].isEnabled=	(unit.statVariance.mana< 12);

            // Attack
            statsLbl[2].text=	"Atk:   "+spaceOutEvenly(unit.attack)+"  +"+unit.getStatDifference("atk");
            stats[2].isEnabled=	(unit.statVariance.atk< 12);

            // Defense
            statsLbl[3].text=	"Def:   "+spaceOutEvenly(unit.defense)+"  +"+unit.getStatDifference("def");
            stats[3].isEnabled=	(unit.statVariance.def< 12);

            // Magic
            statsLbl[4].text=	"Mag:   "+spaceOutEvenly(unit.magic)+"  +"+unit.getStatDifference("mag");
            stats[4].isEnabled=	(unit.statVariance.mag< 12);

            // Resistance
            statsLbl[5].text=	"Res:   "+spaceOutEvenly(unit.resistance)+"  +"+unit.getStatDifference("res");
            stats[5].isEnabled=	(unit.statVariance.res< 12);

            // Speed
            statsLbl[6].text=	"Spd:   "+spaceOutEvenly(unit.speed)+"  +"+unit.getStatDifference("spd");
            stats[6].isEnabled=	(unit.statVariance.spd< 12);

            // Movement
            statsLbl[7].text=	"Move:  "+spaceOutEvenly(unit.move);
            stats[7].isEnabled=	(unit.statVariance.move< 6);

            game.gui.open("unit_level_up");
        }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:46,代码来源:UnitLevelUpGui.cs

示例15: calculateDamage

        // --- Static Methods ---
        // Calculates the damage between the two units. The percentages must be in between [0f, 1f]
        public static int calculateDamage(ref Unit attacker, ref Unit defender, float atkPerc, float magPerc, float defPerc, float resPerc)
        {
            // Variables
            float	diff=	(attacker.level-defender.level)+1f;
            float	damage=	4f;
            float	datk=	0f;
            float	dmag=	0f;

            if(diff> 0f)
            {
                if(atkPerc> 0f)
                    datk=	Math.Max((attacker.attack*atkPerc)-(defender.defense*defPerc), 0f);
                if(magPerc> 0f)
                    dmag=	Math.Max((attacker.magic*magPerc)-(defender.resistance*resPerc), 0f);
                damage=	(attacker.level+datk+dmag+8f*diff)/4f+4f;
            }

            return (int)(Math.Round(damage));
        }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:21,代码来源:AttackInfo.cs


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