-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAkathSingleEnemy.m
90 lines (78 loc) · 2.13 KB
/
AkathSingleEnemy.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//
// AkathSingleEnemy.m
// TEORWorldMapTest
//
// Created by Zach Babb on 6/27/11.
// Copyright 2011 InstantLazer. All rights reserved.
//
#import "AkathSingleEnemy.h"
#import "GameController.h"
#import "AbstractBattleEnemy.h"
#import "BattleValkyrie.h"
#import "Image.h"
@implementation AkathSingleEnemy
- (void)dealloc {
if (clock) {
[clock release];
}
[super dealloc];
}
- (id)initToEnemy:(AbstractBattleEnemy *)aEnemy
{
self = [super init];
if (self) {
BattleValkyrie *valk = [sharedGameController.battleCharacters objectForKey:@"BattleValkyrie"];
clock = [[Image alloc] initWithImageNamed:@"Clock.png" filter:GL_NEAREST];
clock.renderPoint = CGPointMake(aEnemy.renderPoint.x, aEnemy.renderPoint.y + 15);
clock.color = Color4fMake(1, 1, 1, 0);
akathAdder = [valk calculateAkathAdderTo:aEnemy];
[aEnemy addToStatusDurations:akathAdder];
target1 = aEnemy;
stage = 0;
duration = 1;
active = YES;
}
return self;
}
- (void)updateWithDelta:(float)aDelta {
if (active) {
duration -= aDelta;
if (duration < 0) {
switch (stage) {
case 0:
stage++;
duration = 0.3;
break;
case 1:
stage++;
duration = 1;
break;
case 2:
stage++;
active = NO;
default:
break;
}
}
switch (stage) {
case 0:
clock.color = Color4fMake(1, 1, 1, clock.color.alpha + aDelta);
break;
case 1:
if (clock.color.alpha == 0) {
clock.color = Color4fMake(1, 1, 1, 1);
} else {
clock.color = Color4fMake(1, 1, 1, 0);
}
break;
default:
break;
}
}
}
- (void)render {
if (active && stage < 2) {
[clock renderCenteredAtPoint:clock.renderPoint];
}
}
@end