コード例 #1
0
    private float enemyScale;         // Sets the default scale of the enemy to make sure that all enemies are the same size.

    void Start()
    {
        UpdateDistFromPlayer();                                                     // Grab initial player distance reference.
        player         = GameObject.Find("Player").GetComponent <PlayerFighting>(); // Target player health/damage object.
        score          = GameObject.Find("ScoreUI").GetComponent <CountScore>();    // Target the gameobject handled within the CountScore script.
        animator       = gameObject.GetComponent <Animator>();                      // Get reference of the enemy animator.
        playerLocation = GameObject.Find("Player").transform;
        // Set initial values of enemy variants:
        if (gameObject.name == "Boss")
        {
            health     = 1000f;
            enemyScale = 0.1f;                  // Make the boss scale larger than regular enemies.
            damage     = 20f;                   // Boss deals higher damage than regular enemies.
        }
        else if (gameObject.name == "Miniboss") // Set miniboss to intermediate stage of damage, health etc. (between regular enemy and boss).
        {
            health     = 250f;
            enemyScale = 0.09f;
        }
        else
        {
            health     = 100f;
            enemyScale = 0.07f;
        }
    }
コード例 #2
0
    void Start()
    {
        animator   = GetComponentInChildren <Animator>();
        countScore = GameObject.Find("Score").GetComponent <CountScore>();//抓取 Score 的 Component

        Target = GameObject.FindGameObjectWithTag("Player");
    }
コード例 #3
0
 // Use this for initialization
 void Start()
 {
     _score = 0;
     SetScoreText();
     InvokeRepeating("AddPoints", 1.0f, 1.0f);
     if (Instance)
     {
         throw new Exception("Multiple CountScore instances");
     }
     Instance = this;
 }
コード例 #4
0
    void Start()
    {
        meshAgent  = GetComponent <NavMeshAgent>();
        animator   = GetComponentInChildren <Animator>();
        countScore = GameObject.Find("Score").GetComponent <CountScore>();//抓取 Score 的 Component

//        Target = GameObject.FindGameObjectWithTag("Player");

        meshAgent.speed        = Random.Range(2, 5); // AI的 range area
        meshAgent.acceleration = Random.Range(6, 10);

        //產生出生特效
        Instantiate(RefBorn, transform.position, transform.rotation);
    }
コード例 #5
0
 void Dying()
 {
     StartCoroutine(ScreenFader.FadeOut());
     animator.SetBool("isDrowning", false);
     animator.SetTrigger("Die");
     Camera.main.GetComponent <CameraMovement>().target = null;
     GetComponent <CircleCollider2D>().enabled          = false;
     isDead      = true;
     rb.velocity = new Vector2(0f, dieFallSpeed);
     Camera.main.GetComponent <CameraMovement>().PlayBubblesSound();
     FinishCanvasThing.SetActive(true);
     //GameObject.FindGameObjectWithTag("ScoreScreen").SetActive(true);
     StartCoroutine(CountScore.Activate(CollectableSystem.instance.score));
 }
コード例 #6
0
 // Use this for initialization
 void Start()
 {
     countScore = GetComponent<CountScore>();
     isGenerated = false;
 }
コード例 #7
0
 void Start()
 {
     cs = FindObjectOfType <CountScore>();
     pm = FindObjectOfType <PlayerMovement>();
 }
コード例 #8
0
 void Start()
 {
     countScore = gameController.GetComponent<CountScore>();
 }
コード例 #9
0
 private void Awake()
 {
     countScore = GameObject.Find("Score").GetComponent <CountScore>();
 }
コード例 #10
0
 // Start is called before the first frame update
 void Start()
 {
     NewScore = GameObject.FindWithTag("ScoreManager").GetComponent <CountScore>();
 }