예제 #1
0
    void Atack()
    {
        // MShot
        if (MainShotCnt > 0)
        {
            --MainShotCnt;
        }
        if (MainShotCnt == 0 && (Input.touchCount > 0 || Input.GetKey(KeyCode.Z)) && bulPool.GetSleepCnt() >= 4)
        {
            MainShotCnt = 3;
            Vector3 pos = trans.position;
            pos.y += 0.7f;
            pos.x += 0.6f;
            for (int i = 0; i < 4; ++i)
            {
                FlgBehavior obj = bulPool.GetSleepPos(pos);
                obj.trans.rotation = Quaternion.Euler(0f, 0f, 1.5f * i - 2.25f);
                pos.x -= 0.4f;
            }

            SoundList.gi.list[2].transform.position = trans.position;
            SoundList.gi.list[2].Play();
        }

        // MSword
        if (((Input.touchCount > 1 && Input.GetTouch(1).phase == TouchPhase.Began) || Input.GetKeyDown(KeyCode.X)) &&
            charge > chargeLevel && mSwordPool.GetSleepCnt() > 0)
        {
            var obj = mSwordPool.GetSleepPos(trans.position);
            (obj as PlMainSword).SetRotValue(9f * (swRev ? 1f : -1f));
            swRev = !swRev;
            hitChild.Avoid(4);
            charge -= chargeLevel;
        }
    }
예제 #2
0
    public FlgBehavior GetSleep()
    {
        FlgBehavior result = null;

        if (sleepList.Count > 0)
        {
            result = sleepList.GetForwardRef();
            activeList.Add(result);
            sleepList.DeleteForward();
        }
        else if (prefab != null)
        {
            activeList.Add(result = Instantiate(prefab));
        }

        if (result != null)
        {
            result.Init();
        }

        return(result);
    }
예제 #3
0
    public FlgBehavior GetSleepPos(Vector3 pos)
    {
        FlgBehavior result = null;

        if (sleepList.Count > 0)
        {
            var it = sleepList.GetForwardRef();
            result = it;
            activeList.Add(result);
            sleepList.DeleteForward();
        }
        else if (prefab != null)
        {
            activeList.Add(result = Instantiate(prefab));
        }
        result.trans.position = pos;
        if (result != null)
        {
            result.Init();
        }

        return(result);
    }