public void InitCommonMotion() { PlayerCommonMotionState.NextStateEvent.Subscribe(state => { CommonMotionState = state; }).AddTo(this); if (CurrentCommonMotionState.IsInitialized) { CurrentCommonMotionState.Move(MoveType.Auto); } }
public override void Move(MoveType type) { if (!CanMove()) { return; } if (stopPoint != null) { stopPoint.GetComponent <Stop>().RemoveCharacter(); stopPoint = null; } CurrentCommonMotionState.Move(type); }
protected virtual void Update() { if (!isInitialized) { return; } CurrentCommonMotionState.Execute(); if (Hp <= 0) { Die(); return; } Attacking(); }
// 初期化 protected virtual void Start() { simpleAnim = GetComponent <SimpleAnimation>(); // CapsuleColliderコンポーネントを取得する(カプセル型コリジョン) col = GetComponent <CapsuleCollider>(); //メインカメラを取得する cameraObject = GameObject.FindWithTag("MainCamera"); attackEnable.OnNext(false); deadMotionFlag = false; PlayerCommonMotionState.Initialize(transform, simpleAnim); CurrentCommonMotionState.Move(MoveType.Auto); }
/// <summary> /// Ons the trigger enter. /// </summary> /// <param name="col">Col.</param> protected virtual void OnTriggerEnter(Collider col) { if (IsMovingBetweenStops && col.tag == "stop" + GetOtherStopPointType().ToString()) { stopPointType = GetOtherStopPointType(); stopPoint = col.gameObject; if (stopPoint.GetComponent <Stop>() != null) { stopPoint.GetComponent <Stop>().SetCharacter(gameObject); } attackEnable.OnNext(true); // 攻撃開始可能通知 CurrentCommonMotionState.SetNext(); } if (col.tag == "hprecover") { var healItem = col.gameObject.GetComponent <HealItem>(); healItem.Heal(this); } }