Esempio n. 1
0
 internal void CorrectHit()
 {
     print("correct hit");
     currentHitArea         = null;
     soundEffectSource.clip = correctEffect;
     soundEffectSource.Play();
     time -= 0.5;
     timerModDigits.text = "-0.5s";
     StartCoroutine("ModTextJump");
 }
Esempio n. 2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     // hit area
     print("meetHitArea");
     if (other.tag == "hitArea")
     {
         canHit = true; currentHitArea = other.GetComponent <HitAreaScript>();
     }
     // item
     else if (other.tag == "item")
     {
         itemEffectSource.clip = other.GetComponent <ItemScript>().soundEffect;
         itemEffectSource.Play();
         other.GetComponent <ItemScript>().PickUpEffect();
     }
 }
Esempio n. 3
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Obstacle"))
        {
            return;
        }

        HitAreaScript hitpointScript = other.GetComponent <HitAreaScript>();

        if (hitpointScript.attacker != playerName && !isDead)
        {
            if (hitpointScript.attacker == "")
            {
                return;
            }

            lastAttacker = hitpointScript.attacker;
            Damaged(hitpointScript.damage);
        }
    }
Esempio n. 4
0
    public void CreateAttack(string attacker)
    {
        Skill   skill;
        int     skillID       = GetValueByKey <int>(attacker, SKILLIDKEY);
        float   xPosition     = GetValueByKey <float>(attacker, ATTACKPOSTIONXKEY);
        float   zPosition     = GetValueByKey <float>(attacker, ATTACKPOSTIONZKEY);
        float   direction     = GetValueByKey <float>(attacker, ATTACKDIRECTIONKEY);
        Vector3 hitLocation   = new Vector3(xPosition, 0, zPosition);
        Vector3 moveDirection = new Vector3(Mathf.Sin(Mathf.Deg2Rad * direction), 0,
                                            Mathf.Cos(Mathf.Deg2Rad * direction));

        if (skillID == -1)
        {
            skill = new Skill();
        }
        else
        {
            skill = skills[skillID - 1];
        }

        hitLocation.y = 0.55f;
        hitLocation  += moveDirection;
        GameObject    hit           = Instantiate(hitArea, hitLocation, Quaternion.Euler(0, direction, 0));
        HitAreaScript hitAreaScript = hit.GetComponent <HitAreaScript>();

        hitAreaScript.attacker = attacker;
        hitAreaScript.damage   = skill.damage;
        hitAreaScript.time     = skill.time;
        print(hitAreaScript.attacker);
        hit.gameObject.GetComponent <BoxCollider>().size = new Vector3(skill.size, 0.5f, skill.size);
        hit.transform.localScale = new Vector3(skill.size, 0.5f, skill.size);
        if (skill.moving)
        {
            hit.GetComponent <Rigidbody>().velocity     = moveDirection * 8f;
            hit.GetComponent <HitAreaScript>().isMoving = true;
            hit.GetComponent <MeshRenderer>().enabled   = true;
        }
    }