Example #1
0
 // Use this for initialization
 void Awake()
 {
     if (playerAnimation == null)
     {
         this.playerAnimation = GetComponent <PlayerAnimation>();
     }
     if (attackSequence == null)
     {
         this.attackSequence = GetComponent <PlayerAttackSequence>();
     }
     if (playerAction == null)
     {
         this.playerAction = GetComponent <PlayerAction>();
     }
     if (kirinuke == null)
     {
         this.kirinuke = GetComponent <Kirinuke>();
     }
     if (sword == null)
     {
         this.sword = GetComponentInChildren <Sword>();
     }
     this.push          = new Subject <RengekiPushEvent>();
     this.start         = new Subject <bool>();
     this.end           = new Subject <bool>();
     this.startObserver = Slow.Instance.onStart.Subscribe(OnSlowStart);
     this.endObserver   = Slow.Instance.onEnd.Subscribe(OnSlowStart);
 }
    void Start()
    {
        if (playerCamera == null)
        {
            this.playerCamera = Camera.main.GetComponent <CameraController>();
        }

        if (replEffectGenerator == null)
        {
            this.replEffectGenerator = GameObject.Find("ReplEffectGenerator").GetComponent <ReplEffectGenerator>();
        }

        this.status = GetComponent <PlayerStatus>();
        //this.playerAnimation = new PlayerAnimation(GetComponent<Animator>());
        this.playerAnimation    = GetComponent <PlayerAnimation>();
        this.isGuard            = false;
        this.counterOccuredTime = -1;
        this.state             = PlayerState.Idle;
        this.isAvoid           = false;
        this.isAttack          = false;
        status                 = GetComponent <PlayerStatus>();
        canPierceAndHeal       = false;
        nearCanPierceEnemyList = new List <EnemyAI>();
        dash = new Dash(decreaseStaminaPerSecond, DecreaseDashStamina);
        Assert.IsTrue(decreaseAttackStamina > 0);
        Assert.IsTrue(decreaseStaminaPerSecond > 0);

        //攻撃が終わるたびにステートを戻す
        if (this.attackSequence == null)
        {
            this.attackSequence = GetComponent <PlayerAttackSequence>();
        }

        attackSequence.OnAttackPhaseFinished += () => state = PlayerState.Idle;
    }