예제 #1
0
    void CmdCreateBomb(Vector3 pos)
    {
        if (FirstPlayerInfo.iSetBuubleCount < FirstPlayerInfo.iBubbleCount)
        {
            GameObject bombObj = (GameObject)GameObject.Instantiate(Resources.Load("Bomb"));
            sprite = bombObj.GetComponent <SpriteRenderer>();
            if (sprite)
            {
                sprite.sortingOrder = 1;
            }
            Bomb bomb = bombObj.GetComponent <Bomb>();
            if (bomb == null)
            {
                return;
            }

            //bomb.CreateBomb(this.gameObject.transform.position,


            //Vector3 pos = new Vector3(BombSpawn.position.x + 1, BombSpawn.position.y + 1, BombSpawn.position.z);

            bomb.CreateBomb(pos,
                            this.gameObject.transform.rotation, 7); // FirstPlayerInfo.iBubbleLengthCount
            FirstPlayerInfo.iSetBuubleCount += 1;

            NetworkServer.Spawn(bombObj);

            Destroy(bombObj, 3.1f);
        }
    }
예제 #2
0
    void Update()
    {
        if (FirstPlayerInfo.iBubbleCount != FirstPlayerInfo.iSetBuubleCount)
        {
            if (Input.GetKeyDown(KeyCode.Z))
            {
                GameObject bombObj = (GameObject)GameObject.Instantiate(Resources.Load("Bomb"));
                Bomb       bomb    = bombObj.GetComponent <Bomb>();
                if (bomb == null)
                {
                    return;
                }
                bomb.CreateBomb(this.gameObject.transform.position,
                                this.gameObject.transform.rotation,
                                FirstPlayerInfo.iBubbleLengthCount);
                FirstPlayerInfo.iSetBuubleCount += 1;
            }
        }

        if (Input.GetKey(KeyCode.G))
        {
            if (IsSetAni == false)
            {
                SetAni(FIRST_ANI_STATE.DOWNWALK);
            }

            IsSetAni = true;
        }

        else if (Input.GetKey(KeyCode.T))
        {
            if (IsSetAni == false)
            {
                SetAni(FIRST_ANI_STATE.UPWALK);
            }

            IsSetAni = true;
        }

        else if (Input.GetKey(KeyCode.H))
        {
            if (IsSetAni == false)
            {
                SetAni(FIRST_ANI_STATE.RIGHTWALK);
            }

            IsSetAni = true;
        }

        else if (Input.GetKey(KeyCode.F))
        {
            if (IsSetAni == false)
            {
                SetAni(FIRST_ANI_STATE.LEFTWALK);
            }

            IsSetAni = true;
        }

        if (Input.GetKeyUp(KeyCode.G))
        {
            IsSetAni = false;
            SetAni(FIRST_ANI_STATE.DOWNIDLE);
        }

        else if (Input.GetKeyUp(KeyCode.T))
        {
            IsSetAni = false;
            SetAni(FIRST_ANI_STATE.UPIDLE);
        }

        else if (Input.GetKeyUp(KeyCode.F))
        {
            IsSetAni = false;
            SetAni(FIRST_ANI_STATE.LEFTIDLE);
        }

        else if (Input.GetKeyUp(KeyCode.H))
        {
            IsSetAni = false;
            SetAni(FIRST_ANI_STATE.RIGHTIDLE);
        }
    }