Ejemplo n.º 1
0
 //aktualnie uzywany w rece przedmiot ma byc rzucony na ziemie
 public void DropUsedItem()
 {
     if (UsedItem != null)
     {
         UsedItem.GetComponent <ActiveObject>().ClearUsedObject();
         ActiveObjectsManager.Instance.AddActiveObject(UsedItem.GetComponent <ActiveObject>());
         UsedItem.GetComponent <SceneItem>().PrepareToThrowOut();
     }
 }
Ejemplo n.º 2
0
        public string AsLimitableStringWithTypes(bool withExampleInfo, bool threeLines, int maxLength = 600)
        {
            string nl          = threeLines ? Environment.NewLine + "    " : "";
            string exampleInfo = withExampleInfo ? ExampleInfo : null;
            string markers     = MarkerSet.AsFullString(maxLength / 3);

            return($"{UsingItem.AsFullString(maxLength / 3)} "
                   + nl + $"{DIP_ARROW} {markers};{Ct};{QuestionableCt};{BadCt};{Source?.AsDipString()};{exampleInfo} "
                   + nl + $"{DIP_ARROW} {UsedItem.AsFullString(maxLength / 3)}");
        }
Ejemplo n.º 3
0
        public int GetFiringAccuracy()
        {
            int modeDivider = _alternateModeInProgress ? 3 : 1;

            if (UsedItem != null && UsedItem.GetComponent <SceneWeapon>() != null && UsedItem.GetComponent <SceneWeapon>().WeaponData != null)
            {
                return((int)(((int)UsedItem.GetComponent <SceneWeapon>().WeaponData["accuracy"]) * (_isRunning ? RUNNING_INACCURACY : (_isWalking ? WALKING_INACCURACY : 1)) / modeDivider + 15));
            }
            return(15);
        }
Ejemplo n.º 4
0
        public void PerformAction(bool alternate = false)
        {
            _alternateModeInProgress = alternate;
            if (UsedItem != null && UsedItem.GetComponent <SceneWeapon>() != null)
            {
                SceneWeapon sw = UsedItem.GetComponent <SceneWeapon>();
                if (alternate && sw.WeaponData.IsThrowWeapon && !sw.IsAttacking && !_mainAnimator.GetCurrentAnimatorStateInfo(0).IsName("Throw"))
                {
                    sw.IsAttacking       = true;
                    sw.CurrentAttackMode = FightSystem.AttackMode.ThrowAttack;
                    _mainAnimator.SetTrigger("Throw");
                    sw.PrepareToThrowAsWeapon((float)sw.WeaponData["throwForce"]);
                    UsedItem.GetComponent <ActiveObject>().ClearUsedObject();
                    ActiveObjectsManager.Instance.AddActiveObject(UsedItem.GetComponent <ActiveObject>());
                    FPPUIManager.Instance.InventoryObject.RemoveItemAfterThrow();
                    UsedItem = null;
                }
                else if (!alternate && sw.WeaponData.IsMeleeWeapon && !sw.IsAttacking && !_mainAnimator.GetCurrentAnimatorStateInfo(0).IsName("Attack") && !_mainAnimator.GetCurrentAnimatorStateInfo(0).IsName("Attack(2)"))
                {
                    sw.IsAttacking       = true;
                    sw.CurrentAttackMode = FightSystem.AttackMode.MeleeAttack;
                    string trigStr = Random.Range(0, 2) == 0 ? "Attack" : "Attack2";
                    _mainAnimator.SetTrigger(trigStr);
                }
                else if (!alternate && sw.WeaponData.IsShootingWeapon && !sw.IsAttacking)
                {
                    sw.IsAttacking       = true;
                    sw.CurrentAttackMode = FightSystem.AttackMode.ShootScanAttack;
                    //string trigStr = Random.Range(0, 2) == 0 ? "Attack" : "Attack2";
                    if (sw.WeaponData.CurrentFireMode == FightSystem.FireMode.Single)
                    {
                        _mainAnimator.SetTrigger("Shoot");
                    }
                    else
                    {
                        _mainAnimator.SetTrigger("AutoShoot");
                    }
                    _autofireShots = 1;
                    PerformScanHit();
                }

/* ???                else if (sw == null && !UsedItem.IsAttacking && !_mainAnimator.GetCurrentAnimatorStateInfo(0).IsName("Get"))
 *              {
 *                  _mainAnimator.SetTrigger("Get");
 *              }*/
            }
        }
Ejemplo n.º 5
0
 public void PerformScanHit()
 {
     if (UsedItem != null)
     {
         SceneWeapon sw = UsedItem.GetComponent <SceneWeapon>();
         if (sw != null && UsedItem.ItemData != null && sw.IsAttacking)
         {
             if (sw.WeaponData.IsMeleeWeapon && sw.WeaponData["scanHit"] != null && (bool)sw.WeaponData["scanHit"] == true)
             {
                 SceneWeaponHitter[] hitters = UsedItem.GetComponentsInChildren <SceneWeaponHitter>();
                 Vector3             hitPoint;
                 GameObject          hited = FPPUIManager.Instance.CameraLooksOnScanHit((float)sw.WeaponData["meleeRange"], GetFiringAccuracy(), out hitPoint);
                 if (hited != null && hited.GetComponent <SceneDestructible>() != null)
                 {
                     foreach (SceneWeaponHitter swh in hitters)
                     {
                         swh.GeneralHited(hited.GetComponent <SceneDestructible>(), hitPoint);
                     }
                 }
                 sw.IsAttacking = false;
             }
             else
             if (sw.WeaponData.IsShootingWeapon && sw.CurrentAttackMode == FightSystem.AttackMode.ShootScanAttack && sw.WeaponData["scanHit"] != null && (bool)sw.WeaponData["scanHit"] == true)
             {
                 SceneWeaponHitter[] hitters = UsedItem.GetComponentsInChildren <SceneWeaponHitter>();
                 Vector3             hitPoint;
                 GameObject          hited = FPPUIManager.Instance.CameraLooksOnScanHit((float)sw.WeaponData["shootRange"], GetFiringAccuracy(), out hitPoint);
                 if (hited != null)
                 {
                     SceneDestructible hitesDestr = FindDestructibleObject(hited);
                     if (hitesDestr != null)
                     {
                         foreach (SceneWeaponHitter swh in hitters)
                         {
                             swh.GeneralHited(hitesDestr, hitPoint);
                         }
                     }
                 }
                 sw.InvokeShootEffects();
             }
         }
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// A message presented to the user if this Dependency has a <see cref="BadCt"/>or <see cref="QuestionableCt"/>.
 /// </summary>
 /// <returns></returns>
 public string NotOkMessage(bool simpleRuleOutput, bool newLine, int maxLength = 600)
 {
     if (simpleRuleOutput)
     {
         return($"{UsingItem.AsString()} ---? {UsedItem.AsString()}");
     }
     else
     {
         string prefix = BadCt > 0
             ? QuestionableCt > 0 ? "Bad and questionable d" : "Bad d"
             : QuestionableCt > 0 ? "Questionable d" : "D";
         string nounTail = Ct > 1 ? "ependencies" : "ependency";
         string reason   = string.IsNullOrWhiteSpace(NotOkReason) ? "" : " detected by " + NotOkReason;
         string brk      = newLine ? Environment.NewLine + "    " : "";
         string ct       = BadCt > 0
             ? QuestionableCt > 0 ? $";{QuestionableCt};{BadCt}" : $";;{BadCt}"
             : QuestionableCt > 0 ? $";{QuestionableCt};" : ";;";
         string markers = MarkerSet.AsFullString(maxLength / 3);
         return
             ($"{prefix}{nounTail}{reason}: {brk}{UsingItem.AsFullString(maxLength / 3)}{brk}-- {ct}{markers}{brk}-> {UsedItem.AsFullString(maxLength / 3)}" +
              (Source != null ? $" {brk}" + (Ct > 1 ? "(e.g. at " : "(at ") + Source + ")" : "") +
              (newLine ? Environment.NewLine : ""));
     }
 }
Ejemplo n.º 7
0
        private void Update()
        {
            /*
             * if (_mainAnimator.GetCurrentAnimatorStateInfo(0).IsName("Attack"))
             *  Debug.Log("Attack");
             * if (_mainAnimator.GetCurrentAnimatorStateInfo(0).IsName("Attack(2)"))
             *  Debug.Log("Attack(2)");
             * if (_mainAnimator.GetCurrentAnimatorStateInfo(0).IsName("Idle"))
             *  Debug.Log("Idle");
             * if (_mainAnimator.GetCurrentAnimatorStateInfo(0).IsName("Idle_Other"))
             *  Debug.Log("Idle_Other");
             */
            _alternateModeInProgress = FPPUIManager.Instance.IsActionInProgress(false);
            GameManager.Instance.ThePlayerController.SetCameraFOV(_alternateModeInProgress ? int.Parse(EJRConsts.Instance["preciseTargetFov"]) : int.Parse(EJRConsts.Instance["defaultTargetFov"]));

            //auto fire
            if (UsedItem != null)
            {
                SceneWeapon sw = UsedItem.GetComponent <SceneWeapon>();
                if (sw != null && !sw.IsAttacking && _mainAnimator.GetCurrentAnimatorStateInfo(0).IsName("AutoShoot"))
                {
                    if (FPPUIManager.Instance.IsActionInProgress(true) && (sw.WeaponData.CurrentFireMode != FightSystem.FireMode.Triple || _autofireShots < 3))
                    {
                        sw.IsAttacking       = true;
                        sw.CurrentAttackMode = FightSystem.AttackMode.ShootScanAttack;
                        _autofireShots++;
                        PerformScanHit();
                    }
                    else
                    {
                        sw.IsAttacking = false;
                        _mainAnimator.SetTrigger("StopAttack");
                    }
                }
            }
        }
Ejemplo n.º 8
0
 public void SwitchWeaponMode()
 {
     if (UsedItem != null)
     {
         SceneWeapon sw = UsedItem.GetComponent <SceneWeapon>();
         if (sw != null && sw.WeaponData.IsShootingWeapon)
         {
             if (sw.WeaponData.CurrentFireMode == FightSystem.FireMode.Single)
             {
                 if (sw.WeaponData.TripleFireModeEnabled)
                 {
                     sw.WeaponData.CurrentFireMode = FightSystem.FireMode.Triple;
                 }
                 else if (sw.WeaponData.AutoFireModeEnabled)
                 {
                     sw.WeaponData.CurrentFireMode = FightSystem.FireMode.Auto;
                 }
             }
             else if (sw.WeaponData.CurrentFireMode == FightSystem.FireMode.Triple)
             {
                 if (sw.WeaponData.AutoFireModeEnabled)
                 {
                     sw.WeaponData.CurrentFireMode = FightSystem.FireMode.Auto;
                 }
                 else
                 {
                     sw.WeaponData.CurrentFireMode = FightSystem.FireMode.Single;
                 }
             }
             else if (sw.WeaponData.CurrentFireMode == FightSystem.FireMode.Auto)
             {
                 sw.WeaponData.CurrentFireMode = FightSystem.FireMode.Single;
             }
         }
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Called after a <see cref="API.Features.Player"/> used a medical item.
 /// </summary>
 /// <param name="ev">The <see cref="UsedItemEventArgs"/> instance.</param>
 public static void OnUsedItem(UsedItemEventArgs ev) => UsedItem.InvokeSafely(ev);
Ejemplo n.º 10
0
 public override string ToString()
 {
     return(UsingItem.AsFullString(50) + " --" + MarkerSet.AsFullString(50) + "-> " + UsedItem.AsFullString(50));
 }