Ejemplo n.º 1
0
        public void ChangeTarget(Targetable target)
        {
            Targetable oldTarget = this.target;

            this.target = target;
            OnTarget?.Invoke(this, target, oldTarget);
        }
Ejemplo n.º 2
0
        private void Target()
        {
            if (!Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out var hit, Mathf.Infinity))
            {
                return;
            }

            var target = hit.transform.GetComponent <ISelectable>();

            if (target != null)
            {
                StartCoroutine(target.Highlight());

                OnTarget?.Invoke(target);
            }
            else
            {
                if (SelectedUnits[0].Team == m_Team)
                {
                    OnRightClick?.Invoke(hit.point + new Vector3(0, 0.25f, 0));
                }

                Group(hit.point.With(y: 0), SelectedUnits);
            }
        }
Ejemplo n.º 3
0
        private void onRadarMuxTrack(RadarMuxTrack track)
        {
            OnTarget callback = TargetEvent;

            if (callback != null)
            {
                callback(track);
            }
        }
Ejemplo n.º 4
0
        private void fireOnTarget(int id, double lat, double lon, double sog, double cog)
        {
            OnTarget callback = TargetEvent;

            if (callback != null)
            {
                callback(id, lat, lon, sog, cog);
            }
        }
Ejemplo n.º 5
0
        private void fireOnTarget(int id, double lat, double lon, double sog, double cog, int mmsi, string name)
        {
            OnTarget callback = TargetEvent;

            if (callback != null)
            {
                callback(id, lat, lon, sog, cog, mmsi, name);
            }
        }
Ejemplo n.º 6
0
        protected virtual void CombatLogicUpdate()
        {
            if (!rider.IsRiding)
            {
                return;                                                                                 //Just work while is in the horse
            }
            if (!IsAiming)
            {
                MountStartRotation = MountPoint.localRotation;                                          //Take the Start Local Rotation of the Link to Easily Return to it when finish AIMING
            }
            CalculateCameraTargetSide();

            if (UseHolders)
            {
                Toogle_Weapon();                                                                        //Call Tooge Weapon (to change between weapons)
            }
            if (isInCombatMode)                                                                         //If there's a Weapon Active
            {
                Anim.speed = 1;                                                                         //Set  Animator Speed back
                Anim.SetInteger(Hash.IDInt, -1);                                                        //Remove the IntID so the attack while  ??/?????

                if (ActiveAbility)
                {
                    if (Active_IMWeapon != null && Active_IMWeapon.Active)
                    {
                        if (ActiveAbility.WeaponType() != GetWeaponType())
                        {
                            ActiveAbility = CombatAbilities.Find(ability => ability.WeaponType() == GetWeaponType()); //Find the Ability for the IMWeapon
                        }
                    }
                    if (ActiveAbility.CanAim())
                    {
                        AimMode();
                    }

                    if (InputAttack1.GetInput) /*Gets the Input from the Primary Attack INPUT*/ } {
                    if (InputAttack2.GetInput)  /*Gets the Input from the Secondary Attack INPUT*/
                    {
                    }
                    if (Reload.GetInput) /*Gets the Input from the Reload INPUT*/ } {
                    ActiveAbility.UpdateAbility();                                                    //Update The Active Ability
            }
        }


        //Used for Invoke On Target
        if (Target != lastTarget)
        {
            OnTarget.Invoke(Target);
            lastTarget = Target;

            if (rider.AnimalControl && StrafeOnTarget)
            {
                rider.AnimalControl.CameraBaseInput = Target ? true : DefaultMonturaInputCamBaseInput;
            }
        }
    }
 public CharacterActionEvent(OnTarget actionOnTarget)
 {
     Act         = Action.OnTarget;
     ActOnTarget = actionOnTarget;
 }
Ejemplo n.º 8
0
        protected virtual void CombatLogicUpdate()
        {
            if (!rider.IsRiding)
            {
                return;                                                                                 //Just work while is in the horse
            }
            if (!isAiming)
            {
                MountStartRotation = MountPoint.localRotation;                                          //Take the Start Local Rotation of the Link to Easily Return to it when finish AIMING
            }
            float TargetSide = 0;
            float CameraSide = 0;

            if (Target)
            {
                TargetSide = Vector3.Dot((_transform.position - Target.position).normalized, _transform.right); //Calculate the side from the Target
            }
            if (_cam)
            {
                CameraSide = Vector3.Dot(_cam.transform.right, _transform.forward);                     //Get the camera Side Float
            }
            this.TargetSide = TargetSide > 0;                                                           //Get the camera Side Left/Right
            this.CameraSide = CameraSide > 0;

            if (UseHolders)
            {
                Toogle_Weapon();                                                                        //Call Tooge Weapon (to change between weapons)
            }
            if (isInCombatMode)                                                                         //If there's a Weapon Active
            {
                Anim.speed = 1;                                                                         //Set  Animator Speed back to 1
                Anim.SetInteger(Hash.IDInt, -1);                                                        //Remove the IntID so the attack while

                if (ActiveAbility)
                {
                    if (Active_IMWeapon != null)
                    {
                        if (ActiveAbility.WeaponType() != GetWeaponType())
                        {
                            ActiveAbility = CombatAbilities.Find(ability => ability.WeaponType() == GetWeaponType()); //Find the Ability for the IMWeapon
                        }
                    }
                    if (ActiveAbility.CanAim())
                    {
                        AimMode();
                    }

                    ActiveAbility.UpdateAbility();                                                    //Update The Active Ability
                }
            }


            //Used for Invoke On Target
            if (Target != lastTarget)
            {
                OnTarget.Invoke(Target);
                lastTarget = Target;

                if (rider.AnimalControl && StrafeOnTarget)
                {
                    rider.AnimalControl.cameraBaseInput = Target ? true : DefaultMonturaInputCamBaseInput;
                }
            }
        }
Ejemplo n.º 9
0
 public InternalTarget(OnTarget onTarget, OnCancel onCancel) : base(-1, true, TargetFlags.None)
 {
     this.onTarget = onTarget;
     this.onCancel = onCancel;
 }