Ejemplo n.º 1
0
 void showGun()
 {
     gun.transform.localScale = new Vector3(1f, 1f, 1f);
     GentlemansSingleton.GetPlayer().GetAnimator().SetBool("Attacking", true);
     if (Input.mousePosition.x > Screen.width / 2)
     {
         GentlemansSingleton.GetPlayer().GetSpriteRenderer().flipX = false;
         gunSr.flipX = false;
     }
     else
     {
         GentlemansSingleton.GetPlayer().GetSpriteRenderer().flipX = true;
         gunSr.flipX = true;
     }
     shownTime = Time.time;
 }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(1) && !GentlemansSingleton.GetPlayer().GetAnimator().GetBool("Attacking"))
        {//right click
            shooting = true;
            showGun();
            pointGun();
            fireGun();
            GetComponent <AudioSource>().Play();
        }

        if (Time.time - shownTime > disappearDelay && shooting)
        {
            shooting = false;
            gun.transform.localScale = new Vector3(0f, 0f, 0f);             //hide gun
            GentlemansSingleton.GetPlayer().GetAnimator().SetBool("Attacking", false);
        }
    }
Ejemplo n.º 3
0
    void isDead()
    {
        currentScene = SceneManager.GetActiveScene().name;

        if (currentScene == "LevelOneThePit")
        {
            GentlemansSingleton.SetSceneNum(1);
        }
        else if (currentScene == "LevelTwoTheTower")
        {
            GentlemansSingleton.SetSceneNum(2);
        }
        else if (currentScene == "LevelThreeFinalBoss")
        {
            GentlemansSingleton.SetSceneNum(3);
        }

        Application.LoadLevel("GameOver");
    }
Ejemplo n.º 4
0
 void Update()
 {
     if (Input.GetMouseButtonDown(0) && turning == false &&
         !GentlemansSingleton.GetPlayer().GetAnimator().GetBool("Attacking"))               //left click
     {
         GentlemansSingleton.GetPlayer().GetAnimator().SetBool("Attacking", true);
         turning = true;
         cane.transform.localScale = new Vector3(1f, 1f, 1f);
         GetComponent <AudioSource>().Play();
         spinTime = Time.time;
         if (Input.mousePosition.x > Screen.width / 2)
         {
             right = true;
             GentlemansSingleton.GetPlayer().GetSpriteRenderer().flipX = false;
             caneSr.flipX = false;
         }
         else
         {
             right = false;
             GentlemansSingleton.GetPlayer().GetSpriteRenderer().flipX = true;
             caneSr.flipX = true;
         }
     }
     if (turning)
     {
         if (right)
         {
             cane.Rotate(Vector3.back * speed * Time.deltaTime);
         }
         else
         {
             cane.Rotate(Vector3.forward * speed * Time.deltaTime);
         }
         if (Time.time - spinTime > timeBetweenSwings)
         {
             GentlemansSingleton.GetPlayer().GetAnimator().SetBool("Attacking", false);
             turning = false;
             cane.transform.localScale = new Vector3(0f, 0f, 0f);
             cane.rotation             = Quaternion.identity;
         }
     }
 }
Ejemplo n.º 5
0
    void Start()
    {
        GentlemansSingleton.SetPlayer(this);

        canJump   = true;
        isJumping = false;
        wall1     = false;
        wall2     = false;
        //sceneNumb = 0;

        tm          = GetComponent <Transform>();
        jumpToHight = 0f;

        anim      = GetComponent <Animator>();
        rb        = GetComponent <Rigidbody2D>();
        sr        = GetComponent <SpriteRenderer>();
        someScale = transform.localScale.x;

        timeToHit = Time.time;
        flicker   = false;
    }
Ejemplo n.º 6
0
    public void restartLevel()
    {
        //PlayerController restartScene;

        //restartScene = (PlayerController)FindObjectOfType(typeof(PlayerController));

        switch (GentlemansSingleton.GetSceneNum())
        {
        case (int)1:
            Application.LoadLevel("LevelOneThePit");
            break;

        case (int)2:
            Application.LoadLevel("LevelTwoTheTower");
            break;

        case (int)3:
            Application.LoadLevel("LevelThreeFinalBoss");
            break;
        }
    }