Beispiel #1
0
    void Start()
    {
        pl    = GetComponent <Playermove>();
        anima = model.GetComponent <Animator>();
        rigid = GetComponent <Rigidbody>();

        col = GetComponent <CapsuleCollider>();
    }
    // Use this for initialization

    void Awake()
    {
        characterQueue = new CustomCircularQueue <GlobalCharacterInfo.CHAR_TYPE>();
        currentType    = GlobalCharacterInfo.CHAR_TYPE.ALLIGATOR;
        moveScript     = characterObject.GetComponent <Playermove>();
        effectScript   = characterSwitchEffectObject.GetComponent <CharacterSwitchEffect>();

        foreach (GlobalCharacterInfo.CHAR_TYPE charType in (GlobalCharacterInfo.CHAR_TYPE[])Enum.GetValues(typeof(GlobalCharacterInfo.CHAR_TYPE)))
        {
            characterQueue.push(charType);
        }
    }
    void Awake()
    {
        magitionMagicCircleSrite = Resources.LoadAll <Sprite>("Character/Magition/SkillDevillHand/Circle");
        magitionHandsSprite      = Resources.LoadAll <Sprite>("Character/Magition/SkillDevillHand/Hands");

        dragonSparkSprite = Resources.LoadAll <Sprite>("Character/Dragon/SkillLaserShoot/Spark");
        dragonLaserSprite = Resources.LoadAll <Sprite>("Character/Dragon/SkillLaserShoot/Laser");

        moveScript = gameObject.GetComponent <Playermove>();

        dragonBreathPrefab       = Resources.Load("Prefabs/Dragon/Breath") as GameObject;
        magitionDevilHandsPrefab = Resources.Load("Prefabs/Magition/DevilHands") as GameObject;
    }
    void Awake()
    {
        moveScript = referenceCharacter.GetComponent <Playermove>();

        colliderController  = gameObject.GetComponent <CapsuleCollider2D>();
        currentRenderer     = gameObject.GetComponent <SpriteRenderer>();
        rigid2DController   = gameObject.GetComponent <Rigidbody2D>();
        animationController = gameObject.GetComponent <Animator>();

        specificRenderer = specificEffect.GetComponent <SpriteRenderer>();


        spriteAlligatorHit = Resources.LoadAll <Sprite>("Player/dkrdjdiH").Single(s => s.name == "dkrdjdiH_4");
        spriteMagitionHit  = Resources.LoadAll <Sprite>("Player/wichH").Single(s => s.name == "wichH_4");
        spriteDragonHit    = Resources.LoadAll <Sprite>("Player/DragonH").Single(s => s.name == "DragonH_4");
        spriteHeroHit      = Resources.LoadAll <Sprite>("Player/HeroH").Single(s => s.name == "HeroH_4");

        spriteDownLine = Resources.Load <Sprite>("Character/Common/DownLine");
        spriteSmoke    = Resources.LoadAll <Sprite>("Character/Common/LandingSmoke");
        TurnOffComponent();
    }
    // Update is called once per frame
    void Update()
    {
        if (Time.time >= 6)
        {
            gunscript gun = weapon1.GetComponent <gunscript>();

            if (Input.GetKeyDown(inventory))
            {
                isshow = !isshow;
                Iicon  = !Iicon;
                showinventory();
            }

            if (Input.GetKeyDown(menu))
            {
                menushow = !menushow;
                showmenu();
            }

            // INVENTORY HOTKEYS
            if (Input.GetKeyDown(slot1))
            {
                if (itemlist[0] != "")
                {
                    Debug.Log("SLOT1");
                    for (int i = 0; i < selectedslot.Length; i++)
                    {
                        if (i == 0)
                        {
                            selectedslot[i] = 1;
                            imagelist[i].GetComponent <Image>().color = c;
                            hotkeytxt[i].GetComponent <Text>().color  = c;
                        }
                        else
                        {
                            selectedslot[i] = 0;
                            imagelist[i].GetComponent <Image>().color = w;
                            hotkeytxt[i].GetComponent <Text>().color  = t;
                        }
                    }
                }
            }
            else if (Input.GetKeyDown(slot2))
            {
                if (itemlist[1] != "")
                {
                    Debug.Log("SLOT2");
                    for (int i = 0; i < selectedslot.Length; i++)
                    {
                        if (i == 1)
                        {
                            selectedslot[i] = 1;
                            imagelist[i].GetComponent <Image>().color = c;
                            hotkeytxt[i].GetComponent <Text>().color  = c;
                        }
                        else
                        {
                            selectedslot[i] = 0;
                            imagelist[i].GetComponent <Image>().color = w;
                            hotkeytxt[i].GetComponent <Text>().color  = t;
                        }
                    }
                }
            }
            else if (Input.GetKeyDown(slot3))
            {
                if (itemlist[2] != "")
                {
                    Debug.Log("SLOT3");
                    for (int i = 0; i < selectedslot.Length; i++)
                    {
                        if (i == 2)
                        {
                            selectedslot[i] = 1;
                            imagelist[i].GetComponent <Image>().color = c;
                            hotkeytxt[i].GetComponent <Text>().color  = c;
                        }
                        else
                        {
                            selectedslot[i] = 0;
                            imagelist[i].GetComponent <Image>().color = w;
                            hotkeytxt[i].GetComponent <Text>().color  = t;
                        }
                    }
                }
            }
            else if (Input.GetKeyDown(slot4))
            {
                if (itemlist[3] != "")
                {
                    Debug.Log("SLOT4");
                    for (int i = 0; i < selectedslot.Length; i++)
                    {
                        if (i == 3)
                        {
                            selectedslot[i] = 1;
                            imagelist[i].GetComponent <Image>().color = c;
                            hotkeytxt[i].GetComponent <Text>().color  = c;
                        }
                        else
                        {
                            selectedslot[i] = 0;
                            imagelist[i].GetComponent <Image>().color = w;
                            hotkeytxt[i].GetComponent <Text>().color  = t;
                        }
                    }
                }
            }
            else if (Input.GetKeyDown(slot5))
            {
                if (itemlist[4] != "")
                {
                    Debug.Log("SLOT5");
                    for (int i = 0; i < selectedslot.Length; i++)
                    {
                        if (i == 4)
                        {
                            selectedslot[i] = 1;
                            imagelist[i].GetComponent <Image>().color = c;
                            hotkeytxt[i].GetComponent <Text>().color  = c;
                        }
                        else
                        {
                            selectedslot[i] = 0;
                            imagelist[i].GetComponent <Image>().color = w;
                            hotkeytxt[i].GetComponent <Text>().color  = t;
                        }
                    }
                }
            }
            else if (Input.GetKeyDown(slot6))
            {
                if (itemlist[5] != "")
                {
                    Debug.Log("SLOT6");
                    for (int i = 0; i < selectedslot.Length; i++)
                    {
                        if (i == 5)
                        {
                            selectedslot[i] = 1;
                            imagelist[i].GetComponent <Image>().color = c;
                            hotkeytxt[i].GetComponent <Text>().color  = c;
                        }
                        else
                        {
                            selectedslot[i] = 0;
                            imagelist[i].GetComponent <Image>().color = w;
                            hotkeytxt[i].GetComponent <Text>().color  = t;
                        }
                    }
                }
            }

            // ITEM USE BUTTON
            if (Input.GetKeyDown(usebutton))
            {
                for (int i = 0; i < selectedslot.Length; i++)
                {
                    if (selectedslot[i] == 1)
                    {
                        if (itemlist[i] == "Energy")
                        {
                            if (weapon != "")
                            {
                                if (gun.ammo <= 50)
                                {
                                    energy = 100;
                                    gun.Energy(energy);
                                    itemlist[i] = "";
                                    imagelist[i].GetComponent <Image>().sprite = null;
                                    imagelist[i].GetComponent <Image>().color  = w;
                                    hotkeytxt[i].GetComponent <Text>().color   = t;
                                    selectedslot[i] = 0;
                                }
                                else if (gun.ammo >= 51)
                                {
                                    acpanel.SetActive(true);
                                    action.text = "You still have 60% of weapon energy";
                                    StartCoroutine(LateCall());
                                }
                            }
                            else
                            {
                                acpanel.SetActive(true);
                                action.text = "No Weapon";
                                StartCoroutine(LateCall());
                            }
                        }
                        else if (itemlist[i] == "Weapon")
                        {
                            Playermove pla = player.GetComponent <Playermove>();
                            pla.arm(true);
                            weapon1.SetActive(true);
                            //gun.firee.SetBool("hold", true);
                            weapon      = itemlist[i];
                            itemlist[i] = "";
                            imagelist[i].GetComponent <Image>().sprite = null;
                            imagelist[i].GetComponent <Image>().color  = w;
                            hotkeytxt[i].GetComponent <Text>().color   = t;
                            selectedslot[i] = 0;
                            weaponslot.GetComponent <Image>().sprite = spritelist[1];
                        }

                        //gun.firee.SetBool("hold", false);
                    }
                }
            }
        }
    }
Beispiel #6
0
 // Start is called before the first frame update
 void Start()
 {
     player = GameObject.FindGameObjectWithTag("Player").GetComponent <Playermove>();
 }
 // Use this for initialization
 void Start()
 {
     player = gameObject.GetComponentInParent <Playermove>();
 }
Beispiel #8
0
 // Start is called before the first frame update
 void Start()
 {
     posOffset = transform.position;
     player    = GameObject.FindGameObjectWithTag("Player").GetComponent <Playermove>();
 }