//Функция вызывается при окончании работы загрузчика уровней public bool StartManager() { if (rhythmManager == null) { rhythmManager = RhythmManager.instance; } if (attackMenu == null) { attackMenu = AttackMenu.instance; } if (pauseMenu == null) { pauseMenu = MenuManager.instance; } if (knightHealthbar != null) //Если здороровье включено { healthbar = knightHealthbar.GetComponent <KnightHealth>(); //получить ссылку на скрипт здоровья } if (progress != null) //если прогресс включен { progress_bar = progress.GetComponent <ProgressBar>(); //получить ссылку на скрипт слайдер прогресса } audioSource = gameObject.GetComponent <AudioSource>(); //получить audioSource isLoaded = true; return(isLoaded); }
void Awake() { rb2d = GetComponent <Rigidbody2D> (); spriteRenderer = GetComponent <SpriteRenderer> (); animator = GetComponent <Animator> (); knightHealth = GetComponentInChildren <KnightHealth> (); source = GetComponent <AudioSource> (); }
// Use this for initialization void Start() { player = FindObjectOfType <KnightController>(); knightHealth = FindObjectOfType <KnightHealth> (); rigi = GetComponent <Rigidbody2D> (); if (player.transform.position.x < transform.position.x) { speed = -speed; } }
// Use this for initialization void Start() { anim = GetComponent<Animator> (); // Get Animator component knightHealth = GetComponent<KnightHealth> (); // Get KnightHealth script component audioSource = GetComponent<AudioSource> (); // Get Audio Source component playerState = PlayerState.Free; // Initiate player state to free // Audio variables audioTimer = 0.0f; // Movement variables moveSpeed = 180000.0f; // Character movement speed hMovement = 0.0f; // Horizontal movement vMovement = 0.0f; // Vertical movement movement = Vector2.zero; // Movement vector dodgeDirection = Vector2.zero; // Dodge vector // Attacking variables attackType = AttackType.Basic; // Initate attack type to basic attackDamageBasic = 25.0f; // Set basic damage attackDamageHeavy = 40.0f; // Set heavy damage attackRange = 4.0f; // Attack range set to 3 attackAngle = 60.0f; // 60 degree attack angle // Blocking variables blockAngle = 90.0f; // 90 degree blocking angle // Conditional variables isIdle = true; // Character is idle movingForward = true; // Character moving forward isBlocking = false; // Character not blocking isAttacking = false; // Character not attacking isDodging = false; // Character not dodging isFlinching = false; // Character not flinching isDying = false; // Character not dying isDead = false; // Character not dead isSprinting = false; // Character not sprinting blockedAttack = false; // Character not recovering from block continueAttack = false; // Character not combo attacking // Timers dodgeTimer = 0.0f; attackTimer = 0.0f; blockTimer = 0.0f; flinchTimer = 0.0f; emptyStaminaTimer = 1.0f; // Action times timeDodge = 0.4f; timeFlinch = 0.8f; timeBasicAttack = 0.45f; timeHeavyAttack = 0.75f; timeBlockedAttack = 0.3f; timeInvincible = 0.25f; timeStaminaDelay = 1.0f; // State-specific variables attackRegistered = false; attackAfterDodge = false; }
private void Awake() { instance = this; }