Exemplo n.º 1
0
    public Actor AddActor(int id, EActorType type, EBattleCamp camp, XTransform param, bool isMainPlayer = false)
    {
        Actor pActor = null;

        if (isMainPlayer)
        {
            pActor = new ActorMainPlayer(id, 100, EActorType.PLAYER, camp);
            pActor.Load(param);

            object[]         args   = new object[] { pActor.CacheTransform.transform };
            CameraEffectBase effect = MainCamera.GetComponent <CameraFollow>();
            effect.Init(0, MainCamera, null, args);
        }
        else
        {
            pActor = new ActorPlayer(id, 100, type, camp);
            pActor.Load(param);
        }

        if (pActor.CacheTransform != null)
        {
            Debug.LogError("添加人物" + pActor.ActorType);
            //pActor.CacheTransform.parent = GetHolder(EMapHolder.Role).transform;
            AllActors.Add(pActor);
            //LevelData.CampActors[camp].Add(pActor);
        }
        return(pActor);
    }
Exemplo n.º 2
0
    public void SwitchCameraEffect(ECameraType type, Camera cam, CameraEvent callback, params object[] args)
    {
        if (cam == null)
        {
            return;
        }
        List <CameraEffectBase> list = new List <CameraEffectBase>();

        cam.GetComponents(list);
        CameraEffectBase effect = null;

        for (int i = 0; i < list.Count; i++)
        {
            if (list[i].Type == type)
            {
                effect = list[i];
            }
            else
            {
                if (list[i].enabled && list[i].Type != ECameraType.FOLLOW)
                {
                    list[i].SwitchState(ECameraState.LEAVE);
                }
            }
        }
        if (effect == null)
        {
            AddCameraEffect(ref effect, type, cam);
        }
        effect.Init(0, cam, callback, args);
    }