コード例 #1
0
ファイル: Trap.cs プロジェクト: pgonzbecer/Conquest
 // 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;
 }
コード例 #2
0
ファイル: Tile.cs プロジェクト: pgonzbecer/Conquest
 // --- Constructors ---
 public Tile(GameExt pmGame, Vector3 pmPos, ref BattleMap pmMap)
     : base(pmGame, pmGame.models.get("tile"), pmPos)
 {
     texture=	game.textures.get(getTextureName());
     unitID=	new int[]	{-1, -1};
     startZoneID=	-1;
     map=	pmMap;
     pos-=	new Vector3(-Tile.size/2f, 0f, Tile.size/2f);
     bounds=	new float[]	{
         pmPos.X, pmPos.X+Tile.size,
         pmPos.Z-Tile.size, pmPos.Z
     };
     trap=	null;
     color=	getNormalColor();
 }
コード例 #3
0
ファイル: Item.cs プロジェクト: pgonzbecer/Conquest
 // Called when the unit is being to set down a trap
 public virtual Trap onSetTrap(Profession pref, ref Unit unit, int x, int y, ref Trap trap, ref BattleMap map)
 {
     return trap;
 }
コード例 #4
0
ファイル: Item.cs プロジェクト: pgonzbecer/Conquest
 // Called when the unit has set's off the trap
 public virtual bool onSetOffTrap(Profession prof, ref Unit unit, ref Unit parent, int x, int y, bool canSetOff, ref Trap trap, ref BattleMap map)
 {
     return canSetOff;
 }
コード例 #5
0
ファイル: BattleMap.cs プロジェクト: pgonzbecer/Conquest
        // Finds if setting of traps cannot set down the trap
        private bool trap_canStopSet(ref int x, ref int y, ref int radius, ref int maxRadius, ref Trap trap)
        {
            if(trap== null)
                return true;
            if(x< 0 || x>= tiles.width)
                return true;
            if(y< 0 || y>= tiles.height)
                return true;
            if(radius> maxRadius)
                return true;
            if(tiles.items[x, y].item== null)
                return true;
            if(tiles.items[x, y].item.trap!= null)
                return true;
            if(tiles.items[x, y].path< radius && tiles.items[x, y].path!= -1)
                return true;

            return false;
        }
コード例 #6
0
ファイル: BattleMap.cs プロジェクト: pgonzbecer/Conquest
        // Does a dijkstra algorithm to set down a trap. Use attack search to get where to set down your trap
        private void p_setTrap(int x, int y, int radius, ref int maxRadius, ref Trap trap, ref int teamID, ref int unitID)
        {
            if(trap_canStopSet(ref x, ref y, ref radius, ref maxRadius, ref trap))
                return;

            tiles.items[x, y].path=	radius;
            if(teamID!= -1 && unitID!= -1)
                tiles.items[x, y].item.trap=	(teams.items[teamID].units.items[unitID].onSetTrap(x, y, ref trap, this)).clone();
            else
                tiles.items[x, y].item.trap=	trap.clone();

            p_setTrap(x, y+1, radius+1, ref maxRadius, ref trap, ref teamID, ref unitID);
            p_setTrap(x+1, y, radius+1, ref maxRadius, ref trap, ref teamID, ref unitID);
            p_setTrap(x, y-1, radius+1, ref maxRadius, ref trap, ref teamID, ref unitID);
            p_setTrap(x-1, y, radius+1, ref maxRadius, ref trap, ref teamID, ref unitID);
        }
コード例 #7
0
ファイル: BattleMap.cs プロジェクト: pgonzbecer/Conquest
 public void setTrap(int[] unitID, int x, int y, int radius, Trap trap)
 {
     p_setTrap(x, y, 0, ref radius, ref trap, ref unitID[0], ref unitID[1]);
 }
コード例 #8
0
ファイル: BattleMap.cs プロジェクト: pgonzbecer/Conquest
 public void setTrap(int teamID, int unitID, int x, int y, int radius, Trap trap)
 {
     p_setTrap(x, y, 0, ref radius, ref trap, ref teamID, ref unitID);
 }
コード例 #9
0
ファイル: Units.cs プロジェクト: pgonzbecer/Conquest
 // Called when the unit is about to set down a trap
 public virtual Trap onSetTrap(int x, int y, ref Trap trap, BattleMap map)
 {
     return prof.onSetTrap(this, x, y, ref trap, ref map);
 }
コード例 #10
0
ファイル: Units.cs プロジェクト: pgonzbecer/Conquest
 // Called when the unit has set's off the trap
 public virtual bool onSetOffTrap(ref Unit parent, int x, int y, ref Trap trap, ref BattleMap map)
 {
     return prof.onSetOffTrap(this, ref parent, x, y, ref trap, ref map);
 }
コード例 #11
0
ファイル: Trap.cs プロジェクト: pgonzbecer/Conquest
        // Clones the trap with a given new team id
        public Trap clone(int newTeamID)
        {
            // Variables
            Trap	trap=	new Trap(trapEvent, newTeamID, name, ref parent);

            Trap.ntid--;

            trap.trapID=	trapID;

            return trap;
        }
コード例 #12
0
ファイル: Profession.cs プロジェクト: pgonzbecer/Conquest
        // Called when the unit is about to set down a trap
        public virtual Trap onSetTrap(Unit unit, int x, int y, ref Trap trap, ref BattleMap map)
        {
            // Variables
            Passive	passive;

            for(int i= 0; i< currPassives.Length; i++)
            {
                if(currPassives[i]== null)
                    continue;
                if(passives.get(currPassives[i], out passive))
                    trap=	passive.onSetTrap(this, ref unit, x, y, ref trap, ref map);
            }

            return trap;
        }
コード例 #13
0
ファイル: Profession.cs プロジェクト: pgonzbecer/Conquest
        // Called when the unit has set's off the trap
        public virtual bool onSetOffTrap(Unit unit, ref Unit parent, int x, int y, ref Trap trap, ref BattleMap map)
        {
            // Variables
            Passive	passive;
            bool	canSetOff=	true;

            for(int i= 0; i< currPassives.Length; i++)
            {
                if(currPassives[i]== null)
                    continue;
                if(passives.get(currPassives[i], out passive))
                    canSetOff=	passive.onSetOffTrap(this, ref unit, ref parent, x, y, canSetOff, ref trap, ref map);
            }

            return canSetOff;
        }