Exemple #1
0
    //Sets up the Liner according to the public attributes information
    private void SetupLiner()
    {
        //This makes sure that whenever this two components interact, they do it correctly
        if (GetComponent <Bullet>() != null && GetComponent <FollowerLiner>() == null)
        {
            linerType = LinerType.Acelerated;
        }

        //Rotates the entity towards player if requested
        if (rotateTowardsTarget)
        {
            RotateToTarget();
        }

        //Cinematic set up
        if (linerType == LinerType.Constant)
        {
            SetUpCinematicAttributes();
        }

        //Accelerated set up
        else
        {
            //A Cinematic movement needs physics involved
            RB2D = GetComponent <Rigidbody2D>();
            if (RB2D == null)
            {
                RB2D = gameObject.AddComponent <Rigidbody2D>();
            }
            RB2D.freezeRotation = true;
            RB2D.gravityScale   = 0;
        }
    }
Exemple #2
0
 protected void SetLinerType(LinerType lt)
 {
     linerType = lt;
 }