Beispiel #1
0
    public BulletBase ObjectActive(
        ObjectBase shot, Vector2 pos, float sp, float atk, float ang, bool guid,
        bool scObj = false, Define.BulletTeam t = Define.BulletTeam.Enemy)
    {
        if (disableFront == null)
        {
            return(null);
        }

        ++bulletCount;

        disableFront.me.SetBullet(shot, pos, sp, atk, ang, guid, scObj, t);

        ObjectLink <BulletBase> save = disableFront.back;

        disableFront.back = null;

        if (activeFront == null)
        {
            activeFront = disableFront;
            activeBack  = activeFront;
        }
        else
        {
            activeBack.back = disableFront;
            activeBack      = disableFront;
        }

        disableFront = save;

        return(activeBack.me);
    }
Beispiel #2
0
    public BulletBase SetBullet(
        ObjectBase shot, Vector2 pos, float sp, float atk, float ang, bool guid,
        bool scObj, Define.BulletTeam t)
    {
        shooter = shot;

        tp.position = pos;
        speed       = sp;
        attack      = atk;
        angle       = ang;
        prevAngle   = angle;
        team        = t;

        feverAttack = false;
        penetrate   = false;

        guided = guid;

        active = false;

        scoreObj   = false;
        scoreStay  = true;
        isScoreObj = scObj;
        scoreTime  = 0f;

        rotationLock = false;

        angleAccel = 0f;
        accel      = 0f;

        killWish = null;

        if (guided)
        {
            if (team == Define.BulletTeam.Enemy)
            {
                direction = PlayerManager.instance.GetDirection(tp.position);
            }
            else
            {
                float rad = angle * Mathf.Deg2Rad;
                direction = new Vector3(Mathf.Cos((rad)), Mathf.Sin((rad)));
            }
        }
        else
        {
            direction = new Vector3(Mathf.Cos((angle * Mathf.Deg2Rad)), Mathf.Sin((angle * Mathf.Deg2Rad)));
        }

        tp.localRotation = Quaternion.Euler(new Vector3(0f, 0f, angle));

        gameObject.SetActive(true);

        SetLifeTime();

        return(this);
    }
Beispiel #3
0
    public void CollisionCheck(ObjectBase obj, Define.BulletTeam targetTeam)
    {
        ObjectLink <BulletBase> link = activeFront;

        if (link == null)
        {
            return;
        }

        while (true)
        {
            link.me.CopyList();

            if (link.me.gameObject.activeSelf)
            {
                if (link.me.IsTeam(targetTeam))
                {
                    link.me.CollisionCheck(obj);
                    // if(obj.Collision(link.me))
                    // {
                    //  //Debug.Log(obj.GetColliderInfo().radius);
                    //  link.me.ColliseionActive(obj);
                    // }
                }
            }

            //link.me.DeleteExitObjects();

            link = link.back;

            if (link == null)
            {
                break;
            }
        }
    }
Beispiel #4
0
 public bool IsTeam(Define.BulletTeam t)
 {
     return(team == t);
 }