1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.replica.replicaisland;
18 
19 /**
20  * A single animation frame.  Frames contain a texture, a hold time, and collision volumes to
21  * use for "attacking" or "vulnerability."  This allows animated sprites to cheaply interact with
22  * other objects in the game world by associating collision information with particular animation
23  * frames.  Note that an animation frame may have a null texture and null collision volumes.  Null
24  * collision volumes will exclude that frame from collision detection and a null texture will
25  * prevent the sprite from drawing.
26  */
27 public class AnimationFrame extends AllocationGuard {
28     public Texture texture;
29     public float holdTime;
30     FixedSizeArray<CollisionVolume> attackVolumes;
31     FixedSizeArray<CollisionVolume> vulnerabilityVolumes;
32 
AnimationFrame(Texture textureObject, float animationHoldTime)33     public AnimationFrame(Texture textureObject, float animationHoldTime) {
34         super();
35         texture = textureObject;
36         holdTime = animationHoldTime;
37     }
38 
AnimationFrame(Texture textureObject, float animationHoldTime, FixedSizeArray<CollisionVolume> attackVolumeList, FixedSizeArray<CollisionVolume> vulnerabilityVolumeList)39     public AnimationFrame(Texture textureObject, float animationHoldTime,
40             FixedSizeArray<CollisionVolume> attackVolumeList,
41             FixedSizeArray<CollisionVolume> vulnerabilityVolumeList) {
42         super();
43         texture = textureObject;
44         holdTime = animationHoldTime;
45         attackVolumes = attackVolumeList;
46         vulnerabilityVolumes = vulnerabilityVolumeList;
47     }
48 }
49