示例#1
0
    // Start is called before the first frame update
    void Awake()
    {
        particles        = this.gameObject.GetComponentInChildren <ParticleSystem>();
        animator         = gameObject.GetComponent <Animator>();
        playerPresent    = false;
        platformRenderer = gameObject.GetComponent <SpriteRenderer>();
        InitialTimeLeft  = timeLeft;
        mCamera          = Camera.main;
        camHeight        = Mathf.Abs(Vector3.Distance(
                                         mCamera.ViewportToWorldPoint(new Vector3(0.5f, 0f, 10)),
                                         mCamera.ViewportToWorldPoint(new Vector3(0.5f, 1f, 10))
                                         ));

        Catformer.PlayerScript player = GameObject.FindGameObjectWithTag("Player").GetComponent <Catformer.PlayerScript>();
        if (player.GetScore() >= 160f)
        {
            timeLeft        = 2f;
            InitialTimeLeft = 2f;
        }
        else if (player.GetScore() >= 300f)
        {
            timeLeft        = 1f;
            InitialTimeLeft = 1f;
        }

        isLeaf = platformRenderer.sprite.name.Contains("Leaf");
    }
 // Start is called before the first frame update
 void Start()
 {
     playerRef          = GameObject.FindGameObjectWithTag("Player").transform;
     lastPlayerPosition = playerRef.position.y;
     followTarget       = GetComponent <Camera>().ViewportToWorldPoint(new Vector3(0.5f, followLine, Z_POS));
     Catformer.PlayerScript script = playerRef.GetComponent <Catformer.PlayerScript>();
     if (script != null)
     {
         script.AddDeathListener(OnPlayerDeathTrigger);
     }
 }
示例#3
0
 // Start is called before the first frame update
 void Start()
 {
     background = GetComponent <Image>();
     playerRef  = GameObject.FindGameObjectWithTag("Player").GetComponent <Catformer.PlayerScript>();
     playerRef.AddDeathListener(OnPlayerDeathTrigger);
 }