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