예제 #1
0
        // creating colliders and bulletobjects
        protected T CreateCollider <T>() where T : EntityCollider
        {
            // destroy old collider
            if (collider != null)
            {
                CollisionFactory.RemoveCollider(collider);
            }

            // create a variable
            EntityCollider col = null;

            if (typeof(T) == typeof(CircleCollider))
            {
                // create collider
                col      = new CircleCollider(transform, Vector2.Zero, 1f);
                collider = col;
            }
            else
            {
                Debug.ErrorLog("EntityCollider of type " + typeof(T) + " is not supported");
            }

            // return as T
            return(col as T);
        }
예제 #2
0
        public BulletObject(int bulletCount)
        {
            // create array
            bulletArr = new Bullet[bulletCount];

            // create collider
            collider = new BulletObjectCollider(this);
            CollisionFactory.AddCollider(collider);
        }
예제 #3
0
        public CollisionFactory()
        {
            // set singleton
            if (Singleton == null)
            {
                Singleton = this;
            }
            else
            {
                Debug.ErrorLog("CollisionFactory Singleton was not null");
            }

            // setup various lists
            eCircleList = new List <CircleCollider>();
            bObjectList = new List <BulletObjectCollider>();
        }