001package com.fs.starfarer.api.impl.campaign.eventide; 002 003import java.util.ArrayList; 004import java.util.List; 005 006import org.lwjgl.util.vector.Vector2f; 007 008public class CharAnimFrame implements Cloneable { 009 public float dur; 010 public float tx, ty, tw, th; 011 public float width, height; 012 public Vector2f move = new Vector2f(); 013 014 public List<HitArea> hittableArea = new ArrayList<HitArea>(); 015 public List<HitArea> attackArea = new ArrayList<HitArea>(); 016 public List<HitArea> blockArea = new ArrayList<HitArea>(); 017 018 public List<String> soundIds = new ArrayList<String>(); 019 public boolean attackCanActuallyHit = true; 020 021 public int hitDamage = 1; 022 023 public void setHittable(float x, float w) { 024 HitArea area = new HitArea(); 025 area.y = -height/2f; 026 area.x = x; 027 area.h = height; 028 area.w = w; 029 hittableArea.add(area); 030 } 031 032 public void setAttack(float x, float w) { 033 HitArea area = new HitArea(); 034 area.y = -height/2f; 035 area.x = x; 036 area.h = height; 037 area.w = w; 038 attackArea.add(area); 039 } 040 041 public void setBlock(float x, float w) { 042 HitArea area = new HitArea(); 043 area.y = -height/2f; 044 area.x = x; 045 area.h = height; 046 area.w = w; 047 blockArea.add(area); 048 } 049 050 051 protected CharAnimFrame clone() { 052 try { 053 CharAnimFrame copy = (CharAnimFrame) super.clone(); 054 copy.move = new Vector2f(move); 055 copy.attackArea = new ArrayList<HitArea>(); 056 for (HitArea curr : attackArea) { 057 copy.attackArea.add(curr.clone()); 058 } 059 copy.blockArea = new ArrayList<HitArea>(); 060 for (HitArea curr : blockArea) { 061 copy.blockArea.add(curr.clone()); 062 } 063 copy.hittableArea = new ArrayList<HitArea>(); 064 for (HitArea curr : hittableArea) { 065 copy.hittableArea.add(curr.clone()); 066 } 067 return copy; 068 } catch (CloneNotSupportedException e) { 069 throw new RuntimeException(e); 070 } 071 } 072 073 074}