Esempio n. 1
0
    /// <summary>
    /// Checks to see if you have enough room to stand and then will change the state to stand if valid
    /// </summary>
    /// <returns></returns>
    private bool AttemptStand()
    {
        EHRect2D CastBox = new EHRect2D();

        CastBox.RectPosition = AssociatedCollider.GetBounds().MinBounds;
        CastBox.RectSize     = AssociatedCollider.DefaultColliderSize;
        EHBaseCollider2D HitCollider;

        if (!EHPhysicsManager2D.BoxCast2D(ref CastBox, out HitCollider, LayerMask.GetMask(ENVIRONMENT_LAYER)))
        {
            SetMovementType(EMovementType.STANDING);
            return(true);
        }
        return(false);
    }
Esempio n. 2
0
        public override void OnStateTick(float DeltaTime)
        {
            float Distance = Vector2.Distance(TargetTransform.position, AIControllerOwner.transform.position);

            if (Distance < Range)
            {
                EHBounds2D PlayerCharacterBounds  = PlayerCollider.GetBounds();
                Vector3    CenterColliderPosition = PlayerCharacterBounds.MinBounds + (PlayerCharacterBounds.MaxBounds - PlayerCharacterBounds.MinBounds) / 2f;
                Vector2    DirectionToFly         = CenterColliderPosition - AIControllerOwner.transform.position;
                DirectionToFly.Normalize();
                WispController.FlightMovement.SetHorizontalInput(DirectionToFly.x);
                WispController.FlightMovement.SetVerticalInput(DirectionToFly.y);
            }
            else
            {
                WispController.FlightMovement.SetVerticalInput(0);
                WispController.FlightMovement.SetHorizontalInput(0);
            }
        }