void CastDebuff(Dictionary <SkillType, int> force) // cast player --> casted player { IVPlayer target = _hostserver.GetNearestPlayer(transform.position, Arrow.theta); KeyValuePair <SkillType[], int[]> Sforce = IVSkill.DicToPair(force); CmdCastedBuff(target.GetComponent <NetworkIdentity>().netId, Sforce.Key, Sforce.Value); }
//------------- Buff and Debuff ---------------- // On this section, Debuff is called 'CastedBuff'. void CastBuff(Dictionary <SkillType, int> force) { NetworkInstanceId id = GetComponent <NetworkIdentity>().netId; KeyValuePair <SkillType[], int[]> Sforce = IVSkill.DicToPair(force); CmdCastBuff(id, Sforce.Key, Sforce.Value); }
//---------Skill Attack---------------- void SkillAttack(Dictionary <SkillType, int> force) { Vector3 dir = Arrow.GetDir(); Vector3 pos = transform.position; NetworkInstanceId i = GetComponent <NetworkIdentity>().netId; // It ensures this code will be executed on client KeyValuePair <SkillType[], int[]> Sforce = IVSkill.DicToPair(force); CmdSkillAttack(dir, pos, i, Sforce.Key, Sforce.Value); }
void CmdCastedBuff(NetworkInstanceId id, SkillType[] forcekey, int[] forcevalue) { GameObject b = Instantiate((Object)SkillDebuff, transform.position + Vector3.up * 1, Quaternion.Euler(new Vector3(90.0f, 0.0f, 0.0f))) as GameObject; b.GetComponent <IVSkill>().Force = IVSkill.PairToDic(forcekey, forcevalue); b.transform.parent = GameObject.Find("Skills").transform; b.SetActive(true); NetworkServer.Spawn(b); RpcCastedBuff(b, id); }
void CmdSkillAttack(Vector3 dir, Vector3 pos, NetworkInstanceId id, SkillType[] key, int[] value) { GameObject b = Instantiate((Object)SkillBullet, pos + Vector3.up * 3, Quaternion.Euler(new Vector3(90.0f, 0.0f, 0.0f))) as GameObject; b.GetComponent <IVSkill>().Force = IVSkill.PairToDic(key, value); b.transform.parent = GameObject.Find("Skills").transform; b.SetActive(true); NetworkServer.Spawn(b); RpcSkillAttack(b, dir, pos, id); return; }