Rev 976 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 930 | chris | 1 | package com.gebauz.burutaru.game.entities; |
| 2 | |||
| 933 | chris | 3 | import com.gebauz.bauzoid.math.Matrix4; |
| 950 | chris | 4 | import com.gebauz.bauzoid.math.collision.AABoundingBox; |
| 933 | chris | 5 | import com.gebauz.bauzoid.math.collision.Shape; |
| 6 | |||
| 976 | chris | 7 | /** Base abstract class for all kinds of enemy-hurting projectiles (including enemy-hurting explosions. |
| 8 | * NOTE: only friendly projectiles, not player-hurting ones. Those should be based on the "Enemy" class. */ |
||
| 930 | chris | 9 | public abstract class Projectile |
| 10 | { |
||
| 11 | |||
| 12 | |||
| 13 | // Constants======================================================================================== |
||
| 14 | |||
| 15 | // Embedded Types=================================================================================== |
||
| 16 | |||
| 17 | // Fields=========================================================================================== |
||
| 18 | |||
| 19 | private int mDamage = 0; |
||
| 20 | private boolean mIsAlive = false; |
||
| 21 | |||
| 22 | // Methods========================================================================================== |
||
| 23 | |||
| 24 | public Projectile(int damage) |
||
| 25 | { |
||
| 26 | mDamage = damage; |
||
| 27 | mIsAlive = true; |
||
| 28 | } |
||
| 29 | |||
| 30 | /** Process the damaging of an enemy that has been touched by this projectile. */ |
||
| 993 | chris | 31 | public abstract void processHit(ICollidable hitObject); |
| 936 | chris | 32 | |
| 33 | /** Makes the projectile vanish. */ |
||
| 34 | public void setAlive(boolean alive) { mIsAlive = alive; } |
||
| 931 | chris | 35 | |
| 930 | chris | 36 | // Getters/Setters================================================================================== |
| 37 | |||
| 950 | chris | 38 | /** Get an axis-aligned bounding box for broad-phase collision detection. */ |
| 39 | public abstract AABoundingBox getBounds(); |
||
| 40 | |||
| 930 | chris | 41 | /** Get the damaging amount of this weapon. */ |
| 42 | public final int getDamage() { return mDamage; } |
||
| 43 | |||
| 44 | /** Check if the projectile is still active/alive. */ |
||
| 45 | public final boolean isAlive() { return mIsAlive; } |
||
| 933 | chris | 46 | |
| 47 | /** Get the shape of the projectile for testing. */ |
||
| 48 | public abstract Shape getShape(); |
||
| 49 | |||
| 50 | /** Get the transformation of the shape for testing. */ |
||
| 51 | public abstract Matrix4 getShapeTransform(); |
||
| 930 | chris | 52 | |
| 53 | } |
||
| 933 | chris | 54 | |
| 55 |