RuneHive-Game
Loading...
Searching...
No Matches
CannonBuild.java
Go to the documentation of this file.
1package com.runehive.content.combat.cannon;
2
3import com.runehive.game.Animation;
4import com.runehive.game.task.TickableTask;
5import com.runehive.game.world.entity.mob.Direction;
6import com.runehive.game.world.entity.mob.player.Player;
7import com.runehive.game.world.items.Item;
8import com.runehive.game.world.object.CustomGameObject;
9
10/**
11 * Created by Daniel on 2017-12-12.
12 */
13public class CannonBuild extends TickableTask {
14
15 private final Player player;
16 private final Cannon cannon;
17
18
20 super(false, 1);
21 this.player = player;
22 this.cannon = cannon;
23 }
24
25 @Override
26 protected void onSchedule() {
27 player.locking.lock();
28 }
29
30 @Override
31 protected void onCancel(boolean logout) {
32 player.locking.unlock();
33 }
34
35 @Override
36 protected void tick() {
37 switch (tick) {
38 case 1:
41 player.animate(new Animation(827));
42 player.inventory.remove(new Item(6));
43 break;
44 case 2:
45 cannon.register();
46 break;
47 case 3:
49 player.animate(new Animation(827));
50 player.inventory.remove(new Item(8));
51 break;
52 case 5:
54 player.animate(new Animation(827));
55 player.inventory.remove(new Item(10));
56 break;
57 case 6:
58 cannon.unregister();
59 cannon.setObject(new CustomGameObject(9, cannon.getPosition()));
60 cannon.register();
61 break;
62 case 7:
64 player.animate(new Animation(827));
65 player.inventory.remove(new Item(12));
66 break;
67 case 8:
68 cannon.unregister();
69 cannon.setObject(new CustomGameObject(6, cannon.getPosition()));
70 cannon.register();
71 break;
72 case 9:
75 player.locking.unlock();
77 cancel();
78 break;
79 }
80 }
81}
void onSchedule()
A function executed on registration.
CannonBuild(Player player, Cannon cannon)
void onCancel(boolean logout)
A function executed on cancellation.
Class that models a single animation used by an entity.
synchronized final void cancel()
Cancels all subsequent executions.
Definition Task.java:113
TickableTask(boolean instant, int delay)
This class represents a character controlled by a player.
Definition Player.java:125
The container class that represents an item that can be interacted with.
Definition Item.java:21
Represents a static game object loaded from the map fs.
Represents the enumerated directions an entity can walk or face.