public override void Reset()
 {
     gameObject          = null;
     quality             = ObstacleAvoidanceType.NoObstacleAvoidance;
     orQualityFromString = null;
     orQualityFromInt    = null;
 }
 public void ResumeMove(ObstacleAvoidanceType obstacleAvoidanceType)
 {
     CacheNavMeshAgent.updatePosition        = true;
     CacheNavMeshAgent.updateRotation        = true;
     CacheNavMeshAgent.isStopped             = false;
     CacheNavMeshAgent.obstacleAvoidanceType = obstacleAvoidanceType;
 }
    //Briefly disable the NavmeshAgent and make RigidBody not Kinematic so force is able to be applied.
    public IEnumerator ImmobiliseAndKnockBack(Rigidbody rigidbody, Vector3 recieverPosition, Vector3 fromPosition, float force)
    {
        if (particle != null)
        {
            particle.Play();
        }

        GetComponent <NPCAI>().enabled = false;

        Vector3 direction = (recieverPosition - fromPosition).normalized;

        NavMeshAgent agent = GetComponent <NavMeshAgent>();

        float defaultSpeed        = agent.speed;
        float defaultAcceleration = agent.acceleration;
        float defaultAngularSpeed = agent.angularSpeed;
        ObstacleAvoidanceType defaultAvoidanceQuality = agent.obstacleAvoidanceType;

        agent.speed        = defaultSpeed * force;
        agent.acceleration = defaultAcceleration * 1000;
        agent.angularSpeed = 0;
        agent.SetDestination(transform.position + direction * KnockbackDistance);
        agent.obstacleAvoidanceType = ObstacleAvoidanceType.NoObstacleAvoidance;

        yield return(new WaitForSeconds(immobilisationDuration));

        agent.speed                 = defaultSpeed;
        agent.acceleration          = defaultAcceleration;
        agent.angularSpeed          = defaultAngularSpeed;
        agent.obstacleAvoidanceType = defaultAvoidanceQuality;

        GetComponent <NPCAI>().enabled = true;
    }
 public override void Reset()
 {
     gameObject = null;
     quality = ObstacleAvoidanceType.NoObstacleAvoidance;
     orQualityFromString = null;
     orQualityFromInt = null;
 }
Exemplo n.º 5
0
    static int IntToEnum(IntPtr L)
    {
        int arg0 = (int)LuaDLL.lua_tonumber(L, 1);
        ObstacleAvoidanceType o = (ObstacleAvoidanceType)arg0;

        LuaScriptMgr.PushEnum(L, o);
        return(1);
    }
Exemplo n.º 6
0
 public void SetNavQuality(ObstacleAvoidanceType v_NavQuality)
 {
     m_NavQuality = v_NavQuality;
     if (m_NavMeshAgent)
     {
         m_NavMeshAgent.obstacleAvoidanceType = m_NavQuality;
     }
 }
 public void In(
     [FriendlyName("Agent", "The NavMeshAgent agent.")] NavMeshAgent agent,
     [FriendlyName("Destination", "The Destination to navigate towards.")] out Vector3 destination,
     [FriendlyName("Stopping Distance", "Stop within this distance from the target position.")] out float stoppingDistance,
     [FriendlyName("Velocity", "The current velocity of the NavMeshAgent component.")] out Vector3 velocity,
     [FriendlyName("Next Position", "The next position on the path.")] out Vector3 nextPosition,
     [FriendlyName("Steering Target", "The current steering target - usually the next corner or end point of the current path. (Read Only)")] out Vector3 steeringTarget,
     [FriendlyName("Desired Velocity", "The  desired velocity of the agent including any potential contribution from avoidance. (Read Only)")] out Vector3 desiredVelocity,
     [FriendlyName("Remaining Distance", "Remaining distance along the current path - or infinity when not known. (Read Only)")] out float remainingDistance,
     [FriendlyName("Base Offset", "The relative vertical displacement of the owning GameObject.")] out float baseOffset,
     [FriendlyName("Is On Off Mesh Link", "Is agent currently positioned on an OffMeshLink. (Read Only)")] out bool isOnOffMeshLink,
     [FriendlyName("Current Off Mesh Link Data", "The current OffMeshLinkData.")] out OffMeshLinkData currentOffMeshLinkData,
     [FriendlyName("Auto Traverse Off Mesh Link", "Automate movement onto and off of OffMeshLinks.")] out bool autoTraverseOffMeshLink,
     [FriendlyName("Auto Repath", "Attempt to acquire a new path if the existing path becomes invalid or if the agent reaches the end of a partial and stale path.")] out bool autoRepath,
     [FriendlyName("Has Path", "Does the agent currently have a path. (Read Only)")] out bool hasPath,
     [FriendlyName("Path Pending", "A path is being computed, but not yet ready. (Read Only)")] out bool pathPending,
     [FriendlyName("Is Path Stale", "Is the current path stale. (Read Only) \n\nWhen true, the path may no longer be valid or optimal. This flag will be set if: there are any changes to the walkableMask, if any OffMeshLink is enabled or disabled, or if the costs for the NavMeshLayers have been changed.")] out bool isPathStale,
     [FriendlyName("Path Status", "Query the state of the current path.")] out NavMeshPathStatus pathStatus,
     [FriendlyName("Path", "Set or get a copy of the current path.")] out NavMeshPath path,
     [FriendlyName("Walkable Mask", "Specifies which NavMesh layers are passable (bitfield). Changing walkableMask will make the path stale (see isPathStale)")] out int walkableMask,
     [FriendlyName("Speed", "Maximum movement speed.")] out float speed,
     [FriendlyName("Angular Speed", "Maximum rotation speed in (deg/s).")] out float angularSpeed,
     [FriendlyName("Acceleration", "Maximum acceleration.")] out float acceleration,
     [FriendlyName("Update Position", "Should the agent update the transform position.")] out bool updatePosition,
     [FriendlyName("Update Rotation", "Should the agent update the transform orientation.")] out bool updateRotation,
     [FriendlyName("Radius", "Agent avoidance radius.")] out float radius,
     [FriendlyName("Height", "Agent height.")] out float height,
     [FriendlyName("Obstacle Avoidance Type", "The level of quality of avoidance.")] out ObstacleAvoidanceType obstacleAvoidanceType
     )
 {
     destination             = agent.destination;
     stoppingDistance        = agent.stoppingDistance;
     velocity                = agent.velocity;
     nextPosition            = agent.nextPosition;
     steeringTarget          = agent.steeringTarget;
     desiredVelocity         = agent.desiredVelocity;
     remainingDistance       = agent.remainingDistance;
     baseOffset              = agent.baseOffset;
     isOnOffMeshLink         = agent.isOnOffMeshLink;
     currentOffMeshLinkData  = agent.currentOffMeshLinkData;
     autoTraverseOffMeshLink = agent.autoTraverseOffMeshLink;
     autoRepath              = agent.autoRepath;
     hasPath               = agent.hasPath;
     pathPending           = agent.pathPending;
     isPathStale           = agent.isPathStale;
     pathStatus            = agent.pathStatus;
     path                  = agent.path;
     walkableMask          = agent.walkableMask;
     speed                 = agent.speed;
     angularSpeed          = agent.angularSpeed;
     acceleration          = agent.acceleration;
     updatePosition        = agent.updatePosition;
     updateRotation        = agent.updateRotation;
     radius                = agent.radius;
     height                = agent.height;
     obstacleAvoidanceType = agent.obstacleAvoidanceType;
 }
Exemplo n.º 8
0
    public override void OnEnter(System.Action callback)
    {
        base.OnEnter(callback);

        //parent.PlayAnim( eAnimName.Anim_die, true, 0.08f );
        parent.PlayAnim(eAnimName.Anim_die, true, 0.2f, true);
        parent.CharInfo.Hp = 0;

        navAgent                       = parent.GetComponent <NavMeshAgent>();
        storedAvoidanceType            = navAgent.obstacleAvoidanceType;
        storedAvoidancePriority        = navAgent.avoidancePriority;
        navAgent.obstacleAvoidanceType = ObstacleAvoidanceType.NoObstacleAvoidance;
        navAgent.avoidancePriority     = 99;

        //< 죽었을때 컬리더박스는 꺼줌
        BoxCollider[] collider = this.gameObject.GetComponentsInChildren <BoxCollider>();
        for (int i = 0; i < collider.Length; i++)
        {
            collider[i].enabled = false;
        }

        if (GameDefine.skillPushTest)
        {
            CapsuleCollider[] colider2 = this.gameObject.GetComponentsInChildren <CapsuleCollider>();
            for (int i = 0; i < colider2.Length; i++)
            {
                colider2[i].enabled = false;
            }
        }

        endTime = Time.time + parent.Animator.GetAnimLength(eAnimName.Anim_die) + 0.5f;

        //< 혹시모르니 체크
        if (parent.dirIndicator != null)
        {
            Destroy(parent.dirIndicator);
        }
    }
Exemplo n.º 9
0
 public void SetNavQuality(ObstacleAvoidanceType v_NavQuality)
 {
     m_NavQuality = v_NavQuality;
     m_NavMeshAgent.obstacleAvoidanceType = m_NavQuality;
 }
        void DoSetObstacleAvoidanceType()
        {
            if (_agent == null)
            {
                return;
            }

            ObstacleAvoidanceType oat = quality;


            if (!orQualityFromInt.IsNone)
            {
                switch (orQualityFromInt.Value)
                {
                case 0:
                    oat = ObstacleAvoidanceType.NoObstacleAvoidance;
                    break;

                case 1:
                    oat = ObstacleAvoidanceType.LowQualityObstacleAvoidance;
                    break;

                case 2:
                    oat = ObstacleAvoidanceType.MedQualityObstacleAvoidance;
                    break;

                case 3:
                    oat = ObstacleAvoidanceType.GoodQualityObstacleAvoidance;
                    break;

                case 4:
                    oat = ObstacleAvoidanceType.HighQualityObstacleAvoidance;
                    break;
                }
            }
            else if (!orQualityFromString.IsNone)
            {
                switch (orQualityFromString.Value)
                {
                case "no":
                    oat = ObstacleAvoidanceType.NoObstacleAvoidance;
                    break;

                case "low":
                    oat = ObstacleAvoidanceType.LowQualityObstacleAvoidance;
                    break;

                case "medium":
                    oat = ObstacleAvoidanceType.MedQualityObstacleAvoidance;
                    break;

                case "good":
                    oat = ObstacleAvoidanceType.GoodQualityObstacleAvoidance;
                    break;

                case "high":
                    oat = ObstacleAvoidanceType.HighQualityObstacleAvoidance;
                    break;
                }
            }

            _agent.obstacleAvoidanceType = oat;
        }
Exemplo n.º 11
0
 public void SetObstacleAvoidanceType(ObstacleAvoidanceType type)
 {
     _agent.obstacleAvoidanceType = type;
 }