protected void CoverEnter(int coverIndex, E_CoverDirection coverDirection, uLink.NetworkMessageInfo info)
    {
        Cover cover = Mission.Instance.GameZone.GetCover(coverIndex);

        if (cover == null)
        {
            Debug.LogWarning("Received CoverEnter RPC but no cover was found at the specified position. This could indicate a position sync problem.");
            return;
        }

#if !DEADZONE_CLIENT
        if (Owner.IsServer)
        {
            //Only server has the right to ignore the cover enter
            if (Owner.BlackBoard.DontUpdate)
            {
                return;
            }

            ServerAnticheat.ReportCoverEnter(Owner.NetworkView.owner, cover, coverDirection, info);
            Owner.NetworkView.RPC("CoverEnter", uLink.RPCMode.OthersExceptOwner, coverIndex, coverDirection);
        }
#endif

        Owner.CoverStart(cover, coverDirection);
    }
    protected void UseItemInCover(E_ItemID gadget, E_CoverPose coverPose, E_CoverDirection coverDirection, uLink.NetworkMessageInfo info)
    {
        if (Owner.BlackBoard.DontUpdate)
        {
            return;
        }

#if !DEADZONE_CLIENT
        if (Owner.IsServer)
        {
            ServerAnticheat.ReportUseItemInCover(Owner.NetworkView.owner, gadget, coverPose, coverDirection, info);
            Owner.NetworkView.RPC("UseItemInCover", uLink.RPCMode.OthersExceptOwner, gadget, coverPose, coverDirection);
        }
#endif

        Owner.BlackBoard.KeepMotion     = false;
        Owner.BlackBoard.Desires.Gadget = gadget;

        AgentActionUseItem a = AgentActionFactory.Create(AgentActionFactory.E_Type.UseItem) as AgentActionUseItem;

        a.CoverDirection = coverDirection;
        a.CoverPose      = coverPose;

        Owner.BlackBoard.ActionAdd(a);

        Owner.WorldState.SetWSProperty(E_PropKey.AtTargetPos, true);
    }
Beispiel #3
0
        public void Reset()
        {
            IsValid       = false;
            Death         = false;
            CurrentWeapon = E_WeaponID.None;

            Cover         = null;
            CoverPosition = E_CoverDirection.Unknown;
            CoverFiring   = false;
        }
Beispiel #4
0
    public override string GetCoverAnim(E_CoverAnim type, E_CoverPose pose, E_CoverDirection direction)
    {
        switch (type)
        {
        case E_CoverAnim.Enter:
            return(pose == E_CoverPose.Stand ? "CoverStandEnter" : "CoverCrouchEnter");

        case E_CoverAnim.Leave:
            return(pose == E_CoverPose.Stand ? "CoverStandLeave" : "CoverCrouchLeave");

        case E_CoverAnim.AimStart:
            switch (direction)
            {
            case E_CoverDirection.Left:
                return(pose == E_CoverPose.Stand ? "CoverStandAimLeftStart" : "CoverCrouchAimLeftStart");

            case E_CoverDirection.Right:
                return(pose == E_CoverPose.Stand ? "CoverStandAimRightStart" : "CoverCrouchAimRightStart");

            default:
                return(pose == E_CoverPose.Stand ? "" : "CoverCrouchAimCenterStart");
            }

        case E_CoverAnim.AimEnd:
            switch (direction)
            {
            case E_CoverDirection.Left:
                return(pose == E_CoverPose.Stand ? "CoverStandAimLeftBack" : "CoverCrouchAimLeftBack");

            case E_CoverDirection.Right:
                return(pose == E_CoverPose.Stand ? "CoverStandAimRightBack" : "CoverCrouchAimRightBack");

            default:
                return(pose == E_CoverPose.Stand ? "" : "CoverCrouchAimCenterBack");
            }

        case E_CoverAnim.JumpOver:
            return("JumpOverToIdle");

        case E_CoverAnim.JumpUp:
            return("CoverCrouchJumpUp");

        case E_CoverAnim.LeaveLeft:
            return(pose == E_CoverPose.Stand ? "CoverStandLeftLeave" : "CoverCrouchLeftLeave");

        case E_CoverAnim.LeaveRight:
            return(pose == E_CoverPose.Stand ? "CoverStandRightLeave" : "CoverCrouchRightLeave");
        }

        throw new System.ArgumentOutOfRangeException();
    }
Beispiel #5
0
 public Vector3 GetEyePos(E_CoverDirection pos)
 {
     if (pos == E_CoverDirection.Middle)
     {
         return(EyeMiddle);
     }
     else if (pos == E_CoverDirection.Left)
     {
         return(EyeLeftEdge);
     }
     else
     {
         return(EyeRightEdge);
     }
 }
Beispiel #6
0
    bool IsPositionOccupied(E_CoverDirection position)
    {
        switch (position)
        {
        case E_CoverDirection.Left:
            return(IsLeftAllowed == false || LeftAgents.Count > 0);

        case E_CoverDirection.Right:
            return(IsRightAllowed == false || RightAgents.Count > 0);

        case E_CoverDirection.Middle:
            return(IsMiddleAllowed == false || MiddleAgents.Count > 0);
        }

        return(true);
    }
Beispiel #7
0
    public override string GetGadgetAnim(E_ItemID gadget, E_CoverPose coverPose, E_CoverDirection coverDirection)
    {
        ItemSettings setting = ItemSettingsManager.Instance.Get(gadget);

        switch (setting.ItemBehaviour)
        {
// FIX IT
        case E_ItemBehaviour.Throw:
            if (BlackBoard.Cover)
            {
                if (coverDirection == E_CoverDirection.Middle)
                {
                    return(coverPose == E_CoverPose.Stand ? "" : "CoverCrouchThrowCenter");
                }
                else if (coverDirection == E_CoverDirection.Left)
                {
                    return(coverPose == E_CoverPose.Stand ? "CoverStandThrowLeft" : "CoverCrouchThrowLeft");
                }
                else if (coverDirection == E_CoverDirection.Right)
                {
                    return(coverPose == E_CoverPose.Stand ? "CoverStandThrowRight" : "CoverCrouchThrowRight");
                }
            }
            else
            {
                return("RunThrow");                //now we're using the same half-body anim for both idle and move

/*					if ( BlackBoard.MotionType == E_MotionType.Walk || BlackBoard.MotionType == E_MotionType.Run )
 *                                              return "RunThrow";
 *                                      else
 *                      return "IdleThrow";
 */
            }
            break;

        case E_ItemBehaviour.Place:
            return("Drop");
        }

        throw new System.ArgumentOutOfRangeException(" Gadget: " + gadget + " behaviour " + setting.ItemBehaviour);
    }
Beispiel #8
0
    public void OccupyPosition(E_CoverDirection position, AgentHuman agent)
    {
        AllAgents.AddUnique(agent);

        switch (position)
        {
        case E_CoverDirection.Left:
            LeftAgents.AddUnique(agent);
            return;

        case E_CoverDirection.Right:
            RightAgents.AddUnique(agent);
            return;

        case E_CoverDirection.Middle:
            MiddleAgents.AddUnique(agent);
            return;

        case E_CoverDirection.Unknown:

            if (IsLeftAllowed)
            {
                LeftAgents.AddUnique(agent);
            }

            if (IsRightAllowed)
            {
                RightAgents.AddUnique(agent);
            }

            if (IsMiddleAllowed)
            {
                MiddleAgents.AddUnique(agent);
            }

            break;
        }
    }
Beispiel #9
0
        public void Reset()
        {
            MoveDirection     = Vector3.zero;
            FireDirection     = Vector3.zero;
            WalkOnly          = false;
            Sprint            = false;
            MoveSpeedModifier = 1;
            CoverSelected     = null;
            CoverPosition     = E_CoverDirection.Unknown;

            CoverNear.Reset();

            InteractionObject       = null;
            Animation               = null;
            Weapon                  = E_WeaponID.None;
            Gadget                  = E_ItemID.None;
            WeaponTriggerOn         = false;
            WeaponTriggerUp         = false;
            WeaponTriggerUpDisabled = true;

            MeleeTarget    = null;
            MeleeTriggerOn = false;
            RollDirection  = E_Direction.None;
        }
    protected void CoverFireStart(E_CoverPose pose, E_CoverDirection direction, uLink.NetworkMessageInfo info)
    {
        if (Owner.BlackBoard.DontUpdate)
        {
            return;
        }

#if !DEADZONE_CLIENT
        if (Owner.IsServer)
        {
            ServerAnticheat.ReportCoverFireStart(Owner.NetworkView.owner, pose, direction, info);
            Owner.NetworkView.RPC("CoverFireStart", uLink.RPCMode.OthersExceptOwner, pose, direction);
        }
#endif

        if (Owner.IsInCover)
        {
            AgentActionCoverFire action = AgentActionFactory.Create(AgentActionFactory.E_Type.CoverFire) as AgentActionCoverFire;
            action.CoverPose      = pose;
            action.CoverDirection = direction;

            Owner.BlackBoard.ActionAdd(action);
        }
    }
Beispiel #11
0
 public abstract string GetCoverAnim(E_CoverAnim type, E_CoverPose pose, E_CoverDirection direction);
Beispiel #12
0
    public void Reset()
    {
        Desires.Reset();
        ProxyDataForSpawn.Reset();

        for (int i = 0; i < m_ActiveActions.Count; i++)
        {
            ActionDone(m_ActiveActions[i]);
        }

        m_ActiveActions.Clear();

        Stop       = false;
        MotionType = E_MotionType.None;
        MoveType   = E_MoveType.None;

//		Speed = 0;	//ciphered below

        Health = RealMaxHealth;

        IdleTimer     = 0;
        CoverTime     = 0;
        Cover         = null;
        CoverPosition = E_CoverDirection.Unknown;
        CoverFire     = false;

        MoveDir = Vector3.zero;

        FireDir = Owner.Transform.forward;

        Desires.Rotation      = Owner.Transform.rotation;
        Desires.FireDirection = Owner.Transform.forward;

        InteractionObject = null;

        Invulnerable   = false;
        AbsorbedDamage = 0;
        ReactOnHits    = true;
        BusyAction     = false;
        DontUpdate     = false;
        InKnockDown    = false;
        LastInjuryTime = 0;

        KeepMotion = false;
        IsDetected = false;

        AttackersDamageData.Clear();

        //mangle values
//		Debug.Log ("SPEED 3: Reset, m_MaxRunSpeed=" + BaseSetup.m_MaxRunSpeed + ", MaxRunSpeed=" + BaseSetup.MaxRunSpeed + ", Speed=" + Speed + ", CIPHER=0x" + string.Format("{0:X}", BaseSetup.Cipher1) );

        float run_spd  = BaseSetup.MaxRunSpeed;
        float walk_spd = BaseSetup.MaxWalkSpeed;

        BaseSetup.Cipher1      = (uint)(new System.Random(Time.frameCount).Next());
        BaseSetup.MaxRunSpeed  = run_spd;        //re-assign to re-cipher with new Cipher value
        BaseSetup.MaxWalkSpeed = walk_spd;
        Speed = 0;

//		Debug.Log ("SPEED 4: Reset, m_MaxRunSpeed=" + BaseSetup.m_MaxRunSpeed + ", MaxRunSpeed=" + BaseSetup.MaxRunSpeed + ", Speed=" + Speed + ", CIPHER=0x" + string.Format("{0:X}", BaseSetup.Cipher1) );
    }
Beispiel #13
0
 public static void ReportUseItemInCover(uLink.NetworkPlayer player, E_ItemID gadget, E_CoverPose coverPose, E_CoverDirection coverDirection, uLink.NetworkMessageInfo info)
 {
 }
Beispiel #14
0
 public static void ReportCoverFireStart(uLink.NetworkPlayer player, E_CoverPose pose, E_CoverDirection direction, uLink.NetworkMessageInfo info)
 {
 }
Beispiel #15
0
    public override string GetAimAnim(E_AimDirection direction, E_CoverPose pose, E_CoverDirection position)
    {
        if (BlackBoard.Cover != null)
        {
            switch (direction)
            {
            case E_AimDirection.Left:
                switch (position)
                {
                case E_CoverDirection.Left:
                    return(pose == E_CoverPose.Stand ? "CoverStandAimLeftMaxL" : "CoverCrouchAimLeftMaxL");

                case E_CoverDirection.Right:
                    return(pose == E_CoverPose.Stand ? "CoverStandAimRightMaxL" : "CoverCrouchAimRightMaxL");

                default:
                    return(pose == E_CoverPose.Stand ? "" : "CoverCrouchAimCenterMaxL");
                }

            case E_AimDirection.Right:
                switch (position)
                {
                case E_CoverDirection.Left:
                    return(pose == E_CoverPose.Stand ? "CoverStandAimLeftMaxR" : "CoverCrouchAimLeftMaxR");

                case E_CoverDirection.Right:
                    return(pose == E_CoverPose.Stand ? "CoverStandAimRightMaxR" : "CoverCrouchAimRightMaxR");

                default:
                    return(pose == E_CoverPose.Stand ? "" : "CoverCrouchAimCenterMaxR");
                }

            case E_AimDirection.Up:
                switch (position)
                {
                case E_CoverDirection.Left:
                    return(pose == E_CoverPose.Stand ? "CoverStandAimLeftMaxU" : "CoverCrouchAimLeftMaxU");

                case E_CoverDirection.Right:
                    return(pose == E_CoverPose.Stand ? "CoverStandAimRightMaxU" : "CoverCrouchAimRightMaxU");

                default:
                    return(pose == E_CoverPose.Stand ? "" : "CoverCrouchAimCenterMaxU");
                }

            case E_AimDirection.Down:
                switch (position)
                {
                case E_CoverDirection.Left:
                    return(pose == E_CoverPose.Stand ? "CoverStandAimLeftMaxD" : "CoverCrouchAimLeftMaxD");

                case E_CoverDirection.Right:
                    return(pose == E_CoverPose.Stand ? "CoverStandAimRightMaxD" : "CoverCrouchAimRightMaxD");

                default:
                    return(pose == E_CoverPose.Stand ? "" : "CoverCrouchAimCenterMaxD");
                }
            }
        }
        else
        {
            if (direction == E_AimDirection.Down)
            {
                return("AimD");
            }
            else if (direction == E_AimDirection.Up)
            {
                return("AimU");
            }
        }

        throw new System.ArgumentOutOfRangeException();
    }
Beispiel #16
0
 public abstract string GetAimAnim(E_AimDirection direction, E_CoverPose pose, E_CoverDirection position);
Beispiel #17
0
 public abstract string GetGadgetAnim(E_ItemID gadget, E_CoverPose pos, E_CoverDirection direction);
Beispiel #18
0
 public static void ReportCoverEnter(uLink.NetworkPlayer player, Cover cover, E_CoverDirection coverDirection, uLink.NetworkMessageInfo info)
 {
 }