private void Start()
        {
            player         = GetComponent <PlayerCharacter>();
            playerCollider = player.GetComponent <Collider2D>();
            fsm            = player.GetComponent <FiniteStateMachine>();
            playerSprite   = player.GetComponent <SpriteRenderer>();

            indicators    = new Dictionary <string, Indicator>();
            interactibles = new List <PhysicalInteractible>();
        }
Exemple #2
0
        /// <summary>
        /// Whether or not the player collider should be ignored.
        /// </summary>
        /// <returns>True if the player collider should be ignored. False otherwise.</returns>
        private bool ShouldIgnorePlayerCollider()
        {
            if (playerCollider == null)
            {
                player         = FindObjectOfType <PlayerCharacter>();
                playerCollider = player.GetComponent <BoxCollider2D>();
            }

            // CHeck if player collider should be ignored.
            float bottomOfPlayerCollider = playerCollider.bounds.center.y - playerCollider.bounds.extents.y;
            float topOfPlatformCollider  = platformCollider.bounds.center.y + platformCollider.bounds.extents.y;

            return(droppingThrough || bottomOfPlayerCollider < topOfPlatformCollider);
        }
Exemple #3
0
        //-------------------------------------------------------------------------
        // Unity API
        //-------------------------------------------------------------------------

        private void Awake()
        {
            player       = GetComponent <PlayerCharacter>();
            playerSprite = player.GetComponent <SpriteRenderer>();
        }