PlayerControl.Update C# (CSharp) Method

Update() public method

public Update ( ) : void
return void
    void Update()
    {
        //if player is killed, set player object's alpha to 0 (make invisible)
        /*if(isAlive==false)
        {
            GetComponent<SpriteRenderer>().color = new Color(1f, 1f, 1f, 0f);
        }
        */
        //code for sprinting (for debugging)
        //////////////////////////////////////////////
        /*
        if (Input.GetKey(KeyCode.LeftShift))
        {
            //it shift key is hit, players speed is 2 times the speed
            sprint = true;
        }
        else
        {
            sprint = false;
        }
        */
        /////////////////////////////////////////////
        // Code to spawn a HunterMonster targeting the player at a random location within
        // the same floor.
        if (!isHunterActive && standardLevel == true)//check if hunter is currently inactive and if this level should spawn a hunter
        {
            if (transform.position.y > floorOne && transform.position.y < floorTwo)
            {
                isHunterActive = true;
                StartCoroutine(SpawnHunterMonster(hunterInactiveDuration, floorOne, floorTwo));
            }
            if (transform.position.y > floorTwo && transform.position.y < floorThree)
            {
                isHunterActive = true;
                StartCoroutine(SpawnHunterMonster(hunterInactiveDuration, floorTwo, floorThree));
            }
            if (transform.position.y > floorThree && transform.position.y < floorFour)
            {
                isHunterActive = true;
                StartCoroutine(SpawnHunterMonster(hunterInactiveDuration, floorThree, floorFour));
            }
            if (transform.position.y > floorFour && transform.position.y < floorFive)
            {
                isHunterActive = true;
                StartCoroutine(SpawnHunterMonster(hunterInactiveDuration, floorFour, floorFive));
            }
            if (transform.position.y > floorFive && transform.position.y < floorAttic)
            {
                isHunterActive = true;
                StartCoroutine(SpawnHunterMonster(hunterInactiveDuration, floorFive, floorAttic));
            }
        }
    }

Usage Example

示例#1
0
 private void FixedUpdate()
 {
     m_playerControl.Update(transform);
 }
All Usage Examples Of PlayerControl::Update