コード例 #1
0
    new void Update()
    {
        switch (estado)
        {
        case RockMoveState.movimentacao:
            smoothVel = Mathf.Lerp(smoothVel, vel, Time.deltaTime * smooth);
            controle.Move(dirDeMove * Time.deltaTime * vel);
            break;

        case RockMoveState.parar:
            smoothVel = 0;
            Destroy(controle);
            transform.position = new Vector3(transform.position.x, yInicial, transform.position.z);
            estado             = RockMoveState.emEspera;
            Destroy(
                Instantiate(GameController.g.El.retorna(DoJogo.poeiraAoVento), transform.position, Quaternion.identity), 5);
            Invoke("TempoDeRetorno", 1);
            break;

        case RockMoveState.finalizar:
            Destroy(controle);
            transform.position = new melhoraPos().novaPos(umAlvo.position + Vector3.up);
            Invoke("TempoDeRetorno", 1);
            estado = RockMoveState.feito;
            break;
        }
    }
コード例 #2
0
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     if (Vector3.ProjectOnPlane(hit.normal, Vector3.up).magnitude > 0.5f &&
         estado == RockMoveState.movimentacao)
     {
         Debug.Log("Parece uma parede");
         estado = RockMoveState.parar;
     }
 }
コード例 #3
0
 void Start()
 {
     yInicial = transform.position.y;
     if (ExistenciaDoController.AgendaExiste(Start, this))
     {
         if (GameController.g.MyKeys.VerificaAutoShift(Chave))
         {
             if (rockManager)
             {
                 rockManager.Realocar(this);
                 estado = RockMoveState.feito;
             }
             else
             {
                 Invoke("Start", 0.15f);
             }
         }
     }
 }
コード例 #4
0
 void OnTriggerEnter(Collider hit)
 {
     if (hit.gameObject.tag == "gatilhoDePuzzle")
     {
         if (rockManager.VerificaTargetOcupado(hit.transform, transform))
         {
             Debug.Log("gatilhoDePuzzle");
             umAlvo = hit.transform;
             Destroy(
                 Instantiate(GameController.g.El.retorna("teletransporte"), hit.transform.position, Quaternion.identity), 5);
             GameController.g.MyKeys.MudaAutoShift(Chave, true);
             estado = RockMoveState.finalizar;
         }
         else
         {
             Debug.Log("é um gatilho OCupado");
         }
     }
 }
コード例 #5
0
 public void RestauraShift()
 {
     GameController.g.MyKeys.MudaAutoShift(Chave, false);
     estado = RockMoveState.emEspera;
 }
コード例 #6
0
 void IniciaMovimentacao()
 {
     estado   = RockMoveState.movimentacao;
     controle = gameObject.AddComponent <CharacterController>();
 }