示例#1
0
    private void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
            return;
        }

        instance = this;
        DontDestroyOnLoad(this.gameObject);
    }
示例#2
0
 // Start is called before the first frame update
 void Start()
 {
     animator   = GetComponent <Animator>();
     movScript  = GetComponent <PlayerMovement>();
     castScript = GetComponent <PlayerCasting>();
     atkPUp     = transform.Find("attackPointU").GetComponent <Transform>();
     atkPRight  = transform.Find("attackPointR").GetComponent <Transform>();
     atkPDown   = transform.Find("attackPointD").GetComponent <Transform>();
     atkPLeft   = transform.Find("attackPointL").GetComponent <Transform>();
     swordSwing = GameObject.Find("SwordSwing").GetComponent <AudioSource>();
     arrowShoot = GameObject.Find("ArrowShoot").GetComponent <AudioSource>();
     currDir    = 1f;
     lastDir    = currDir;
 }