SetInvisible() public method

public SetInvisible ( ) : void
return void
示例#1
0
 void OnTriggerEnter2D(Collider2D col)
 {
     //If the player collides with the patrolling enemy and not hiding
     if (col.gameObject.tag == "Player" && player.hide == false)
     {
         //Monster stops moving
         // speed = 0;
         //deactivate monster when colliding with player
         player.SetInvisible();
         StartCoroutine("SetInactive");
     }
 }
示例#2
0
    //When the player collides with the patrolling enemy
    void OnTriggerEnter2D(Collider2D col)
    {
        //If the player collides with the patrolling enemy and not hiding
        if (col.gameObject.tag == "Player" && player.hide == false)
        {
            //player.chasingMonsterScript = this;
            // Stop the monster; it will not be able to return to the normal speed.
            speedNormal = speedChasing = 0;
            player.SetInvisible();
            anim.SetBool("Kill", true);
            StartCoroutine("StartMovement");

            //If monster is facing left and the player is behind the monster OR monster is facing
            //right and player is behind the monster
            if ((!facingRight && (gameObject.transform.position.x < player.transform.position.x)) ||
                (facingRight && (gameObject.transform.position.x > player.transform.position.x)))
            {
                //Flip the monster to face the player
                FlipEnemy();
            }
        }
    }
示例#3
0
    //When the player collides with the patrolling enemy
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.name == "BasementWallRight") //&& isCaught)
        {
            this.gameObject.SetActive(false);
        }

        //If the player collides with the patrolling enemy and is not caught and hunter is moving
        if (col.gameObject.tag == "Player" && !player.hide && speed > 0) //&& isCaught)
        {
            player.canHide        = false;
            player.killedByHunter = true;
            killPlayer            = true;
            anim.SetBool("Kill", true);
            //stores instance of this in player

            player.hunterScript = this;
            //Monster stops moving
            speed = 0;
            player.normalSpeed = 0;
            player.SetInvisible();
            //anim.ResetTrigger("Kill");

            ////removed fip code, possibly needs an offset

            //If monster is facing left and the player is behind the monster OR monster is facing
            //right and player is behind the monster

            /*
             * if ((!facingRight && (gameObject.transform.position.x < player.transform.position.x))
             || (facingRight && (gameObject.transform.position.x > player.transform.position.x)))
             ||{
             || //Flip the monster to face the player
             || FlipEnemy();
             ||}
             */
        }
    }