コード例 #1
0
ファイル: Vehicle.cs プロジェクト: cadahl/defense
        public void Damage(int points)
        {
            HitPoints -= points;

            _hurt = true;

            float[] rnds = Util.RandomInCircle(6.0f);
            Generic puff = new Generic(_game, X+rnds[0], Y+rnds[1], DamagePuff);
            puff.Priority = Priority.VehicleHitEffect;
            puff.LifeTime = 20;
            puff.StartAngle = Util.RandomInt(0,4095);
            puff.EndAngle = (puff.StartAngle + Util.RandomSign() * Util.RandomInt(Angles.Pi/6, (int)(Angles.Pi/5))) & 4095;
            puff.StartScale = 1.0f;
            puff.EndScale = 1.4f;
            puff.StartColor = Color.FromArgb(255,Color.White);
            puff.EndColor = Color.FromArgb(0,Color.Black);
            _game.AddObject(puff);
        }
コード例 #2
0
ファイル: Vehicle.cs プロジェクト: cadahl/defense
        private void SpawnDust()
        {
            Generic puff = new Generic(	_game,
                                        X,
                                        Y,
                                        Generic.Puff);
            puff.LifeTime = (int)Util.Lerp(40,60,Util.Random());
            int rnd = 50;//Util.RandomInt(220,245);
            puff.StartColor = Color.FromArgb(110, (int)(rnd*0.9), (int)(rnd*0.9), (int)(rnd*0.8));
            puff.EndColor = Color.FromArgb(0,rnd,rnd,rnd);
            puff.StartAngle = Util.RandomInt(0, 4095);
            puff.EndAngle = (puff.StartAngle + Util.RandomSign() * Util.RandomInt(Angles.Pi/3, (int)(Angles.Pi/2))) & 4095;
            puff.StartScale = 1.0f;
            puff.EndScale = Util.Lerp(1.0f,Speed*2.5f,Util.Random());
            puff.Priority = 4;

            _game.AddObject(puff);
        }