Exemple #1
0
 void Awake()
 {
     playerMovement    = player.GetComponent <PlayerMovement>();                                 // Componente del movimiento del jugador.
     playerHealth      = player.GetComponent <PlayerHealth>();                                   // Componente de la salud del jugador.
     playerMagic       = player.GetComponent <PlayerMagic>();                                    // Componente de la magia del jugador.
     playerStats       = player.GetComponent <PlayerStats>();                                    // Componente de las estadísticas del jugador.
     enemyPanelManager = GameObject.Find("EnemyPanel").GetComponent <EnemyPanelManager>();       // Componente del panel del enemigo.
     attackAudio       = GetComponent <AudioSource>();                                           // Componente del audio.
     anim            = player.GetComponent <Animator>();                                         // Componente de la animación.
     shootableMask   = LayerMask.GetMask("Shootable");                                           // Crear la capa para las cosas a las que se puede hacer daño.
     selected        = null;                                                                     // Fijar el seleccionado a nulo.
     selectedInRange = false;                                                                    // Fijar el seleccionado en rango a falso.
     attackRadius    = 2f;                                                                       // Fijar el radio de ataque.
     skillSelected   = "null";                                                                   // Fijar la habilidad seleccinada.
     magicSkill1     = 10;                                                                       // Fijar la magia de la habilidad 1.
     magicSkill2     = 300;                                                                      // Fijar la magia de la habilidad 2.
     magicSkill3     = 225;                                                                      // Fijar la magia de la habilidad 3.
     magicSkill4     = 450;                                                                      // Fijar la magia de la habilidad 4.
     magicSkill5     = 900;                                                                      // Fijar la magia de la habilidad 5.
     skill1Text      = skill1Button.GetComponentInChildren <Text>();                             // Obtener el texto del botón.
     skill2Text      = skill2Button.GetComponentInChildren <Text>();                             // Obtener el texto del botón.
     skill3Text      = skill3Button.GetComponentInChildren <Text>();                             // Obtener el texto del botón.
     skill4Text      = skill4Button.GetComponentInChildren <Text>();                             // Obtener el texto del botón.
     skill5Text      = skill5Button.GetComponentInChildren <Text>();                             // Obtener el texto del botón.
     timer           = 1.5f;
     timerSkill2     = 24f;
     timerSkill3     = 12f;
     timerSkill4     = 36f;
     timerSkill5     = 48f;
     ikHands         = GetComponentInParent <IKHands>();
 }
    void Start()
    {
        MusicSource.clip = MusicClip;
        MusicSource.Play();

        dashSource.clip = dashClip;

        Deathtext.text = "";
        pickup         = GetComponent <PickupScroll>();

        animator  = this.GetComponent <Animator>();
        rigidBody = GetComponent <Rigidbody>();
        if (warrior == Warrior.Archer)
        {
            secondaryWeaponModel.gameObject.SetActive(false);
        }
        //sets the weight on any additional layers to 0
        if (warrior == Warrior.Archer || warrior == Warrior.Crossbow)
        {
            if (animator.layerCount >= 1)
            {
                animator.SetLayerWeight(1, 0);
            }
        }
        //sets the weight on any additional layers to 0
        if (warrior == Warrior.TwoHanded)
        {
            secondaryWeaponModel.GetComponent <Renderer>().enabled = false;
            ikhands = this.gameObject.GetComponent <IKHands>();
        }
    }
Exemple #3
0
    void Awake()
    {
        playerAudio     = GetComponent <AudioSource>();                                 // Componente del audio.
        playerStats     = GetComponent <PlayerStats>();                                 // Componente de las estadísticas del jugador.
        floorMask       = LayerMask.GetMask("Floor");                                   // Crear la capa para el suelo.
        anim            = GetComponent <Animator>();                                    // Componente de la animación.
        playerRigidbody = GetComponent <Rigidbody>();                                   // Componente del cuerpo del jugador.
        attacking       = false;                                                        // Fijar atacando a falso.
        pickItem        = false;

        if (PlayerStats.character == "Warrior")
        {
            ikHands = GetComponent <IKHands>();
        }
    }
Exemple #4
0
    void Awake()
    {
        anim                     = GetComponent <Animator>();                                               // Componente de la animación.
        playerAudio              = GetComponent <AudioSource>();                                            // Componente del audio.
        playerMovement           = GetComponent <PlayerMovement>();                                         // Componente del movimiento del jugador.
        playerStats              = GetComponent <PlayerStats>();                                            // Componente de las estadísticas del jugador.
        currentHealth            = 100f;                                                                    // Fijar una salud inicial por encima de 0 para que no se acabe el juego.
        firstTime                = true;                                                                    // Fijar la primera vez a verdadero.
        timeBetweenRegenerations = 0.1f;                                                                    // Fijar el tiempo entre regeneraciones.
        timeStartRegeneration    = 3f;                                                                      // Fijar el tiempo para empezar a regenerarse.
        var = 10;                                                                                           // Fijar la variable.
        healthText.color = new Color(0, 0, 0, 1);

        if (PlayerStats.character == "Warrior")
        {
            ikHands = GetComponent <IKHands>();
        }
    }
 void Start()
 {
     animator  = this.GetComponent <Animator>();
     rigidBody = GetComponent <Rigidbody>();
     if (warrior == Warrior.Archer)
     {
         secondaryWeaponModel.gameObject.SetActive(false);
     }
     //sets the weight on any additional layers to 0
     if (warrior == Warrior.Archer || warrior == Warrior.Crossbow)
     {
         if (animator.layerCount >= 1)
         {
             animator.SetLayerWeight(1, 0);
         }
     }
     //sets the weight on any additional layers to 0
     if (warrior == Warrior.TwoHanded)
     {
         secondaryWeaponModel.GetComponent <Renderer>().enabled = false;
         ikhands = this.gameObject.GetComponent <IKHands>();
     }
 }
Exemple #6
0
    private void Start()
    {
        int numSlots = System.Enum.GetNames(typeof(EquipmentSlot)).Length;

        currentEquipment = new Equipment[numSlots];
        inventory        = Inventory.Instance;
        ikhands          = FindObjectOfType <IKHands>();
        playerStats      = GetComponent <PlayerStats>();

        if (leftHand == null)
        {
            leftHand = GameObject.FindGameObjectWithTag("LeftHand").transform;
        }
        if (rightHand == null)
        {
            rightHand = GameObject.FindGameObjectWithTag("RightHand").transform;
        }

        if (!GameManager.Instance.dataToLoad)
        {
            StartCoroutine(EquipDefaultsCoroutine());
        }
    }
Exemple #7
0
 void Start()
 {
     throwing = false;
     hTransform = this.transform;
     objects = new GameObject[character.getItemMax() + character.getWeaponMax() + 1];
     itemOffset = character.getWeaponMax();
     center = character.GetComponentInChildren<CenterPos>().gameObject.transform;
     weaponIndex = 1;
     oldItemIndex = 1;
     oldWeaponIndex = 1;
     itemIndex = 1;
     weaponShow = true;
     oldWeaponShow = true;
     mWheel = 0.0f;
     mWheelOld = 0.0f;
     changeId = -10000000;//increment up so more changes stored
     wMax = character.getWeaponMax();
     setupHolding(); // make sure occurs after appropriate initialization
     hands = character.GetComponentInChildren<IKHands>();
     hands.setHands();
     this.transform.LookAt(center);
 }