Пример #1
0
    private void OnEnable()
    {
        _velocity            = GetComponent <C_Velocity>();
        _characterController = GetComponent <CharacterController>();
        _camera = GetComponent <C_Camera>();

        var stateMgr = GetComponent <CS_StateMgr>();

        stateMgr.RegState(_name, this);
    }
Пример #2
0
    public override void Init(GameObject obj)
    {
        _velocity     = obj.GetComponent <C_Velocity>();
        _iKManager    = obj.GetComponent <C_IKManager>();
        _weaponHandle = obj.GetComponent <C_WeaponHandle>();
        _camera       = obj.GetComponent <C_Camera>();
        _uiMgr        = obj.GetComponent <C_UiEventMgr>();

        _weaponAttribute = GetComponent <WeaponAttribute>();
    }
 public override void Interagir()
 {
     if (audio != null) audio.Play();
     GameManager.instancia.PararJogador();
     GameManager.instancia.GetComponent<C_Audio>().MostrarSomInteracao();
     C_Camera camera = GameManager.instancia.GetComponent<C_Camera>();
     camera.MudarCamera(transform);
     dialogar.AdicionarAcaoAoFimDeDialogo(GameManager.instancia.LiberarJogador);
     dialogar.AdicionarAcaoAoFimDeDialogo(camera.ResetarCamera);
     dialogar.MostrarDialogo();
 }
Пример #4
0
 private void Awake()
 {
     _camera              = GetComponent <C_Camera>();
     _animator            = GetComponent <C_Animator>();
     _velocity            = GetComponent <C_Velocity>();
     _stateMgr            = GetComponent <CS_StateMgr>();
     _attributes          = GetComponent <C_Attributes>();
     _iKManager           = GetComponent <C_IKManager>();
     _audioSource         = GetComponent <AudioSource>();
     _characterController = GetComponent <CharacterController>();
 }
Пример #5
0
 // Use this for initialization
 void Awake()
 {
     velocity = GetComponentInParent <C_Velocity>();
     if (!velocity.isLocalPlayer)
     {
         this.enabled = false;
         return;
     }
     myCamera        = GetComponentInParent <C_Camera>();
     weaponAttribute = GetComponent <WeaponAttribute>();
     occlusionPoint  = GetComponentInParent <C_WeaponHandle>().OcclusionPoint;
     uiMgr           = GetComponentInParent <C_UiEventMgr>();
 }
Пример #6
0
 private void Start()
 {
     if (anim == null)
     {
         anim = GetComponent <Animator>();
     }
     medo   = 0;
     camera = GameManager.instancia.GetComponent <C_Camera>();
     if (!jogadorVenceu)
     {
         StartCoroutine(diminuirMedoPeloTempo());
     }
 }
Пример #7
0
        public override void Trigger()
        {
            C_Camera cam = GameManager.instancia.GetComponent <C_Camera>();

            if (resetar)
            {
                cam.ResetZoom();
                Wait();
                return;
            }
            cam.Zoom(zoom);
            Wait();
        }
Пример #8
0
            public void Iteration(ref EntityChunk chunk)
            {
                if (!chunk.TryGetComponents <C_Camera>(out ComponentArray cameras) || !chunk.TryGetComponents <C_Transform>(out ComponentArray transforms))
                {
                    return;
                }

                CameraData[] cameraDatas      = new CameraData[chunk.Count];
                Matrix4[]    cameraTransforms = new Matrix4[chunk.Count];
                for (int c = 0; c < chunk.Count; c++)
                {
                    C_Camera cam = cameras.Get <C_Camera>(c);
                    if (cam.cameraData.Framebuffer == null)
                    {
                        Vec2i res = AppScreen.Resolution;
                        var   fb  = new Framebuffer(res, "Camera FBO");
                        fb.AddColorBuffer(true);
                        fb.AddDepthBuffer(true);
                        cam.cameraData.SetFramebuffer(fb);


                        var ffb = new Framebuffer(res, "Camera Final FBO");
                        ffb.AddColorBuffer(false);
                        cam.cameraData.SetFinalFramebuffer(ffb);
                        chunk.SetComponent(c, cam);
                    }
                    else if (cam.cameraData.Framebuffer.Size != AppScreen.Resolution)
                    {
                        cam.cameraData.Framebuffer.ChangeSize(AppScreen.Resolution);
                        cam.cameraData.FinalFramebuffer.ChangeSize(AppScreen.Resolution);
                    }
                    //if(cam.cameraData.ColorTargetTexture == null)
                    //{
                    //    Vec2i res = AppScreen.Resolution;
                    //    cam.cameraData.SetColorTargetTexture(new Texture2D(res.x, res.y, "Camera Color FBO"));
                    //    cam.cameraData.SetDepthTargetTexture(new DepthTexture(res.x, res.y, "Camera Depth"));
                    //    chunk.SetComponent(c, cam);
                    //}
                    //else if (cam.cameraData.ColorTargetTexture.Size != AppScreen.Resolution)
                    //{
                    //    cam.cameraData.ColorTargetTexture.SetSize(AppScreen.Resolution);
                    //    cam.cameraData.DepthTargetTexture.SetSize(AppScreen.Resolution);
                    //}

                    cameraDatas[c]      = cam.cameraData;
                    cameraTransforms[c] = transforms.Get <C_Transform>(c).value;
                }

                RenderPipelineCore.Draw(cameraDatas, cameraTransforms);
            }
Пример #9
0
    private void OnEnable()
    {
        _camera              = GetComponent <C_Camera>();
        _animator            = GetComponent <C_Animator>();
        _velocity            = GetComponent <C_Velocity>();
        _attributes          = GetComponent <C_Attributes>();
        _audioSource         = GetComponent <AudioSource>();
        _characterController = GetComponent <CharacterController>();

        var stateMgr = GetComponent <CS_StateMgr>();

        //_name = "aim";
        stateMgr.RegState(_name, this);
    }
    public override void Setar()
    {
        base.Setar();
        cam = GameManager.instancia.GetComponent<C_Camera>();
        dialogar = GetComponent<Dialogar>();
        habilidadeAssociada = GameManager.instancia.GetComponent<C_Habilidade>().GetHabilidade(0);
        if(ponto == null)
        {
            ponto = gameObject.transform;
        }

        sinal = GUI_Referenciador.instancia.sinalizador;
           sinalInstanciado = Instantiate(sinal, GUI_Referenciador.instancia.ObjetoInteragiveis.transform);
        GameManager.instancia.AdicionarEmMudarMapa(Destruir);
    }
Пример #11
0
    private void Awake()
    {
        _uiMgr               = GetComponent <C_UiEventMgr>();
        _weaponHandle        = GetComponent <C_WeaponHandle>();
        _camera              = GetComponent <C_Camera>();
        _animator            = GetComponent <C_Animator>();
        _velocity            = GetComponent <C_Velocity>();
        _attributes          = GetComponent <C_Attributes>();
        _audioSource         = GetComponent <AudioSource>();
        _characterController = GetComponent <CharacterController>();

        var stateMgr = GetComponent <CS_StateMgr>();

        //_name = "aim";
        stateMgr.RegState(_name, this);
    }
Пример #12
0
    public override void Init(GameObject obj)
    {
        _uiMgr        = obj.GetComponent <C_UiEventMgr>();
        _camera       = obj.GetComponent <C_Camera>();
        _velocity     = obj.GetComponent <C_Velocity>();
        _iKManager    = obj.GetComponent <C_IKManager>();
        _photonView   = obj.GetComponent <PhotonView>();
        _attributes   = obj.GetComponent <C_Attributes>();
        _weaponHandle = obj.GetComponent <C_WeaponHandle>();
        _battleMgr    = obj.GetComponent <C_BattleMgr>();

        _audio           = GetComponent <AudioSource>();
        _weaponAttribute = GetComponent <WeaponAttribute>();

        timer = new Timer();
    }
Пример #13
0
    private void OnEnable()
    {
        anim                = GetComponent <C_Animator>();
        uiMgr               = GetComponent <C_UiEventMgr>();
        myCamera            = GetComponent <C_Camera>();
        velocity            = GetComponent <C_Velocity>();
        iKManager           = GetComponent <C_IKManager>();
        attributes          = GetComponent <C_Attributes>();
        weaponHandle        = GetComponent <C_WeaponHandle>();
        bornProtector       = GetComponent <C_BornProtector>();
        attackListener      = GetComponent <C_AttackListener>();
        avatarMeshRanderMgr = GetComponentInChildren <AvatarMeshRanderMgr>();

        var stateMgr = GetComponent <CS_StateMgr>();

        //_name = "aim";
        stateMgr.RegState(_name, this);

        //meshRenderers = GetComponentsInChildren<MeshRenderer>();
        //skinnedMeshRenderers = GetComponentsInChildren<SkinnedMeshRenderer>();
    }
Пример #14
0
 public Checkpoint()
 {
     player = new C_Player();
     camera = new C_Camera();
 }
Пример #15
0
    public static void SetFreeDirection(Transform transform, C_Velocity _velocity, C_Camera _camera)
    {
        // follow the camera when movecharacter
        var directionIndex = 0;

        if (_velocity.Dfwd)
        {
            directionIndex = 1;
            if (_velocity.Dleft)
            {
                directionIndex = 8;
            }
            if (_velocity.Dright)
            {
                directionIndex = 2;
            }
        }
        if (_velocity.Dbwd)
        {
            directionIndex = 5;
            if (_velocity.Dleft)
            {
                directionIndex = 6;
            }
            if (_velocity.Dright)
            {
                directionIndex = 4;
            }
        }
        if (_velocity.Dleft)
        {
            directionIndex = 7;
            if (_velocity.Dfwd)
            {
                directionIndex = 8;
            }
            if (_velocity.Dbwd)
            {
                directionIndex = 6;
            }
        }
        if (_velocity.Dright)
        {
            directionIndex = 3;
            if (_velocity.Dfwd)
            {
                directionIndex = 2;
            }
            if (_velocity.Dbwd)
            {
                directionIndex = 4;
            }
        }


        if (directionIndex != 0)
        {
            Vector3 targetAngles = new Vector3();
            switch (directionIndex)
            {
            case 1:
                targetAngles.Set(0, _camera.Carryer.localEulerAngles.y, 0);
                break;

            case 2:
                targetAngles.Set(0, _camera.Carryer.localEulerAngles.y + 45, 0);
                break;

            case 3:
                targetAngles.Set(0, _camera.Carryer.localEulerAngles.y + 90, 0);
                break;

            case 4:
                targetAngles.Set(0, _camera.Carryer.localEulerAngles.y + 135, 0);
                break;

            case 5:
                targetAngles.Set(0, _camera.Carryer.localEulerAngles.y + 180, 0);
                break;

            case 6:
                targetAngles.Set(0, _camera.Carryer.localEulerAngles.y + -135, 0);
                break;

            case 7:
                targetAngles.Set(0, _camera.Carryer.localEulerAngles.y - 90, 0);
                break;

            case 8:
                targetAngles.Set(0, _camera.Carryer.localEulerAngles.y - 45, 0);
                break;
            }

            transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(targetAngles), Time.deltaTime * 10);
        }
    }