예제 #1
0
    IBattleMissile IBattlePerception.CreateMissile(IMagicReleaser releaser, MissileLayout layout)
    {
        var        viewRelease   = releaser as UMagicReleaserView;
        var        viewTarget    = viewRelease.CharacterTarget as UCharacterView;
        var        characterView = viewRelease.CharacterReleaser as UCharacterView;
        var        res           = layout.resourcesPath;
        var        obj           = ResourcesManager.Singleton.LoadResourcesWithExName <GameObject> (res);
        GameObject ins;

        if (obj == null)
        {
            ins = new GameObject("Missile");
        }
        else
        {
            ins = GameObject.Instantiate(obj);
        }
        ins.transform.SetParent(this.transform, false);
        var trans  = characterView.transform;
        var offset = trans.rotation * new Vector3(layout.offset.x, layout.offset.y, layout.offset.z);

        ins.transform.position = characterView.GetBoneByName(layout.fromBone).position + offset;
        ins.transform.rotation = Quaternion.identity;

        var missile = ins.AddComponent <UBattleMissileView> ();        //NO
        var path    = ins.GetComponent <MissileFollowPath> ();

        if (path)
        {
            path.SetTarget(viewTarget.GetBoneByName(layout.toBone), layout.speed);
        }
        return(missile);
    }
예제 #2
0
        IBattleMissile IBattlePerception.CreateMissile(IMagicReleaser releaser, MissileLayout layout)
        {
            var missile           = new BattleMissileView(this);
            var releaserCharacter = releaser as BattleMagicReleaserView;
            var pos = releaserCharacter.CharacterReleaser.Transform.position;

            missile.SetPosition(pos);
            return(missile);
        }
예제 #3
0
    IParticlePlayer IBattlePerception.CreateParticlePlayer(IMagicReleaser releaser, ParticleLayout layout)
    {
        var        res = layout.path;
        var        obj = ResourcesManager.Singleton.LoadResourcesWithExName <GameObject> (res);
        GameObject ins;

        if (obj == null)
        {
            return(null);
        }
        else
        {
            ins = GameObject.Instantiate(obj);
        }
        var viewRelease   = releaser as UMagicReleaserView;
        var viewTarget    = viewRelease.CharacterTarget as UCharacterView;
        var characterView = viewRelease.CharacterReleaser as UCharacterView;
        // var trans = (GTransform)characterView.Transform ;
        var form = layout.fromTarget == Layout.TargetType.Releaser ? characterView : viewTarget;

        if (layout.Bind)
        {
            ins.transform.SetParent(form.GetBoneByName(layout.fromBoneName), false);
        }
        else
        {
            ins.transform.SetParent(this.transform, false);
            ins.transform.position = form.GetBoneByName(layout.fromBoneName).position;
            ins.transform.rotation = Quaternion.identity;
        }

        switch (layout.destoryType)
        {
        case  ParticleDestoryType.Time:
            GameObject.Destroy(ins, layout.destoryTime);
            break;

        case ParticleDestoryType.Normal:
            GameObject.Destroy(ins, 3);
            break;

        case ParticleDestoryType.LayoutTimeOut:
            GameObject.Destroy(ins, 1);
            break;
        }

        return(ins.AddComponent <UParticlePlayer>());
    }
예제 #4
0
        IParticlePlayer IBattlePerception.CreateParticlePlayer(IMagicReleaser releaser, ParticleLayout layout)
        {
            var notify = new Proto.Notify_LayoutPlayParticle
            {
                ReleaseIndex = releaser.Index,
                FromTarget   = (int)layout.fromTarget,
                ToTarget     = (int)layout.toTarget,
                Path         = layout.path,
                ToBoneName   = layout.toBoneName,
                FromBoneName = layout.fromBoneName,
                DestoryTime  = layout.destoryTime,
                DestoryType  = (int)layout.destoryType
            };

            AddNotify(notify);
            return(new ParticlePlayerView());
        }