PlayerControl.Start C# (CSharp) Method

Start() public method

public Start ( ) : void
return void
    void Start()
    {
        normalSpeed = defaultSpeed;
        clickPosition = new Vector2(0f, 0f);
        screenWidth = new Vector2((float)Screen.width, 0f);
        edgeLeft = new Vector2(screenWidth.x * EDGEBUFFER, 0f);
        edgeRight = new Vector2(screenWidth.x - edgeLeft.x, 0f);
        sprite = GetComponent<SpriteRenderer>();
        slowMoSpeed = normalSpeed / 2;
        sprintSpeed = normalSpeed * 2;
        wallR = GameObject.Find("RightWall");
        wallL = GameObject.Find("LeftWall");
        /////
        anim = this.GetComponent<Animator>();
        anim.SetBool("FacingRight", facingRight);
        initialColor = sprite.color;
        slowMo = false;  //slowMo starts out as false since the player hasn't hit the button yet

        // Formula to calculate the hunter duration
        Debug.Log("Stage Level: " + Application.loadedLevel);
        if(Application.loadedLevelName == "Ending Level" || Application.loadedLevelName == "Tutorial Stage" || Application.loadedLevelName == "Nightmare")
        {
            standardLevel = false;
        }
        // What is 40?
        // Application.loadedLevel requires that the levels be set in the build in a particular order, this is dangerous.
        hunterInactiveDuration = 40 - 10 * (Application.loadedLevel - 3);
        // What is 8? Should probably be a constant variable
        if (hunterInactiveDuration < 8)
            hunterInactiveDuration = 8;
    }

Usage Example

Ejemplo n.º 1
0
 public void PlayGame()
 {
     player.gameObject.SetActive(true);
     animaLisPlatform.gameObject.SetActive(true);
     animaLisPlatform.enabled = true;
     if (animaLisPlatform.isPlaying)
     {
         animaLisPlatform.Stop();
     }
     animaLisPlatform.Play();
     dataGame.platformActive = Random.Range(0, dataGame.platform.Length);
     for (int i = 0; i < listPlatform.childCount; i++)
     {
         Platform platform = listPlatform.GetChild(i).GetComponent <Platform> ();
         platform.enabled = true;
         platform.SetRadius();
     }
     cam.Start();
     player.Start();
 }
All Usage Examples Of PlayerControl::Start