示例#1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         Debug.Log("is HEal true");
         playerHP   = collision.GetComponent <CharacterHp>();
         addedLives = playerHP.AddHp(addHeal);
     }
 }
示例#2
0
    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;
    }
示例#3
0
 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>();
 }