xref: /aosp_15_r20/external/replicaisland/src/com/replica/replicaisland/GameComponent.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 game component implements a single feature of a game object.  Components are run once per frame
21*5eae8ebbSCole Faust  * when their parent object is active.  Updating a game object is equivalent to updating all of its
22*5eae8ebbSCole Faust  * components.  Note that a game object may contain more than one instance of the same type of
23*5eae8ebbSCole Faust  * component.
24*5eae8ebbSCole Faust  */
25*5eae8ebbSCole Faust public abstract class GameComponent extends PhasedObject {
26*5eae8ebbSCole Faust     // Defines high-level buckets within which components may choose to run.
27*5eae8ebbSCole Faust     public enum ComponentPhases {
28*5eae8ebbSCole Faust         THINK,                  // decisions are made
29*5eae8ebbSCole Faust         PHYSICS,                // impulse velocities are summed
30*5eae8ebbSCole Faust         POST_PHYSICS,           // inertia, friction, and bounce
31*5eae8ebbSCole Faust         MOVEMENT,               // position is updated
32*5eae8ebbSCole Faust         COLLISION_DETECTION,    // intersections are detected
33*5eae8ebbSCole Faust         COLLISION_RESPONSE,     // intersections are resolved
34*5eae8ebbSCole Faust         POST_COLLISION,         // position is now final for the frame
35*5eae8ebbSCole Faust         ANIMATION,              // animations are selected
36*5eae8ebbSCole Faust         PRE_DRAW,               // drawing state is initialized
37*5eae8ebbSCole Faust         DRAW,                   // drawing commands are scheduled.
38*5eae8ebbSCole Faust         FRAME_END,              // final cleanup before the next update
39*5eae8ebbSCole Faust     }
40*5eae8ebbSCole Faust 
41*5eae8ebbSCole Faust     public boolean shared;
42*5eae8ebbSCole Faust 
GameComponent()43*5eae8ebbSCole Faust     public GameComponent() {
44*5eae8ebbSCole Faust         super();
45*5eae8ebbSCole Faust         shared = false;
46*5eae8ebbSCole Faust     }
47*5eae8ebbSCole Faust 
48*5eae8ebbSCole Faust }
49