Ejemplo n.º 1
0
    public Vector3 GetFloorPoint(Vector3 _startingPoint)
    {
        var   rayStart = _startingPoint;
        var   rayDir   = Vector2.down;
        float rayDist  = 20.0f;

        Vector2 floorPosition = Vector2.zero;

        RaycastHit2D hit = Physics2D.Raycast(rayStart, rayDir, rayDist, floorLayer); //1 << LayerMask.NameToLayer("Enemy"));

        if (hit)
        {
            floorPosition = hit.point;
        }

        FloorPointEvent OnFloorPointEvent = new FloorPointEvent
        {
            description = "Unit " + gameObject.name + " Health Event.",
            floorPoint  = floorPosition
        };

        OnFloorPointEvent.FireEvent();

        return(floorPosition);
    }
Ejemplo n.º 2
0
 private void OnEnable()
 {
     FloorPointEvent.RegisterListener(OnFloorPointEvent);
 }
Ejemplo n.º 3
0
 private void OnFloorPointEvent(FloorPointEvent e)
 {
     //Debug.Log("PlayerMovement sees floor point at: " + e.floorPoint);
     floorPoint = e.floorPoint;
 }