Пример #1
0
    protected virtual void ApplyAfterLayerCheck(GameObject other)
    {
        if (LayerTools.IsLayerInMask(LayerMask, other.layer) == false)
        {
            return;
        }

        Apply(other.gameObject);
    }
Пример #2
0
    protected override void OnTriggerStay(Collider other)
    {
        if (LayerTools.IsLayerInMask(LayerMask, other.gameObject.layer) == false)
        {
            return;
        }


        Apply(other.gameObject);
    }
Пример #3
0
    protected virtual void OnTriggerEnter(Collider other)
    {
        if (LayerTools.IsLayerInMask(Mask, other.gameObject.layer) == false)
        {
            return;
        }

        DeployEffectZone();

        HandlePenetration();
    }
Пример #4
0
    private void OnCollisionEnter2D(Collision2D other)
    {
        if (LayerTools.IsLayerInMask(bounceLayer, other.gameObject.layer) == false)
        {
            return;
        }

        ActivateBounce();

        //if (myBody.velocity.magnitude >= 5f)
        //    bounceForce = startingForce;
    }
Пример #5
0
    protected override void OnTriggerStay(Collider other)
    {
        if (LayerTools.IsLayerInMask(LayerMask, other.gameObject.layer) == false)
        {
            return;
        }

        if (CheckHitTargets(other.gameObject) == true)
        {
            Apply(other.gameObject);
        }
    }
Пример #6
0
    private void OnCollisionEnter(Collision other)
    {
        if (LayerTools.IsLayerInMask(groundLayer, other.gameObject.layer) == false)
        {
            return;
        }

        //Debug.Log("Collided with ground");

        if (onCollideWithGround != null)
        {
            onCollideWithGround();
        }
    }
Пример #7
0
    private void SetDestination()
    {
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, Mathf.Infinity))
        {
            if (hit.collider != null)
            {
                if (LayerTools.IsLayerInMask(walkableArea, hit.collider.gameObject.layer))
                {
                    navMeshAgent.SetDestination(hit.point);
                }
            }
        }
    }
Пример #8
0
    protected virtual void ApplyAfterLayerCheck(GameObject other, bool checkHits = false)
    {
        if (LayerTools.IsLayerInMask(LayerMask, other.layer) == false)
        {
            return;
        }

        if (checkHits == true)
        {
            if (CheckHitTargets(other) == false)
            {
                return;
            }
        }

        Apply(other.gameObject);
    }
Пример #9
0
    private GameObject TryToDetect(GameObject other)
    {
        Vector2      direction = other.transform.position - transform.position;
        RaycastHit2D hit       = Physics2D.Raycast(transform.position, direction.normalized, detectionDistance);

        if (hit.collider != null)
        {
            //Debug.Log(hit.collider.gameObject.name + " is seen");
            if (LayerTools.IsLayerInMask(targetLayers, hit.collider.gameObject.layer) == true)
            {
                //Debug.Log(hit.collider.gameObject.name + " is seen");
                return(hit.collider.gameObject);
            }
        }

        return(null);
    }
Пример #10
0
    private void OnTriggerStay2D(Collider2D other)
    {
        if (LayerTools.IsLayerInMask(targetLayers, other.gameObject.layer) == false)
        {
            return;
        }

        GameObject target = TryToDetect(other.gameObject);

        if (target != null)
        {
            if (targets.AddUnique(target))
            {
                owner.Brain.TargetSpotted();
            }

            //if (targets.AddUnique(target))
            //{
            //    ((EntityEnemy)owner).Aggro();
            //}
        }
    }