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