Revision 2632,
1.9 KB
checked in by hniemi, 11 years ago
(diff) |
Toimiva prototyyppi.
|
Line | |
---|
1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Linq; |
---|
4 | using System.Text; |
---|
5 | using Jypeli; |
---|
6 | |
---|
7 | /// <summary> |
---|
8 | /// Block-class for binding BlockType to block. |
---|
9 | /// </summary> |
---|
10 | public class Block : GameObject |
---|
11 | { |
---|
12 | private BlockType type; |
---|
13 | private bool isGoalzone = false; |
---|
14 | |
---|
15 | /// <summary> |
---|
16 | /// Constructor with width and height |
---|
17 | /// </summary> |
---|
18 | /// <param name="width">Width of Block</param> |
---|
19 | /// <param name="height">Height of Block</param> |
---|
20 | public Block(double width, double height) : base(width, height) |
---|
21 | { |
---|
22 | } |
---|
23 | |
---|
24 | /// <summary> |
---|
25 | /// Type of this block |
---|
26 | /// </summary> |
---|
27 | public BlockType Type { |
---|
28 | get { return type; } |
---|
29 | set |
---|
30 | { |
---|
31 | switch (value) |
---|
32 | { |
---|
33 | case BlockType.Movable: |
---|
34 | Color = Color.Fuchsia; |
---|
35 | break; |
---|
36 | case BlockType.UnMovable: |
---|
37 | Color = Color.Black; |
---|
38 | break; |
---|
39 | case BlockType.GoalZone: |
---|
40 | Color = Color.Red; |
---|
41 | isGoalzone = true; |
---|
42 | break; |
---|
43 | case BlockType.Player: |
---|
44 | Color = Color.Blue; |
---|
45 | break; |
---|
46 | case BlockType.Empty: |
---|
47 | Color = Color.Transparent; |
---|
48 | break; |
---|
49 | case BlockType.SatisfiedGoalZone: |
---|
50 | isGoalzone = true; |
---|
51 | Color = Color.Green; |
---|
52 | break; |
---|
53 | default: |
---|
54 | break; |
---|
55 | } |
---|
56 | type = value; |
---|
57 | } |
---|
58 | } |
---|
59 | |
---|
60 | /// <summary> |
---|
61 | /// Is block goalzone |
---|
62 | /// </summary> |
---|
63 | public bool IsGoalZone { get { return isGoalzone; } } |
---|
64 | } |
---|
65 | |
---|
66 | /// <summary> |
---|
67 | /// Enumerations for different Blocktypes |
---|
68 | /// </summary> |
---|
69 | public enum BlockType { Movable, UnMovable, GoalZone, Player, Empty, SatisfiedGoalZone } |
---|
Note: See
TracBrowser
for help on using the repository browser.