Starsector API
Loading...
Searching...
No Matches
CharAnimFrame.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.eventide;
2
3import java.util.ArrayList;
4import java.util.List;
5
6import org.lwjgl.util.vector.Vector2f;
7
8public class CharAnimFrame implements Cloneable {
9 public float dur;
10 public float tx, ty, tw, th;
11 public float width, height;
12 public Vector2f move = new Vector2f();
13
14 public List<HitArea> hittableArea = new ArrayList<HitArea>();
15 public List<HitArea> attackArea = new ArrayList<HitArea>();
16 public List<HitArea> blockArea = new ArrayList<HitArea>();
17
18 public List<String> soundIds = new ArrayList<String>();
19 public boolean attackCanActuallyHit = true;
20
21 public int hitDamage = 1;
22
23 public void setHittable(float x, float w) {
24 HitArea area = new HitArea();
25 area.y = -height/2f;
26 area.x = x;
27 area.h = height;
28 area.w = w;
29 hittableArea.add(area);
30 }
31
32 public void setAttack(float x, float w) {
33 HitArea area = new HitArea();
34 area.y = -height/2f;
35 area.x = x;
36 area.h = height;
37 area.w = w;
38 attackArea.add(area);
39 }
40
41 public void setBlock(float x, float w) {
42 HitArea area = new HitArea();
43 area.y = -height/2f;
44 area.x = x;
45 area.h = height;
46 area.w = w;
47 blockArea.add(area);
48 }
49
50
51 protected CharAnimFrame clone() {
52 try {
53 CharAnimFrame copy = (CharAnimFrame) super.clone();
54 copy.move = new Vector2f(move);
55 copy.attackArea = new ArrayList<HitArea>();
56 for (HitArea curr : attackArea) {
57 copy.attackArea.add(curr.clone());
58 }
59 copy.blockArea = new ArrayList<HitArea>();
60 for (HitArea curr : blockArea) {
61 copy.blockArea.add(curr.clone());
62 }
63 copy.hittableArea = new ArrayList<HitArea>();
64 for (HitArea curr : hittableArea) {
65 copy.hittableArea.add(curr.clone());
66 }
67 return copy;
68 } catch (CloneNotSupportedException e) {
69 throw new RuntimeException(e);
70 }
71 }
72
73
74}