Пример #1
0
 public void Deactivate()
 {
     IsFinished           = false;
     LineRenderer.enabled = false;
     BullsEye.SetActive(false);
     IsBeingThrown = false;
 }
Пример #2
0
        private void Update()
        {
            if (PlayerSkillManager.Singleton.SkillInUse == SkillInUse)
            {
                if (!IsBeingThrown)
                {
                    if (!BullsEye.activeInHierarchy)
                    {
                        BullsEye.SetActive(true);
                    }

                    if (!LineRenderer.enabled)
                    {
                        LineRenderer.enabled = true;
                    }
                }

                LaunchPosition = transform.position;

                if (!TargetAvailable())
                {
                    SetTargetLocation();
                }

                if (Input.GetMouseButtonUp(0) && !HasTarget && !IsBeingThrown)
                {
                    HasTarget            = true;
                    IsBeingThrown        = true;
                    LineRenderer.enabled = false;
                    BullsEye.SetActive(false);
                    LaunchPosition  = transform.position + Vector3.up * 2;
                    TargetRigidbody = Instantiate(ObjectToThrow, LaunchPosition, Quaternion.identity).GetComponent <Rigidbody>();

                    if (ApplyRandomRotation)
                    {
                        TargetRigidbody.angularVelocity = Random.insideUnitSphere * 5;
                    }
                    //ApplyRandomRotation(targetRigidbody);

                    Throw();
                    HasTarget = false;
                    if (!PlayerSkillManager.Singleton.InfiniteSkill)
                    {
                        RemainingUsage--;
                    }

                    RemainingUsageText.text = RemainingUsage.ToString();

                    if (RemainingUsage == 0)
                    {
                        IconImage.color = Color.gray;
                    }

                    PlayerSkillManager.Singleton.SkillInUse = SkillInUse.None;
                    Deactivate();
                }
            }
        }
Пример #3
0
        void Update()
        {
            if (PlayerSkillManager.Singleton.SkillInUse == SkillInUse.Jump)
            {
                if (!IsBeingThrown)
                {
                    if (!BullsEye.activeInHierarchy)
                    {
                        BullsEye.SetActive(true);
                    }
                    if (!LineRenderer.enabled)
                    {
                        LineRenderer.enabled = true;
                    }
                }


                LaunchPosition = transform.position;

                if (!TargetAvailable())
                {
                    SetTargetLocation();
                }

                if (Input.GetMouseButtonUp(0) && !HasTarget && !IsBeingThrown)
                {
                    BullsEye.SetActive(false);
                    HasTarget                = true;
                    LineRenderer.enabled     = false;
                    IsBeingThrown            = true;
                    IsFinished               = false;
                    _playerMovement.Disabled = true;

                    _playerAnimator.SetBool("jumping", true);
                    transform.LookAt(Target);
                }
            }
        }