Subversion Repositories AndroidProjects

Rev

Rev 976 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.gebauz.burutaru.game.entities;

import com.gebauz.bauzoid.math.Matrix4;
import com.gebauz.bauzoid.math.collision.AABoundingBox;
import com.gebauz.bauzoid.math.collision.Shape;

/** Base abstract class for all kinds of enemy-hurting projectiles (including enemy-hurting explosions.
 * NOTE: only friendly projectiles, not player-hurting ones. Those should be based on the "Enemy" class. */

public abstract class Projectile
{


        // Constants========================================================================================

        // Embedded Types===================================================================================

        // Fields===========================================================================================
       
        private int mDamage = 0;       
        private boolean mIsAlive = false;

        // Methods==========================================================================================

        public Projectile(int damage)
        {
                mDamage = damage;
                mIsAlive = true;
        }
       
        /** Process the damaging of an enemy that has been touched by this projectile. */
        public abstract void processHit(ICollidable hitObject);
       
        /** Makes the projectile vanish. */
        public void setAlive(boolean alive) { mIsAlive = alive; }

        // Getters/Setters==================================================================================
       
        /** Get an axis-aligned bounding box for broad-phase collision detection. */
        public abstract AABoundingBox getBounds();
       
        /** Get the damaging amount of this weapon. */
        public final int getDamage() { return mDamage; }
       
        /** Check if the projectile is still active/alive. */
        public final boolean isAlive() { return mIsAlive; }
       
        /** Get the shape of the projectile for testing. */
        public abstract Shape getShape();
       
        /** Get the transformation of the shape for testing. */
        public abstract Matrix4 getShapeTransform();

}