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