Deeds not being reported.
Posted: Fri Dec 04, 2015 11:18 pm
the system seems to work ok if there are only around 5-10 characters however when getting into the higher numbers of faction members the system seems to not register the deed being committed, or at least the deed being done is not registering in the relationship section. help would be greatly appreciated.
Example code:
cooldownTimer += Time.deltaTime;
RaycastHit hit;
Ray myRay = new Ray (origin.position,origin.TransformDirection(Vector3.forward));
Debug.DrawRay(origin.position, origin.TransformDirection(Vector3.forward) * deploymentHeight1);
if (Physics.Raycast (myRay, out hit, deploymentHeight1))
{
if (hit.collider.tag == "Enemy") {
FactionMember targetFactionMember = hit.collider.gameObject.GetComponent<FactionMember>();
if (currentBaseState.nameHash == fightJabState)
{
if(cooldownTimer > 0.65f)
{
EnemyHealth eh = (PrisonerHealth)hit.collider.GetComponent("EnemyHealth ");
ph.health -= 5;
cooldownTimer = 0f;
if(targetFactionMember != null)
{
Debug.Log("ReportHit");//this is calling
GetComponent<DeedReporter>().ReportDeed("Hit", targetFactionMember); //this is not calling or at least not registering in the faction members relationship section
if(eh.health <= 0)
{
fm.SetPersonalAffinity(targetFactionMember.name, -10);
targetFactionMember.SetPersonalAffinity(fm.name, -25);
}
}
}
}
}
}
Example code:
cooldownTimer += Time.deltaTime;
RaycastHit hit;
Ray myRay = new Ray (origin.position,origin.TransformDirection(Vector3.forward));
Debug.DrawRay(origin.position, origin.TransformDirection(Vector3.forward) * deploymentHeight1);
if (Physics.Raycast (myRay, out hit, deploymentHeight1))
{
if (hit.collider.tag == "Enemy") {
FactionMember targetFactionMember = hit.collider.gameObject.GetComponent<FactionMember>();
if (currentBaseState.nameHash == fightJabState)
{
if(cooldownTimer > 0.65f)
{
EnemyHealth eh = (PrisonerHealth)hit.collider.GetComponent("EnemyHealth ");
ph.health -= 5;
cooldownTimer = 0f;
if(targetFactionMember != null)
{
Debug.Log("ReportHit");//this is calling
GetComponent<DeedReporter>().ReportDeed("Hit", targetFactionMember); //this is not calling or at least not registering in the faction members relationship section
if(eh.health <= 0)
{
fm.SetPersonalAffinity(targetFactionMember.name, -10);
targetFactionMember.SetPersonalAffinity(fm.name, -25);
}
}
}
}
}
}