protected virtual void Awake()
    {
        skillHandler = GetComponent <CCSkillHandler>();

        SkillTemplate tempSpell = null;
        int           number    = -1;

        for (byte i = 0; i < PlayerStats.skillList.Length; i++)
        {
            if (PlayerStats.skillList[i].id == id)
            {
                number = i;
                break;
            }
        }
        tempSpell     = PlayerStats.skillList[number];
        damage        = tempSpell.damage * (1 + (PlayerStats.damageModifier * 0.01f));
        radius        = tempSpell.radius;
        force         = tempSpell.force;
        range         = tempSpell.range;
        speed         = tempSpell.speed;
        ticks         = tempSpell.ticks;
        timePerTick   = tempSpell.timePerTick;
        animationName = tempSpell.animationName;
        spellPrefab   = tempSpell.spellPrefab;
        cooldown      = tempSpell.cooldown;
        audioClip     = tempSpell.audio;

        skillIndex = -1;
        for (int i = 0; i < PlayerStats.equippedSkills.Length; i++)
        {
            if (id == PlayerStats.equippedSkills[i])
            {
                skillIndex = i;
                //skillHandler.intController.skillInfo[i] = new SkillHUDInfo();
                //skillHandler.intController.skillInfo[i].cooldown = cooldown;
                //skillHandler.intController.skillInfo[i].iconTexture = texture;
            }
        }
    }
Beispiel #2
0
    private void AssignVariables()
    {
        //torsoTransform
        Camera.main.GetComponent <CameraOrbit>().targetTransform = placeholderCamPos;
        torsoTransform = myTransform.Search("Bone_Rotation");
        if (SmartFoxConnection.hasConnection)
        {
            transformSender.MovementTranform = movingTransform;
            transformSender.BoneTransform    = torsoTransform;
        }

        //Adicionar os trails como filho para o bone certo
        GameObject tempObject = (GameObject)Instantiate(weaponPrefab, myTransform.position, Quaternion.identity);

        tempObject.transform.parent        = myTransform.Search("Bone_Hand_R");
        tempObject.transform.localPosition = Vector3.zero;
        tempObject.transform.localRotation = Quaternion.identity;
        tempObject.transform.localScale    = new Vector3(1, 1, 1);
        //------------------------------------------------

        NMGame.Instance.SendCollider(Vector3.zero, myCollider.bounds.size);
        //print (myCollider.bounds.center + "         " + myCollider.bounds.size);

        //healthHandler = GetComponent<HealthHandler>();

        //Faz com que a camera principal siga este personagem
        //PlayerStats.playerTransform = myTransform;
        //Camera.main.GetComponent<CameraSmoothFollow>().TargetTransform = transform;
        //GameObject.Find("GUICamera").GetComponent<InterfaceController>().healthHandler = healthHandler;

        //Adiciona scripts necessários a este gameObject


        charMover = myGameObject.AddComponent <CCMover>();


        charAnimator = myGameObject.AddComponent <CCFawkesAnimator>();


        inputController = myGameObject.AddComponent <CCInputController>();


        skillHandler = myGameObject.AddComponent <CCSkillHandler>();


        /*
         * myGameObject.AddComponent<CharacterWeaponHandler>();
         * weaponHandler = GetComponent<CharacterWeaponHandler>();*/

        //Inicializa variaveis
        charMover.MovementSpeed      = movementSpeed;
        charMover.InputControllerSet = inputController;
        charMover.MyTransform        = myTransform;
        charMover.MyRigidbody        = myRigidbody;
        charMover.HealthHandler      = healthHandler;
        charMover.FacingTransform    = torsoTransform;
        charMover.MovingTransform    = movingTransform;
        charMover.CharAnimator       = charAnimator;
        charMover.CharSkillHandler   = skillHandler;
        charMover.CharMotor          = motor;

        charAnimator.CharMover      = charMover;
        charAnimator.CharMotor      = motor;
        charAnimator.TorsoTransform = torsoTransform;

        /*
         * inputController.HealthHandlerSet = healthHandler;
         * inputController.SkillHandler = skillHandler;*/

        skillHandler.MyTransform                  = myTransform;
        skillHandler.MyAnimation                  = myAnimation;
        skillHandler.MyFacing                     = torsoTransform;
        skillHandler.HealthHandler                = healthHandler;
        skillHandler.CharMover                    = charMover;
        skillHandler.DamageCollider               = damageCollider;
        skillHandler.DamageColliderConstant       = damageColliderConstant;
        skillHandler.PlaceholderDamageFront       = placeholderDamageFront;
        skillHandler.PlaceholderDamageFrontGround = placeholderDamageFrontGround;
        skillHandler.PlaceholderSpellHand         = placeholderSpellHand;
        skillHandler.PlaceholderFrontDirection    = placeholderFrontDirection;
        //skillHandler.ClipOnCooldown = clipSkillOnCooldown;
        //skillHandler.intController = GameObject.Find("GUICamera").GetComponent<InterfaceController>();

        /*
         * weaponHandler.MainHandTransform = mainHandTransform;
         * weaponHandler.OffHandTransform = offHandTransform;*/

        PlayerStats.playerTransform = myTransform;
    }