1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Linq; |
---|
4 | using Microsoft.Xna.Framework; |
---|
5 | using Microsoft.Xna.Framework.Audio; |
---|
6 | using Microsoft.Xna.Framework.Content; |
---|
7 | using Microsoft.Xna.Framework.GamerServices; |
---|
8 | using Microsoft.Xna.Framework.Graphics; |
---|
9 | using Microsoft.Xna.Framework.Input; |
---|
10 | using Microsoft.Xna.Framework.Media; |
---|
11 | using Microsoft.Xna.Framework.Net; |
---|
12 | using Microsoft.Xna.Framework.Storage; |
---|
13 | |
---|
14 | namespace Effects |
---|
15 | { |
---|
16 | class Particle |
---|
17 | { |
---|
18 | private ParticleGame game; |
---|
19 | Random random = new Random(); |
---|
20 | private Vector2 position; |
---|
21 | public Vector2 Position |
---|
22 | { |
---|
23 | get { return position; } |
---|
24 | set { position = value; } |
---|
25 | } |
---|
26 | |
---|
27 | private Texture2D texture; |
---|
28 | public Texture2D Texture |
---|
29 | { |
---|
30 | get { return texture; } |
---|
31 | set { texture = value; } |
---|
32 | } |
---|
33 | |
---|
34 | private Texture2D innerTexture; |
---|
35 | public Texture2D InnerTexture |
---|
36 | { |
---|
37 | get { return innerTexture; } |
---|
38 | set { innerTexture = value; } |
---|
39 | } |
---|
40 | |
---|
41 | private float scale; |
---|
42 | public float Scale |
---|
43 | { |
---|
44 | get { return scale; } |
---|
45 | set { scale = value; } |
---|
46 | } |
---|
47 | |
---|
48 | private float rotation; |
---|
49 | public float Rotation |
---|
50 | { |
---|
51 | get { return rotation; } |
---|
52 | set { rotation = value; } |
---|
53 | } |
---|
54 | |
---|
55 | private Vector2 origin; |
---|
56 | public Vector2 Origin |
---|
57 | { |
---|
58 | get { return origin; } |
---|
59 | set { origin = value; } |
---|
60 | } |
---|
61 | |
---|
62 | private Vector2 velocity; |
---|
63 | public Vector2 Velocity |
---|
64 | { |
---|
65 | get { return velocity; } |
---|
66 | set { velocity = value; } |
---|
67 | } |
---|
68 | |
---|
69 | private bool alive; |
---|
70 | public bool Alive |
---|
71 | { |
---|
72 | get { return alive; } |
---|
73 | set { alive = value; } |
---|
74 | } |
---|
75 | |
---|
76 | private float lifetime; |
---|
77 | public float Lifetime |
---|
78 | { |
---|
79 | get { return lifetime; } |
---|
80 | set { lifetime = value; } |
---|
81 | } |
---|
82 | |
---|
83 | private float currentTime; |
---|
84 | public float CurrentTime |
---|
85 | { |
---|
86 | get { return currentTime; } |
---|
87 | set { currentTime = value; } |
---|
88 | } |
---|
89 | |
---|
90 | public Particle(ParticleGame game, Texture2D texture, Texture2D innerTexture, Vector2 position, float lifetime) |
---|
91 | { |
---|
92 | this.alive = true; |
---|
93 | this.game = game; |
---|
94 | this.texture = texture; |
---|
95 | this.innerTexture = innerTexture; |
---|
96 | this.position = position; |
---|
97 | this.Scale = 1.0f; |
---|
98 | this.Rotation = 1.0f; |
---|
99 | this.lifetime = lifetime; |
---|
100 | this.Origin = new Vector2(texture.Width / 2, texture.Height / 2); |
---|
101 | } |
---|
102 | } |
---|
103 | } |
---|