Whats wrong with this? (541528)

Ok i tried to rewrite from js to c# but c# dont work for me and dont give me any errors? whast the problem?
Animation dont play and the dammage are not being apply.Maybe something wrong with raycats in c#?

js (good one)

c# (not working) <<<<

Ps its something with AttackDammage()

In C# AttackDammage needs be called via StartCoroutine if you are going to be making use of yields. Also, a simple way of testing this kind of thing for yourself would be to throw a few Debug.Log statements in there - see which ones are called and which ones are not reached.

Its looks like that the AttackDammage is not beign called at all somehow… i tried to make debug.logs and it didnt even appeard in first line of funcion. Btw how to make that starcoroutine?

Idk i dont understand how it works… ;\ screw this ill never gonna rewrite this code…

well tbh it’s not that great of a piece of code…
anyways if you get headaches from enumerators, just make yourself a counter to use.
something like:

using UnityEngine;
using System.Collections;

public class Counter
{
    public static float cnt;
   
    public static float Count(float amount)
    {
        if (cnt == 0.0f)
            cnt = amount;
        cnt -= Time.deltaTime;
        if (cnt <= 0f)
            cnt = 0f;
        Debug.Log ("count: " + cnt);
        return cnt;
    }
}

which you can simply use in other scripts like this:

        if(Counter.Count(3.0f) == 0)
        {
            //do something
        }

can i do without if statement? like normal yield waitforseconds?

no the counter replaces the yield.
anyway what is the script supposed to do. as far as i see instantiate some things depending on what kind of material is hit right?

Well its my melee system heres video
https://www.youtube.com/watch?v=CK8H9MhdIX0

I thought it will be nice to have it translated to c# because of the future problems(networking,multiplayer)
What it does it deals dammage and spawns different particles,sounds,hitmarks,ddepended on tags :slight_smile: