void Start() { camera = Camera.main.transform; rigidbody = GetComponent <Rigidbody>(); locomotion = GetComponent <CharacterLocomotion>(); bzKnife = GetComponentInChildren <BzKovSoft.ObjectSlicerSamples.BzKnife>(); }
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); } }
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); } }
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>(); }
// 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); }
void Awake() { locomotion = GetComponent <CharacterLocomotion>(); locomotion.character = this; entity = GetComponent <CharacterEntity>(); entity.character = this; animationHandler = GetComponent <AnimationHandler>(); survival = GetComponent <CharacterSurvival>(); survival.character = this; }
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(); }
// Update is called once per frame void Update() { if (m_isGameActive) { /// Attacking HandleAttacking(); CharacterLocomotion.Process(); /// Minimap toggle Minimap(); } }
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; } }
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>(); }