Beispiel #1
0
    [SerializeField] private const int shotDistance = 10; //Shot distance after peneteration

    public void Damage(Info_Shot shotInfo)
    {
        StartCoroutine(Peneterate(shotInfo));
        GameObject particles = Instantiate(sparkPrefab, shotInfo.Point, Quaternion.identity);

        Destroy(particles, 0.2f);
    }
Beispiel #2
0
    IEnumerator Peneterate(Info_Shot shotInfo)
    {
        yield return(new WaitForSecondsRealtime(0.1f));

        RaycastHit2D[] hit = Physics2D.RaycastAll(shotInfo.Point, shotInfo.Direction, shotDistance);
        if (hit.Length > 1 && hit[1].collider)
        {
            hit[1].collider.SendMessage("Damage", new Info_Shot(hit[1].point, shotInfo), SendMessageOptions.DontRequireReceiver);
        }
    }
Beispiel #3
0
    public void Damage(Info_Shot shotInfo)
    {
        GameObject particles = Instantiate(bloodPrefab, shotInfo.Point, Quaternion.identity);

        Destroy(particles, 1);
    }