Ejemplo n.º 1
0
        static void DrawGizmoStartPoint(navMove script, GizmoType gizmoType)
        {
            if (script.pathContainer == null)
            {
                return;
            }

            int     maxLength = script.pathContainer.GetPathPoints().Length - 1;
            int     index     = Mathf.Clamp(script.startPoint, 0, maxLength);
            Vector3 position  = script.pathContainer.GetPathPoints()[index];
            float   size      = Mathf.Clamp(HandleUtility.GetHandleSize(position) * 0.1f, 0, 0.3f);

            Gizmos.color = Color.magenta;

            if (!Application.isPlaying)
            {
                Gizmos.DrawSphere(position, size);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  Applies an explosion force to the colliding object.
        /// </summary>
        public void ApplyForce(int power)
        {
            Vector3 position = transform.position;
            float radius = 5f;

            Collider[] colliders = Physics.OverlapSphere(position, radius);
            foreach (Collider hit in colliders)
            {
                navMove move = hit.GetComponent<navMove>();
                if (move != null)
                {
                    move.Stop();
                    hit.GetComponent<NavMeshAgent>().enabled = false;
                    hit.isTrigger = false;
                }
                    
                Rigidbody rb = hit.GetComponent<Rigidbody>();
                if (rb != null)
                    rb.AddExplosionForce(power, position, radius, 100.0F);
            }
        }
Ejemplo n.º 3
0
    void GetEnemyComponents()
    {
        NavAgent        = GetComponent <NavMeshAgent> ();
        WaypointScript  = GetComponent <SWS.navMove> ();
        GameLogicObject = GameObject.FindGameObjectWithTag("GameLogic");
        PlayerPosition  = GameObject.FindGameObjectWithTag("Player").transform;
        AnimController  = GetComponent <Animator> ();

        GameLogicScript    = GameLogicObject.GetComponent <GameLogic> ();
        ParticleProjectile = GetComponentInChildren <ParticleProjectile> ();

        GetProjectileOrigin();

        Debug.Assert(NavAgent != null, "No Navmesh agent assigned to enemy");
        Debug.Assert(WaypointScript != null, "No waypointsript assigned to enemy");
        Debug.Assert(GameLogicObject != null, "No GameLogic tag found in enemy");
        Debug.Assert(PlayerPosition != null, "Player position is null");
        Debug.Assert(AnimController != null, "No animator controller assigned");

        Debug.Assert(ParticleProjectile != null, "ParticleProjectile is null");
    }
Ejemplo n.º 4
0
        // Token: 0x060006EA RID: 1770 RVA: 0x0002D598 File Offset: 0x0002B998
        public void ApplyForce(int power)
        {
            Vector3 position = base.transform.position;
            float   num      = 5f;

            Collider[] array = Physics.OverlapSphere(position, num);
            foreach (Collider collider in array)
            {
                navMove component = collider.GetComponent <navMove>();
                if (component != null)
                {
                    component.Stop();
                    collider.GetComponent <NavMeshAgent>().enabled = false;
                    collider.isTrigger = false;
                }
                Rigidbody component2 = collider.GetComponent <Rigidbody>();
                if (component2 != null)
                {
                    component2.AddExplosionForce((float)power, position, num, 100f);
                }
            }
        }
 void Start()
 {
     anim = GetComponent <Animator>();
     nav  = GetComponent <SWS.navMove>();
 }