Example #1
0
    void EquipMagic()
    {
        weaponEquipped.tag = "CurrentWeapon";
        controller.weapon  = weaponEquipped.transform;

        currentMagic = weaponEquipped.GetComponent <MagicWeapon>().magic;
        currentSkin  = weaponEquipped.GetComponent <MagicWeapon>().skin;

        currentMagicStance = currentMagic.GetComponent <MagicStance>();

        controller.currentMagic = currentMagicStance;

        currentSkin.transform.parent   = GameManager.instance.player.transform;
        currentSkin.transform.position = GameManager.instance.player.transform.position;
        currentSkin.transform.rotation = GameManager.instance.player.transform.rotation;

        weaponEquipped.transform.parent   = weaponHolder;
        weaponEquipped.transform.position = weaponHolder.position;

        currentMagic.transform.parent   = GameManager.instance.player.transform;
        currentMagic.transform.position = GameManager.instance.player.transform.position;
        currentMagic.transform.rotation = GameManager.instance.player.transform.rotation;

        currentMagicStance.InitializeMagic();
    }
 // Use this for initialization
 void Awake()
 {
     cameraTransform = GameObject.FindGameObjectWithTag("MainCamera").transform;
     currentMagic    = GameObject.FindGameObjectWithTag("CurrentMagic").GetComponent <MagicStance>();
     currentHeight   = heightCap - transform.position.y;
     controller      = GetComponent <Rigidbody>();
     cameraMain      = cameraTransform.GetComponent <CameraScript>();
 }