2017-08-01 7 views
0

別のアニメーションが終了した後にアニメーションを再生するコードがあります。 は、ここに私のコードです:アニメーションシーケンスコードの2つの問題

using System.Collections; 
using System.Collections.Generic; 
using UnityEngine; 

public class AnimationSequence : MonoBehaviour { 

    public Animation First; 
    public Animation Second; 


    // Use this for initialization 
    void Start() { 
     First.GetComponent<Animation>(); 
     Second.GetComponent<Animation>(); 
    } 

    // Update is called once per frame 
    void Update() { 
     if (First.IsPlaying = false){ 
      Second.Play; 
     } 
    } 
} 

そして、私は2つのエラーを取得:変数、プロパティまたはインデクサ

  • のみ割り当て、呼び出しでなければなりません

    1. 代入の左辺を、インクリメント、デクリメントは、待って、新しいオブジェクトの表現は、文
  • +1

    のように宣言する必要がありますか? – jhhoff02

    +0

    行19,13および20,3 –

    +0

    と、上記のコードのどの行が表示されていますか? – jhhoff02

    答えて

    0

    変更

    として使用することができます
    void Update() { 
        if (First.IsPlaying = false){ 
         Second.Play; 
        } 
    } 
    

    void Update() { 
        if (First.IsPlaying == false){ 
         Second.Play; 
        } 
    } 
    

    に '=' '==' 割当で比較したものです。 以上の慣用

    void Update() { 
        if (!First.IsPlaying){ 
         Second.Play; 
        } 
    } 
    

    プラスISPlayingが関数であるように思えます。 SO

    void Update() { 
        if (!First.IsPlaying()){ 
         Second.Play; 
        } 
    } 
    

    を行い、あなたが財産であることをisplayingたい場合、それはラインが不満エラーです。この

    class Player 
    { 
    .... 
        public bool IsPlaying {get;set;} 
    .... 
    } 
    
    +0

    2番目のエラーはなくなりましたが、今私はこれを取得します。 '! 'ステートメントを変更したときに 'method group '型のオペランドに演算子を適用することはできません –

    +0

    edit ........を参照してください。 – pm100

    関連する問題