示例#1
0
    /// <summary>
    /// コリジョンの取得
    /// </summary>
    /// <param name="category">コリジョン種別</param>
    public Collision PickOut(COL_CATEGORY category)
    {
        if (this.pool.count < 1)
        {
            Debug.Assert(false, "コリジョン不足");
            return(null);
        }

        Collision col = this.pool.PickOutLast();

        col.enable     = true;
        col.category   = category;
        col.hitHandler = null;
        switch (category)
        {
        case COL_CATEGORY.PLAYER:
            this.players.Attach(col);
            break;

        case COL_CATEGORY.ENEMY:
            this.enemies.Attach(col);
            break;
        }

        return(col);
    }
示例#2
0
    public bool hit = false;                            // 接触した
#endif


    /// <summary>
    /// 起動
    /// </summary>
    /// <param name="category">判定カテゴリ</param>
    /// <param name="hitHandler">衝突処理</param>
    public void WakeUp(COL_CATEGORY category, HitHandler hitHandler)
    {
        this.enable     = true;
        this.hitHandler = hitHandler;
        this.category   = category;
        this.SetCircle(10f); // デフォ設定
    }
 /// <summary>
 /// 初期化
 /// </summary>
 /// <param name="category">コリジョンカテゴリ</param>
 /// <param name="hitHandler">接触処理</param>
 public void Initialize(COL_CATEGORY category, HitHandler hitHandler)
 {
     this.trans_         = this.transform;
     this.category       = category;
     this.hitHandler     = hitHandler;
     this.collisionCount = this.collisionDatas.Length;
     this.collisions     = new Collision[this.collisionCount];
 }
示例#4
0
 /// <summary>
 /// 射撃開始
 /// </summary>
 /// <param name="direct">方向(XY)</param>
 /// <param name="speed">速度(pix./sec.)</param>
 public void Shoot(Vector3 direct, float speed, COL_CATEGORY category)
 {
     this.direct = direct;
     this.speed  = speed;
     // コリジョン呼び出し
     this.col = GameManager.collision.PickOut(category, HitCallback);
     this.col.SetCircle(30f);
 }
 /// <summary>
 /// 初期化
 /// </summary>
 /// <param name="category">コリジョンカテゴリ</param>
 /// <param name="hitHandler">接触処理</param>
 public void Initialize(COL_CATEGORY category, HitHandler hitHandler)
 {
     this.trans_         = this.transform;
     this.category       = category;
     this.hitHandler     = hitHandler;
     this.collisionCount = this.collisionDatas.Length;
     this.collisions     = new Collision[this.collisionCount];
     this.rotations      = new Quaternion[this.collisionCount];
     for (int i = 0; i < this.collisionCount; ++i)
     {
         this.rotations[i] = Quaternion.identity;
     }
 }
    /// <summary>
    /// コリジョンの取得
    /// </summary>
    /// <param name="category">コリジョン種別</param>
    /// <param name="hitHandler">接触コールバック</param>
    public Collision PickOut(COL_CATEGORY category, HitHandler hitHandler)
    {
        if (this.pool.count < 1)
        {
            Debug.Assert(false, "コリジョン不足");
            return(null);
        }

        int       split = 0;
        Collision col   = this.pool.PickOutLast();

        col.WakeUp(category, hitHandler);
        switch (category)
        {
        case COL_CATEGORY.PLAYER:
            this.players.Attach(col);
            break;

        case COL_CATEGORY.PL_BULLET:
            split             = this.plAwakeSplit;
            this.plAwakeSplit = ++this.plAwakeSplit % COL_SPLIT;
            this.plBullets[split].Attach(col);
            break;

        case COL_CATEGORY.ENEMY:
            this.enemies.Attach(col);
            break;

        case COL_CATEGORY.EN_BULLET:
            split             = this.enAwakeSplit;
            this.enAwakeSplit = ++this.enAwakeSplit % COL_SPLIT;
            this.enBullets[split].Attach(col);
            break;
        }

        return(col);
    }