Beispiel #1
0
    public void CreateFlyingEffect(IObject self, SkillActionProperty skillActionProperty, IObject target)
    {
        int            effectId       = UtilTools.IntParse(skillActionProperty.mSkillFlyRes);
        EffectProperty effectProperty = XmlManager.Instance.GetEffectProperty(effectId);

        if (effectProperty == null)
        {
            return;
        }

        if (target == null || target.mGameObject == null)
        {
            return;
        }

        //GameObject go = ResourceManager.Instance.GetEffect(effectProperty.mEffectPath);
        GameObject go = ResourceManager.Instance.GetFlySkillByFileName(effectProperty.mEffectFile);

        go.transform.SetParent(self.mGameObject.transform.parent);
        go.transform.position = self.mPosition + new Vector3(0, 1.5f, 0);
        if (go == null)
        {
            return;
        }

        Hashtable table = new Hashtable();

        // 飞行事件
        table.Add("speed", 15.0f);

        // 目前点
        Vector3 targetPosition = target.mGameObject.transform.position;
        Vector3 attPosition    = new Vector3(targetPosition.x, targetPosition.y + 1.5f, targetPosition.z);

        // 箭的朝向
        go.transform.forward = (attPosition - go.transform.position).normalized;

        // 飞行技能参数
        FlySkillParams param = new FlySkillParams();

        param.self     = go;
        param.target   = target.mGameObject;
        param.property = skillActionProperty;

        // 目标位置
        table.Add("position", attPosition);
        //table.Add("looktarget", attPosition);

        // 飞行过程中回调,在目标受击模块实现
        table.Add("onupdate", "OniTweenUpdate");
        table.Add("onupdatetarget", target.mGameObject);
        table.Add("onupdateparams", param);


        // 飞行结束回调,在主角技能模块实现
        table.Add("oncomplete", "OniTweenComplete");
        table.Add("oncompletetarget", self.mGameObject);
        table.Add("oncompleteparams", param);
    }
Beispiel #2
0
    /// <summary>
    /// 飞行特效结束回调
    /// </summary>
    /// <param name="go"></param>
    void OniTweenComplete(FlySkillParams param)
    {
        // 这里使用内存池,暂时这么处理
        //Destroy(go);

        float dis = UtilTools.Vec2Distance(param.self.transform.position, param.target.transform.position);

        Destroy(param.self);
        // 箭跟目前的距离
        if (dis <= 2.5f)
        {
            SkillHit(param.property);
        }
    }
Beispiel #3
0
 /// <summary>
 /// 飞行技能移动回调
 /// </summary>
 /// <param name="FlySkillParams"></param>
 void OniTweenUpdate(FlySkillParams paramy)
 {
     // 暂时不做处理
 }