private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { Debug.Log("is HEal true"); playerHP = collision.GetComponent <CharacterHp>(); addedLives = playerHP.AddHp(addHeal); } }
private SaveController saveController; // Сохраненные параметры void Start() { thisSpriteRender = GetComponent <SpriteRenderer>(); thisRigidbody = GetComponent <Rigidbody2D>(); thisTransform = transform; thisAnimator = GetComponent <Animator>(); playerHp = GetComponent <CharacterHp>(); attackArea = FindObjectOfType <AttackArea>(); saveController = FindObjectOfType <SaveController>(); maxSpeed = saveController.sv.speedPlayer; jumpForce = saveController.sv.jumpForcePlayer; attackDamage = saveController.sv.attackDamagePlayer; }
void Start() { thisSpriteRender = GetComponent <SpriteRenderer>(); thisRigidbody = GetComponent <Rigidbody2D>(); thisTransform = transform; thisAnimator = GetComponent <Animator>(); player = GameObject.FindGameObjectWithTag("Player"); playerTransform = player.transform; frontView = thisTransform.Find("FrontFieldView"); frontVisibility = float.Parse(frontView.localScale.x.ToString()); backView = thisTransform.Find("BackFieldView"); playerScript = FindObjectOfType <Player>(); monsterHp = GetComponent <CharacterHp>(); monsterScope = GetComponent <MonsterScope>(); monstersLoot = GetComponent <MonstersDropLoot>(); }