Exemplo n.º 1
0
    public void ItemSwitching()
    {
        switch (Item0st)            //Item0stに入ってる文字からItemのsprite変更とActionのspriteの変更
        {
        case "Energy":
            Item0sprite.SetActive(true); ActionbtnB.SetActive(true);
            Item0sprite.GetComponent <Image>().sprite = Energyimg; ActionbtnB.GetComponent <Image>().sprite = EnergyACT;
            break;

        case "Carrot":
            Item0sprite.SetActive(true); ActionbtnB.SetActive(true);
            Item0sprite.GetComponent <Image>().sprite = Carrotimg; ActionbtnB.GetComponent <Image>().sprite = CarrotACT;
            break;

        case "Pickel":
            Item0sprite.SetActive(true); ActionbtnB.SetActive(true);
            Item0sprite.GetComponent <Image>().sprite = Pickelimg; ActionbtnB.GetComponent <Image>().sprite = PickelACT;
            break;

        case "Taimatu":
            Item0sprite.SetActive(true); ActionbtnB.SetActive(true);
            Item0sprite.GetComponent <Image>().sprite = Taimatuimg; ActionbtnB.GetComponent <Image>().sprite = TaimatuACT;
            break;

        case "Sekiban":
            Item0sprite.SetActive(true); Item0sprite.GetComponent <Image>().sprite = Sekibanimg;
            if (player.GetComponent <Player>().MoveWall)
            {
                ActionbtnB.SetActive(true);
                ActionbtnB.GetComponent <Image>().sprite = SekibanACT;
            }
            else
            {
                ActionbtnB.SetActive(false);
            }

            break;
        }
    }
Exemplo n.º 2
0
    void Update()
    {
        Item0st = player.GetComponent <Player>().Item0;
        Item1st = player.GetComponent <Player>().Item1;
        switch (LadderSwitch)
        {
        case false:                //梯子が近くにないとき
            if (Item0st == " ")
            {
                ActionbtnA.SetActive(false);
                ActionbtnB.SetActive(false);
            }
            else
            {
                ActionbtnA.SetActive(false);
                ItemSwitching();
            }
            break;

        case true:                //梯子が近くにあるとき
            if (Item0st == " ")
            {
                ActionbtnA.SetActive(false);
                ActionbtnB.SetActive(true);
                ActionbtnB.GetComponent <Image>().sprite = Ladder;
            }
            else
            {
                ActionbtnA.SetActive(true);
                ActionbtnA.GetComponent <Image>().sprite = Ladder;
            }
            break;
        }
        if (player.GetComponent <Player>().isClimb == true)
        {
            ActionbtnA.SetActive(true); ActionbtnB.SetActive(true);
            ActionbtnA.GetComponent <Image>().sprite = LadderUp;
            ActionbtnB.GetComponent <Image>().sprite = LadderDown;
        }
        else
        {
            switch (Item0st)                //Item0stに入ってる文字からItemのsprite変更とActionのspriteの変更
            {
            case "Energy":
                Item0sprite.SetActive(true); ActionbtnB.SetActive(true);
                Item0sprite.GetComponent <Image>().sprite = Energyimg; ActionbtnB.GetComponent <Image>().sprite = EnergyACT;
                break;

            case "Carrot":
                Item0sprite.SetActive(true); ActionbtnB.SetActive(true);
                Item0sprite.GetComponent <Image>().sprite = Carrotimg; ActionbtnB.GetComponent <Image>().sprite = CarrotACT;
                break;

            case "Pickel":
                Item0sprite.SetActive(true); ActionbtnB.SetActive(true);
                Item0sprite.GetComponent <Image>().sprite = Pickelimg; ActionbtnB.GetComponent <Image>().sprite = PickelACT;
                break;

            case "Taimatu":
                Item0sprite.SetActive(true); ActionbtnB.SetActive(true);
                Item0sprite.GetComponent <Image>().sprite = Taimatuimg; ActionbtnB.GetComponent <Image>().sprite = TaimatuACT;
                break;

            case "Sekiban":
                Item0sprite.SetActive(true); Item0sprite.GetComponent <Image>().sprite = Sekibanimg;
                if (player.GetComponent <Player>().MoveWall)
                {
                    ActionbtnB.SetActive(true);
                    ActionbtnB.GetComponent <Image>().sprite = SekibanACT;
                }
                else
                {
                    ActionbtnB.SetActive(false);
                }

                break;
            }
            switch (Item1st)            //Item1stに入ってる文字からItemのsprite変更
            {
            case "Energy":
                Item1sprite.SetActive(true); Item1sprite.GetComponent <Image>().sprite = Energyimg;
                break;

            case "Carrot":
                Item1sprite.SetActive(true); Item1sprite.GetComponent <Image>().sprite = Carrotimg;
                break;

            case "Pickel":
                Item1sprite.SetActive(true); Item1sprite.GetComponent <Image>().sprite = Pickelimg;
                break;

            case "Taimatu":
                Item1sprite.SetActive(true); Item1sprite.GetComponent <Image>().sprite = Taimatuimg;
                break;

            case "Sekiban":
                Item1sprite.SetActive(true); Item1sprite.GetComponent <Image>().sprite = Sekibanimg;
                break;
            }
        }
        if (Input.GetKeyDown(KeyCode.E))
        {
            if (Item0st == " ")
            {
                Item0sprite.GetComponent <Image>().sprite = nullimg;
                ActionbtnB.SetActive(false);
            }
            if (Item1st == " ")
            {
                Item1sprite.GetComponent <Image>().sprite = nullimg;
            }
        }
        if (Item0st == " ")
        {
            Item0sprite.GetComponent <Image>().sprite = nullimg;
        }
        else if (Item1st == " ")
        {
            Item1sprite.GetComponent <Image>().sprite = nullimg;
        }
    }