Ejemplo n.º 1
0
        public override void OnEnabled(Animator anim)
        {
            Events = new ThrowingEvents();
            TriggS = new LayersWithDefValue <SystemTrigger>(new ThrowSystemTriggers());

            transform    = userInput.transform;
            playerCamera = userInput.cameraRig.GetComponent <PlayerCamera>();
            animator     = transform.GetComponent <Animator>();

            foreach (Transform t in transform.GetComponentsInChildren <Transform>())
            {
                if (t.CompareTag("LeftHandHold"))
                {
                    leftHandHold = t.FindChild("PosRotFixer");
                }
                if (t.CompareTag("RightHandHold"))
                {
                    rightHandHold2 = t.FindChild("PosRotFixer2");
                }
            }

            foreach (Transform tr in userInput.cameraRig.GetComponentsInChildren <Transform>())
            {
                if (tr.CompareTag("Target"))
                {
                    refTarget = tr;
                }
            }
            if (userInput && userInput.cameraRig)
            {
                foreach (var trn in userInput.cameraRig.GetComponentsInChildren <Transform>())
                {
                    if (trn.name == "TurnTo Reference")
                    {
                        TurnToReference = trn;
                    }
                }
            }
            if (!rightHandHold2)
            {
                Debug.Log("PosRotFixer2 not found, mirrored throw wont work properly...");
            }
            if (!leftHandHold || !playerCamera || !animator)
            {
                userInput.DisablePlayer("Needed transform not found in " + ToString());
                return;
            }

            player.onIsHandOnBomb  += HandOnBomb;
            player.onIsHandOffBomb += HandOffBomb;

            player.throwableBag.RemoveAll(x => x.haveCount <= 0 || x.throwablePrefab == null);

            CurrentThrowableIndex = player.defaultThrowableIndex >= player.throwableBag.Count ? -1 : player.defaultThrowableIndex;
            if (GetStyleOfIndex(CurrentThrowableIndex) != -1)
            {
                SetThrowable(CurrentThrowableIndex);
            }
            nextThrowableIndex = CurrentThrowableIndex;
        }
Ejemplo n.º 2
0
        public override void OnEnabled(Animator anim)
        {
            if (userInput.transform.FindChild("CoverChecker"))
            {
                coverChecker = player.transform.FindChild("CoverChecker").GetComponent <CoverTargetLogic>();
            }
            animator  = userInput.GetComponent <Animator>();
            transform = userInput.transform;
            if (userInput.cameraRig)
            {
                moveReference = userInput.cameraRig.FindChild("Move Reference");
                playerCamera  = userInput.cameraRig.GetComponent <PlayerCamera>();
            }

            foreach (Transform tr in userInput.cameraRig.GetComponentsInChildren <Transform>())
            {
                if (tr.CompareTag("Target"))
                {
                    RefTarget = tr;
                }
            }

            Events = new CoveringEvents();

            if (!coverChecker || !animator || !transform || !moveReference || !RefTarget || !playerCamera || player.defaultCoverStyleIndex >= player.coverStyles.Count)
            {
                userInput.DisablePlayer("Reference not found on :" + ToString());
            }

            TriggS = new LayersWithDefValue <SystemTrigger>(new CoverSystemTriggers());

            LayerWeightTarget = 0;
        }
Ejemplo n.º 3
0
        public override void OnEnabled(Animator anim)
        {
            TriggS            = new LayersWithDefValue <SystemTrigger>(new LocomotionSystemTriggers());
            AllowSprint       = true;
            IsMovingWithAgent = false;
            Locomotion_Events = new LocomotionEvents();
            transform         = userInput.transform;
            rb       = userInput.GetComponent <Rigidbody>();
            agent    = userInput.GetComponent <UnityEngine.AI.NavMeshAgent>();
            animator = userInput.GetComponent <Animator>();
            if (userInput.cameraRig)
            {
                moveReference = userInput.cameraRig.Find("Move Reference");
            }

            Transform TurnToReference = null;

            if (userInput && userInput.cameraRig)
            {
                foreach (var trn in userInput.cameraRig.GetComponentsInChildren <Transform>())
                {
                    if (trn.name == "TurnTo Reference")
                    {
                        TurnToReference = trn;
                    }
                }
            }
            if (!moveReference || !rb || !animator || (player.useStaticMovement && !TurnToReference))
            {
                userInput.DisablePlayer("Needed reference not found:" + ToString());
            }

            if (player.useStaticMovement)
            {
                TurnToTransform = TurnToReference;
                LocomTypeDict   = new LayersWithDefValue <LocomotionParams>(new LocomoteStaticParams(TurnToReference, player.defaultLocomStyleIndex), "Locomotion");
            }
            else
            {
                LocomTypeDict = new LayersWithDefValue <LocomotionParams>(new LocomoteFreeParams(player.defaultLocomStyleIndex), "Locomotion");
            }
            LocomType = player.useStaticMovement ? PredefinedLocomType.StaticWithKeys : PredefinedLocomType.FreeWithKeys;
        }
Ejemplo n.º 4
0
 public override void OnEnabled(Animator anim)
 {
     LookAtTypeDict = new LayersWithDefValue <LookAtParams>(new LookAtParams(player.defaultLookAtIKStyleIndex), "LookIK");
     LookEvents     = new LookIKEvents();
 }
Ejemplo n.º 5
0
 private void Awake()
 {
     camTypeDict = new LayersWithDefValue <CameraModderParamsBase>(new ThirdPersonCameraParams(), "Camera");
     cameraType  = CamType.ThirdPerson;
 }