Esempio n. 1
0
 void Start()
 {
     camera     = Camera.main.transform;
     rigidbody  = GetComponent <Rigidbody>();
     locomotion = GetComponent <CharacterLocomotion>();
     bzKnife    = GetComponentInChildren <BzKovSoft.ObjectSlicerSamples.BzKnife>();
 }
Esempio n. 2
0
    private void Start()
    {
        myMaster = GetComponent <Character>();

        idle       = new CharacterIdle(myMaster, this);
        locomotion = new CharacterLocomotion(myMaster, this);
        jump       = new CharacterJump(myMaster, this);
        fall       = new CharacterFall(myMaster, this);
        climb      = new CharacterClimb(myMaster, this);
        crouch     = new CharacterCrouch(myMaster, this);
        zapped     = new CharacterZapped(myMaster, this);
        turn       = new CharacterTurn(myMaster, this);
        interact   = new CharacterInteract(myMaster, this);
        death      = new CharacterDeath(myMaster, this);
        dialogue   = new CharacterDialogue(myMaster, this);
        disabled   = new CharacterDisabled(myMaster, this);
        train      = new CharacterEventTrain(myMaster, this);

        currentState = idle;

        //Special event niveau 1
        if (!GameManager.instance.spcLvlMan.hasHead)
        {
            ChangeState(train);
        }
    }
Esempio n. 3
0
    private void UpdateLocomotion(Animator animator, CharacterLocomotion locomotion)
    {
        if (!locomotion)
        {
            return;
        }

        animator.SetBool(hMove, locomotion.IsMoving);
        animator.SetFloat(hSpeed, locomotion.Speed);
        animator.SetFloat(hAngle, locomotion.Angle);

        animator.SetBool(hGrounded, locomotion.IsGrounded);
        if (!locomotion.IsGrounded)
        {
            animator.SetFloat(hVertSpeed, locomotion.VerticalSpeed);
        }

        smoothAcceleration = Vector3.MoveTowards(smoothAcceleration, locomotion.Acceleration, m_LeanSmoothing * Time.fixedDeltaTime);
        if (smoothAcceleration.magnitude > ACCEL_DEADZONE)
        {
            animator.SetFloat(hLean, smoothAcceleration.magnitude);
            animator.SetFloat(hLeanAngle, Vector3.SignedAngle(transform.forward, smoothAcceleration, transform.up));
        }
        else
        {
            animator.SetFloat(hLean, 0);
            animator.SetFloat(hLeanAngle, 0);
        }
    }
Esempio n. 4
0
 protected override void Die()
 {
     m_audioSource.Play();
     GameManager.CharacterKilled(this);
     CharacterLocomotion.Shutdown();
     Destroy(gameObject);
 }
 private void Start()
 {
     _playerGO          = GameObject.FindGameObjectWithTag("Player");
     _playerController  = _playerGO.GetComponent <PlayerController>();
     _charLocomotion    = _playerGO.GetComponent <CharacterLocomotion>();
     _aiHealth          = GetComponent <Health>();
     _lastKnownLocation = FindObjectOfType <LastKnownLocation>();
 }
Esempio n. 6
0
        // Use this for initialization
        void Start()
        {
            GameManager.SetPlayer(this);
            // Start the player at the correct height
            float y = (-GameManager.s_GridCellSize * 0.5f);

            transform.position = new Vector3(transform.position.x, y, transform.position.z);

            CharacterLocomotion.Init(gameObject);
        }
Esempio n. 7
0
 void Awake()
 {
     locomotion           = GetComponent <CharacterLocomotion>();
     locomotion.character = this;
     entity             = GetComponent <CharacterEntity>();
     entity.character   = this;
     animationHandler   = GetComponent <AnimationHandler>();
     survival           = GetComponent <CharacterSurvival>();
     survival.character = this;
 }
Esempio n. 8
0
    public override void OnInspectorGUI()
    {
        CharacterLocomotion characterLocomotion = target as CharacterLocomotion;

        base.OnInspectorGUI();


        GUI.enabled = false;
        GUILayout.BeginVertical(UnityEditor.EditorStyles.helpBox);
        GUILayout.Toggle(characterLocomotion.IsGrounded, "Is Grounded");
        GUILayout.EndVertical();
    }
Esempio n. 9
0
        // Update is called once per frame
        void Update()
        {
            if (m_isGameActive)
            {
                /// Attacking
                HandleAttacking();

                CharacterLocomotion.Process();

                /// Minimap toggle
                Minimap();
            }
        }
Esempio n. 10
0
    public void InitScene()
    {
        // 현재 페이지에서만 쓸 인자용 씬번호
        // 저장위치에 따라 쓸모 유무가 생김
        // 저장위치는 스테이지 클리어 직후 / 로딩 중 / 새 스테이지 씬 로딩 후
        tempCurrentSceneNum = SCI.CurSceneNum;
        Debug.Log("tempCurrentSceneNum : " + tempCurrentSceneNum);
        playerAttack        = FindObjectOfType <PlayerAttack>();
        characterLocomotion = FindObjectOfType <CharacterLocomotion>();
        if (characterLocomotion != null)
        {
            characterLocomotion.ChangePose(isDays[tempCurrentSceneNum]);
        }
        // 인스펙터에서 Enemies에 아무것도 넣지 않으면
        // 해당 스테이지는 낮 Scene
        enemies    = GameObject.Find("Enemies");
        enemiesDic = new Dictionary <string, Zombie>();
        if (enemies != null)
        {
            enemiesDic = enemies.GetComponentsInChildren <Zombie>().ToDictionary(key => key.name);
            Debug.Log("enemiesDic.Count : " + enemiesDic.Count);
        }

        // ChatObject의 자식 수 세기
        chatObject = GameObject.Find("ChatObject");
        if (chatObject != null)
        {
            numOfChatObject = chatObject.transform.childCount;
        }

        if (tempCurrentSceneNum == isDays.Length - 1)
        {
            SCI.EndingScene();
        }

        // 오디오 전환
        if (tempCurrentSceneNum > 1)
        {
            if (isDays[tempCurrentSceneNum] == true)
            {
                audioSource.clip = audioDay;
            }
            else
            {
                audioSource.clip = audioNight;
            }
            audioSource.Play();
            Cursor.visible = false;
        }
    }
Esempio n. 11
0
    public void Awake()
    {
        PlayerLocomotion           = gameObject.GetComponent <CharacterLocomotion>();
        PlayerLocomotion.Character = this;

        CharacterAnimationHandler = gameObject.AddComponent <CharacterAnimationHandler>();

        if (PlayerLocomotion == null)
        {
            Logger.Log(Logger.Initialisation, "Could not find PlayerLocomotion component on character");
        }
        if (CharacterAnimationHandler == null)
        {
            Logger.Log(Logger.Initialisation, "Could not find CharacterAnimationHandler component on character");
        }

        PlannedRoutine = new CharacterRoutine(this);
    }
 public new void Awake()
 {
     base.Awake();
     CharacterLocomotion = gameObject.GetComponentInParent <CharacterLocomotion>();
 }