Exemple #1
0
    private PlayerSpriteAnimation spriteAnimation;  // The actual animation script attached to the spriteAnimationPlane

    // Start is called before the first frame update
    void Start()
    {
        // General player script setup
        body            = gameObject.GetComponent <Rigidbody>();
        healthManager   = GetComponent <KillableScript>();
        moveDirection   = Vector3.forward;
        spriteAnimation = spriteAnimationPlane.GetComponent <PlayerSpriteAnimation>();
        StartCoroutine(DisableMessageText(5.0f)); // Hide the initial quest message after a short delay

        // Restore/update saved values from the StaticSaver
        SwordScript sword = swordHitbox.GetComponent <SwordScript>();

        if (SceneManager.GetActiveScene().name == "Outside")
        {
            StaticSaverScript.maxHealth      = maxHealth;
            StaticSaverScript.swordPower     = sword.power;
            StaticSaverScript.swordKnockback = sword.knockbackForce;
            StaticSaverScript.health         = maxHealth;
            healthManager.health             = maxHealth;
        }
        else
        {
            maxHealth            = StaticSaverScript.maxHealth;
            sword.power          = StaticSaverScript.swordPower;
            sword.knockbackForce = StaticSaverScript.swordKnockback;
            healthManager.health = StaticSaverScript.health;
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     SpriteRenderer = GetComponent <SpriteRenderer>();
     animator       = GetComponent <PlayerSpriteAnimation>();
 }