public void initialize(Vector3 direction, bool isServer) { damage = 15.0f; //If put the get function in Start then it will not execute properly line = GetComponent <LineRenderer>(); destination = direction; line.SetPosition(0, origin); line.SetPosition(1, destination); if (!isServer) { return; } RaycastHit hit; if (Physics.Raycast(origin, destination - origin, out hit)) { LifeSys target = hit.collider.gameObject.GetComponent <LifeSys>(); if (target != null) { Debug.Log(maxRadius); target.InflictDamage(damage); } } }
void Start() { _health = 100.0f; _shield = 100.0f; if (hasAuthority) { playerLifeSystem = this; } }