edited February 2021 in General Support
I'm trying to use ORK Framework with Invector's Third person controller. Because I want to use ORK's character level up, loot and ability system, I must use ORK's HP value. I set ORK's Damage Dealer and Damage Zone in the sword, so It can produce damage effects, but Invector’s gun damage is not known how to set it to become damage. What should I do?

using UnityEngine;
using System.Collections.Generic;

namespace Invector.vShooter
{
[vClassHeader("Decal Manager", openClose = false)]
public class vDecalManager : vMonoBehaviour
{
public LayerMask layermask;
public List decalObjects;

public virtual void CreateDecal(RaycastHit hitInfo)
{
CreateDecal(hitInfo.collider.gameObject, hitInfo.point, hitInfo.normal);
}

public virtual void CreateDecal(GameObject target, Vector3 position, Vector3 normal)
{
if (layermask == (layermask | (1 << target.layer)))
{
var decalObj = decalObjects.Find(d => d.tag.Equals(target.tag));
if (decalObj != null)
{
RaycastHit hit;
if (Physics.SphereCast(new Ray(position + (normal * 0.1f), -normal), 0.0001f, out hit, 1f, layermask))
{
if (hit.collider.gameObject == target)
{
var rotation = Quaternion.LookRotation(hit.normal, Vector3.up);
// instantiate hit effect particle
if (decalObj.hitEffect != null)
{
var effect = Instantiate(decalObj.hitEffect, hit.point, rotation)as GameObject;
effect.transform.SetParent(vObjectContainer.root,true);
}

// instantiate decal based on the gameobject tag
var decal = decalObj.GetDecal();
if (decal != null)
{
var _decal = Instantiate(decal, hit.point, rotation) as GameObject;
_decal.transform.SetParent(target.gameObject.transform,true);
}
}
}
}
}
}

[System.Serializable]
public class DecalObject
{
public string tag;
public GameObject hitEffect;
public List decals;

public GameObject GetDecal()
{
if (decals.Count > 1)
{
var index = Random.Range(0, decals.Count - 1);
return decals[index];
}
else if (decals.Count == 1)
return decals[0];
else
return null;
}
}
}
}
Post edited by who2345 on
  • First of all, you'll need to get the combatants involved, e.g. the player and the target that was hit. Check out this how-to on getting combatants from their game objects, though if you hit a child object, you might need to go via GetComponentInParent instead.

    You can get the player's combatant (if that's the only one that will use this mechanic) via:
    Combatant user = ORK.Game.ActiveGroup.Leader;

    I assume this is for base attacks, which you can get from the user (player) like this:
    AbilityShortcut ability = user.Abilities.GetCurrentBaseAttack();

    Via the ability, you can use the Use function, pass on user and targets and ORK does the calculations.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Keep in mind Invector is essentially also a framework like Ork they just seperate it based on modules, and the more Invector modules you use the more work you'll have to put in bridging the two together.
    My buddy had to quit his project because it became such a hassle dealing with 2 frameworks.
    Miuratale : coming 2024
    Miuratale
Sign In or Register to comment.