Beispiel #1
0
    /// <summary>
    /// On awake, populate variables and disable this component until the entity fades in.
    /// </summary>
    protected void Awake()
    {
        player = GetComponent <Player>();

        AppearInSecondsAndFadeInSprite.DisableMeTillComplete(this);

        Debug.Assert(player != null);
    }
Beispiel #2
0
    /// <summary>
    /// Called by other components (usually on the same object) to disable until the sprite is fully visible.
    /// </summary>
    /// <param name="script">The script which should be disabled.</param>
    public static void DisableMeTillComplete(
        MonoBehaviour script)
    {
        AppearInSecondsAndFadeInSprite appearIn = script.GetComponent <AppearInSecondsAndFadeInSprite>();

        if (appearIn != null)
        {
            script.enabled       = false;
            appearIn.onComplete += () => script.enabled = true;
        }
    }
Beispiel #3
0
    /// <summary>
    /// On awake, populate variables and register for ladder events.
    /// Disable this component until fade completes (preventing movement).
    /// </summary>
    protected void Awake()
    {
        Debug.Assert(oddsOfGoingUpHill >= 0);
        Debug.Assert(timeBeforeFirstWander >= 0);

        walkMovement   = GetComponent <WalkMovement>();
        ladderMovement = GetComponent <LadderMovement>();
        feet           = GetComponentInChildren <Feet>();

        ladderMovement.onGettingOffLadder += LadderMovement_onGettingOffLadder;

        AppearInSecondsAndFadeInSprite.DisableMeTillComplete(this);

        Debug.Assert(walkMovement != null);
        Debug.Assert(feet != null);
    }