Beispiel #1
0
        /// <summary>
        /// Draws out the primary weapon debug info
        /// </summary>
        protected void DrawWeaponDebug(IWeaponCore rWeapon, Vector3 rForward, float rHorizontalFOA, float rVerticalFOA, Color rColor)
        {
#if UNITY_EDITOR
            if (rWeapon == null)
            {
                return;
            }

            if (ShowDebug)
            {
                if (mCombatant != null)
                {
                    if (rWeapon.HasColliders)
                    {
                        WeaponCore lWeaponCore = rWeapon as WeaponCore;
                        if (lWeaponCore != null)
                        {
                            Graphics.GraphicsManager.DrawCollider(lWeaponCore.Collider as BoxCollider, rColor);
                        }
                    }
                    else
                    {
                        float lMinReach = mCombatant.MinMeleeReach + rWeapon.MinRange;
                        float lMaxReach = mCombatant.MaxMeleeReach + rWeapon.MaxRange;

                        Vector3 lCombatOrigin = mCombatant.CombatOrigin;
                        Graphics.GraphicsManager.DrawSolidFrustum(lCombatOrigin, mCombatant.Transform.rotation * Quaternion.LookRotation(rForward, mCombatant.Transform.up), rHorizontalFOA, rVerticalFOA, lMinReach, lMaxReach, rColor);
                        //Graphics.GraphicsManager.DrawText(string.Format("Weapon: {0:f1}/{1:f1}", rWeapon.Health, rWeapon.MaxHealth), rWeapon.gameObject.transform.position + (Vector3.up * 0.4f), Color.black);
                    }
                }
            }
#endif
        }
Beispiel #2
0
        /// <summary>
        /// Draws out the primary weapon debug info
        /// </summary>
        protected void DrawWeaponDebug(ICombatant rCombatant, IWeaponCore rWeapon, ICombatStyle rAttackStyle, Color rColor)
        {
#if UNITY_EDITOR
            if (rCombatant == null)
            {
                return;
            }
            if (rWeapon == null)
            {
                return;
            }

            if (ShowDebug)
            {
                if (rWeapon.HasColliders)
                {
                    WeaponCore lWeaponCore = rWeapon as WeaponCore;
                    if (lWeaponCore != null)
                    {
                        Graphics.GraphicsManager.DrawCollider(lWeaponCore.Collider as BoxCollider, rColor);
                    }
                }
                else if (rAttackStyle != null)
                {
                    float lMinReach = (rAttackStyle.MinRange > 0f ? rAttackStyle.MinRange : rCombatant.MinMeleeReach + rWeapon.MinRange);
                    float lMaxReach = (rAttackStyle.MaxRange > 0f ? rAttackStyle.MaxRange : rCombatant.MaxMeleeReach + rWeapon.MaxRange);

                    Vector3 lCombatOrigin = rCombatant.CombatOrigin;
                    Graphics.GraphicsManager.DrawSolidFrustum(lCombatOrigin, rCombatant.Transform.rotation * Quaternion.LookRotation(rAttackStyle.Forward, rCombatant.Transform.up), rAttackStyle.HorizontalFOA, rAttackStyle.VerticalFOA, lMinReach, lMaxReach, rColor);
                }
            }
#endif
        }
Beispiel #3
0
    void OnEnable()
    {
        music      = GameObject.Find("GameController").GetComponent <HERO_MusicController>();
        unitCore   = GetComponent <UnitCore>();
        inv        = GetComponent <PlayerInventory>();
        weaponCore = GetComponent <WeaponCore>();

        regionMaster = GameObject.Find("Regions").transform;

        //Ability
        actionBarT = GameObject.Find("UI/HUD/ActionBar").transform;

        if (isClient)
        {
            for (int count = 0; count < 5; count++)
            {
                abilityKeys.Add(Binds.i.GetBind("Skill " + (count + 1)).key);
            }

            for (int count = 0; count < 10; count++)
            {
                itemKeys.Add(Binds.i.GetBind("Item " + (count + 1)).key);
            }
        }

        //Mount
        mountGroup = GameObject.Find("UI/HUD/ChannelBack").GetComponent <CanvasGroup>();
        mountBar   = GameObject.Find("UI/HUD/ChannelBack/ChannelBarBack/ChannelBar").GetComponent <Image>();

        //Now pass all required values
        if (isLocalPlayer)
        {
            UI_HUD.i.target     = GetComponent <UnitCore>();
            UI_HUD.i.playerCore = UI_CharacterMenu.i.playerCore = this;
        }

        if (isServer)
        {
            availableSlots = PlayerClassToSlots(playerClass);

            for (int count = 0; count < 5; count++)
            {
                if (!equippedAbilities[count].equipped)
                {
                    RpcHUDPingAbility(count, Defs.AbilityMode.Level);
                }
            }

            int[]    skills = new int[5];
            string[] keys   = new string[5];
            for (int count = 0; count < 5; count++)
            {
                keys[count]   = abilityKeys[count].ToString();
                skills[count] = -1;
            }
            RpcActionBar_Rebuild(skills, keys);
        }
    }
 internal void SetWeaponCore(WeaponCore carriedWeapon, GameObject carrier)
 {
     Roll3();
     gameObject.SetActive(true);
     Time.timeScale = 0.01f;
     CollectiveInputManager.instance.isMouseInputEnabled = false;
     adventurer             = carrier;
     selectedCore           = carriedWeapon;
     WeaponCoreImage.sprite = carriedWeapon.Sprite;
     WeaponCoreText.text    = carriedWeapon.Name;
 }
Beispiel #5
0
 public void GrabStart(CustomHand hand)
 {
     if (weaponController)
     {
         IEnumerator coroutine = weaponController.DetachDelay(.25f, false);
         weaponController.StartCoroutine(coroutine);
         transform.parent             = null;
         weaponController.attachedMag = null;
         weaponController             = null;
         gameObject.layer             = defaultLayer;
         stikingAmmo.layer            = defaultLayer;
     }
 }
 private void CheckForCompletion()
 {
     if (selectedCore == null || selectedPrefix == null || selectedSufix == null)
     {
         return;
     }
     BuildWeapon();
     selectedCore   = null;
     selectedPrefix = null;
     selectedSufix  = null;
     adventurer     = null;
     foreach (var button in prefixButtons)
     {
         button.gameObject.SetActive(true);
     }
     foreach (var button in sufixButtons)
     {
         button.gameObject.SetActive(true);
     }
     Time.timeScale = 1;
     CollectiveInputManager.instance.isMouseInputEnabled = true;
     gameObject.SetActive(false);
 }
Beispiel #7
0
 /// <summary>
 /// Called when the object is selected in the editor
 /// </summary>
 private void OnEnable()
 {
     // Grab the serialized objects
     mTarget   = (WeaponCore)target;
     mTargetSO = new SerializedObject(target);
 }
Beispiel #8
0
 public Source(UnitCore Causer, Item Weapon, WeaponCore Core)
 {
     causer = Causer;
     type   = Type.Weapon;
     weapon = Weapon;
 }
 public void SetWeaponCore(WeaponCore core)
 {
     WeaponCore = core;
     WeaponSpriteRenderer.sprite = core.Sprite;
     GetComponent <AttackType>().Animator.speed = core.Speed;
 }