예제 #1
0
        //--------Constructors------------------------------
        public Bullet(Creature targetCreature,
                      float speed,
                      float dmg,
                      DmgType dmgType,
                      float splashRange,
                      float[] slow,
                      GeneSpecs elems,
                      Vector2 originPoint,
                      Texture2D texture,
                      HexMap currMap)
        {
            this.targetCreature = targetCreature;
            this.speed          = speed;
            this.dmg            = dmg;
            DmgType             = dmgType;
            this.slow           = slow;
            ElemSpecs           = elems;
            this.originPoint    = originPoint;
            this.texture        = texture;

            //active = true;
            textureOrigin = new Vector2(texture.Width / 2, texture.Height / 2);

            //Rnd = targetCreature.ParentMap.rnd;
            //rndWobble = new Vector2((float)(Rnd.NextDouble() - 0.5), (float)(Rnd.NextDouble() - 0.5));

            //ShootAt(targetCreature);

            SplashRange = splashRange;
            ParentMap   = currMap;

            ExplosionAnim = new AnimSprite(ParentMap.ParentGame.Content.Load <Texture2D>("MetroPlos"), Point.Zero, 1, 5);
        }
예제 #2
0
파일: Creature.cs 프로젝트: jamikka/AlkuTD
 public Creature(string creatureType, string name, HexMap map, string textureName, int spawnPointIndex, int goalPointIndex, int initHp, float defaultSpeed, GeneSpecs elementWeaknesses, byte lifeDamage, int nrgBounty, float spriteScale)
     : this(creatureType, name, map, spawnPointIndex, goalPointIndex, Array.Find <Texture2D>(CurrentGame.CreatureTextures, tex => tex.Name == textureName), initHp, defaultSpeed)
 {
     EnergyBounty         = nrgBounty;
     ElemArmors           = elementWeaknesses;
     SpriteScale          = spriteScale;
     currentFrame         = 0;
     AnimationUpdatePhase = 0;
     LifeDmg = lifeDamage;
     //Spritesheet.Name = textureName;
 }
예제 #3
0
        //--------Constructors------------------------------
        public Tower(char symbol, string name, Point mapCoord, float range, float firerate, Texture2D[] textures, GeneSpecs geneSpecs, Texture2D bulletTexture, float bulletSpeed, short dmg, DmgType dmgType, int splashRange, float[] slow, int cost, int buildTime, bool isExample)
        {
            ParentMap = CurrentGame.currentMap;
            Name      = name;
            Symbol    = symbol;
            MapCoord  = mapCoord;
            //ScreenLocation = map.ToScreenLocation(mapCoord);

            /*this.screenLocation = new Vector2((float)(mapLocation[0] * map.stackedWidth + map.drawPos.X),
             *                                (float)(mapLocation[1] * map.TileHeight + mapLocation[0] % 2 * (map.TileHeight / 2)) + map.drawPos.Y);*/
            Range          = range;
            InitRange      = range;
            FireRate       = firerate;
            BulletSpeed    = bulletSpeed;
            radiusTextures = new Texture2D[2];
            //this.radiusTextures[0] = radiusTexture;
            MakeRadiusCircle();
            ShowRadius = false;
            Textures   = textures;
            //this.angleOffset = angleOffset;
            //angle = (float)Math.PI * 1.5f;
            texOrigin          = new Vector2(textures[0].Width / 2, textures[0].Height / 2);
            this.bulletTexture = bulletTexture;
            Dmg        = dmg;
            DmgType    = dmgType;
            this.slow  = slow;
            Cost       = cost;
            BuildTime  = buildTime;
            buildTimer = buildTime;
            IsExample  = isExample;
            if (!IsExample)
            {
                buildFinishedCounter = buildFinishedInit; //---------------------------ist dies der rihl leif?
            }
            Built        = false;
            Bullets      = new List <Bullet>(10);
            towerTypeIdx = Array.IndexOf(TowerSymbols, symbol);
            towerBranch  = towerTypeIdx % 6;
            SplashRange  = splashRange;

            CreaturesInRange = new List <Creature>();
            ColoredInRange   = new List <Creature>();
            PossibleTargets  = new List <Creature>();

            GeneSpecs = geneSpecs;
            GeneSpecs.BaseTiers[Math.Max((int)GeneSpecs.GetPrimaryElem() - 1, 0)] = (int)(GeneSpecs.GetPrimaryElemStrength() * 100) / GeneSpecs.TierSize;

            FireRateSec = 1000 / (firerate * (float)ParentMap.ParentGame.TargetElapsedTime.TotalMilliseconds);
            DPS         = dmg * FireRateSec;
        }
예제 #4
0
파일: Creature.cs 프로젝트: jamikka/AlkuTD
        //--------------------------Constructors------------------------------------ //---------------------------------------------------muista että tuki useammalle maalille on!
        public Creature(HexMap map, string creatureType, int spawnPointIndex, int goalPointIndex, Texture2D texture)
        {
            ParentGame      = map.ParentGame;
            ParentMap       = map;
            OrigPath        = new List <Vector2>();
            Type            = creatureType;
            SpawnPointIndex = spawnPointIndex;
            GoalPointIndex  = goalPointIndex;
            Location        = map.SpawnPoints.Length > 0 ? map.ToScreenLocation(map.SpawnPoints[spawnPointIndex]) : Vector2.Zero;
            nextWaypoint    = 1;

            Spritesheet     = texture;
            SpriteScale     = 1f;
            SpritesheetRows = 1;
            if (texture != null)
            {
                SpritesheetColumns = texture.Width / texture.Height <= 1 ? 1 : texture.Width / texture.Height;
            }
            totalFrames     = SpritesheetRows * SpritesheetColumns;
            animationCycles = 30;
            //Angle = (float)Math.Atan2(PosY - Path[nextWaypoint].Y, PosX - Path[nextWaypoint].X);
            //Angle = AnglesBetweenWaypoints[0]; //------------------------------------------------------fix
            //AngleOffset = (float)Math.PI;
            Origin     = texture != null ? new Vector2(Width / 2, Height / 2) : Vector2.Zero;
            Alive      = false;
            LifeDmg    = 1;
            hpBarWidth = 25;
            spin       = (float)(ParentMap.rnd.NextDouble() - 0.5f) * 0.08f;

            TowersTargetingThis = new List <Tower>();
            CurrentSlowEffect   = new float[2];
            DmgHeadedThisWay    = new List <KeyValuePair <uint, int> >();

            ElemArmors = new GeneSpecs();

            HpBarColor = new Color(0, 255, 0);
        }