Inheritance: MonoBehaviour
Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        this.transform.localRotation = Quaternion.identity;

        if ((Input.GetKeyDown(KeyCode.UpArrow) && onGround) || (SwipeScript.GetTouch() == 0 && onGround))
        {
            GetComponent <ConstantForce2D>().force = new Vector3(0f, 30f, 0f);
            //animator.SetTrigger("Flip");
            this.transform.localScale = new Vector3(0.9764434f, -0.9764434f, 0.9764434f);
            onGround = false;
            GetComponent <AudioSource>().Play();
        }

        if ((Input.GetKeyDown(KeyCode.DownArrow) && onGround) || (SwipeScript.GetTouch() == 1 && onGround))
        {
            GetComponent <ConstantForce2D>().force = new Vector3(0f, -30f, 0f);
            this.transform.localScale = new Vector3(0.9764434f, 0.9764434f, 0.9764434f);
            onGround = false;
            GetComponent <AudioSource>().Play();
        }

        if (Input.GetMouseButtonDown(0))
        {
            GetComponent <ConstantForce2D>().force = new Vector3(0f, -1 * GetComponent <ConstantForce2D>().force.y, 0f);
            this.transform.localScale = new Vector3(this.transform.localScale.x, -1 * transform.localScale.y, transform.localScale.z);
            onGround = false;
            GetComponent <AudioSource>().Play();
        }

        if (this.transform.position.x < 0)
        {
            Lose.LoseGame();
        }
    }
Exemple #2
0
        public static void Test()
        {
            Console.WriteLine("### Command");

            var hoshitori   = new Hoshitori();
            var winCommand  = new Win(hoshitori);
            var loseCommand = new Lose(hoshitori);
            var invoker     = new Invoker();

            invoker.AddCommand("w", winCommand);
            invoker.AddCommand("l", loseCommand);

            invoker.Execute("l");
            invoker.Execute("w");
            invoker.Execute("w");
            invoker.Execute("l");
            invoker.Execute("l");
            invoker.Unexecute();
            invoker.Execute("w");
            invoker.Unexecute();
            invoker.Execute("l");
            invoker.Execute("w");

            hoshitori.ShowAll();
        }
Exemple #3
0
        protected Winner_Loser Judgement_Base(Judge Enemy)
        {
            /*
             * じゃんけんの結果を判定。
             * 結果は自身の状態によって決まる。あいこは存在しない。
             */
            Winner_Loser win_lose;

            if (Enemy.pass_ID == Win)
            {
                win_lose = new Win();
            }
            else if (Enemy.pass_ID == Lose)
            {
                win_lose = new Lose();
            }
            else
            {
                win_lose = draw(this.My_Judge.total_force, Enemy.total_force);
            }
            if (Enemy.state_id == Define.Injury_ID)
            {
                win_lose = new Win();
            }
            My_Judge.Last_Result = win_lose.Result;
            return(win_lose);
        }
Exemple #4
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.GetComponent <PlayerController>())
     {
         Lose.LoseGame();
     }
 }
Exemple #5
0
    public void Init()
    {
        instance = this;

        //

        enterGame = Log;

        goPlay += GameManager.instance.charManager.move.Check;
        goPlay += delegate { GameManager.instance.itemManager.isPlaying = true; };
        goPlay += delegate { AudioManager.Instance.PlaySound(AudioManager.AudioName.StartGame, 0.9F); };

        restart += GameManager.instance.Reload;

        moveView += GameManager.instance.charManager.View;

        buyItem += GameManager.instance.itemManager.buyItem;

        setItemInCell += GameManager.instance.itemManager.setItemInCell_World;
        setItemInCell += delegate { AudioManager.Instance.PlaySound(AudioManager.AudioName.ItemDrop, 0.8F); };
        //setItemInCell += LogCellPos;

        lose += delegate { AudioManager.Instance.PlaySound(AudioManager.AudioName.GameOver, 0.8F); };

        win += delegate { AudioManager.Instance.PlaySound(AudioManager.AudioName.LevelClear1, 0.8F); };
        win += delegate { AudioManager.Instance.PlaySound(AudioManager.AudioName.LevelClear2, 0.8F); };
    }
Exemple #6
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.GetComponent <PlayerController>())
     {
         Lose.LoseGame();
     }
 }
    void Update()
    {
        // The player is grounded if a linecast to the groundcheck position hits anything on the ground layer.
        grounded = Physics2D.Linecast(transform.position, groundCheck.position, 1 << LayerMask.NameToLayer("Ground"));

        // If the jump button is pressed and the player is grounded then the player should jump.
        if (Input.GetButtonDown("Jump"))
        {
            jump = true;
        }

        //restart
        if (restart == true)
        {
            transform.position = start;
            restart            = false;
        }
        //win or lose
        if (totalHeart <= 0)
        {
            Time.timeScale = 0f;
            Lose.SetActive(true);
        }
        else if (totalFinish >= 1)
        {
            Time.timeScale = 0f;
            Win.SetActive(true);
        }
    }
        private void planilla_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            var x = e.KeyCode;

            switch (x)
            {
            case Keys.Down: tab.Abajo(); fondo.Invalidate(); break;

            case Keys.Left: tab.Izquierda(); fondo.Invalidate(); break;

            case Keys.Right: tab.Derecha(); fondo.Invalidate(); break;

            case Keys.Up: tab.Arriba(); fondo.Invalidate(); break;

            case Keys.Back: undoToolStripMenuItem_Click(sender, null); break;

            default: break;
            }
            puntos.Text = Convert.ToString(tab.score);
            if (tab.BestScore < tab.score)
            {
                tab.BestScore   = tab.score;
                mejorpunto.Text = Convert.ToString(tab.BestScore);
            }

            if (tab.Perdiste())
            {
                Form Badluck = new Lose();
                Badluck.ShowDialog();
                tab.Iniciar(dimensiones);
                fondo.Invalidate();
            }
        }
 void Start()
 {
     style = new GUIStyle();
     style.fontSize = Screen.height * 2 / 50;
     style.normal.textColor = Color.black;
     loseScript = GetComponent<Lose>();
     numberConverter = GetComponent<NumberToNumberTexture>();
 }
 void Start()
 {
     style                  = new GUIStyle();
     style.fontSize         = Screen.height * 2 / 50;
     style.normal.textColor = Color.black;
     loseScript             = GetComponent <Lose>();
     numberConverter        = GetComponent <NumberToNumberTexture>();
 }
Exemple #11
0
 public void SumarAi()
 {
     scoreAi++;
     if (scoreAi >= 7)
     {
         Lose.SetActive(true);
         Time.timeScale = 0;
     }
 }
Exemple #12
0
 private void OnRunningIntoKnife(Knife knife)
 {
     _knifeCount--;
     knife.RanIntoApple -= OnAppleEnter;
     knife.RanIntoKnife -= OnRunningIntoKnife;
     knife.RanIntoKnife -= OnLogEnter;
     knife.RanIntoApple -= OnAppleEnter;
     Lose?.Invoke();
 }
 void Start()
 {
     AleatoryAnimal  = Random.Range(0, 4);
     AleatorySpawner = Random.Range(0, 4);
     Instantiate(Animals[AleatoryAnimal], Spawners[AleatorySpawner].transform);
     Instantiate(AnimalsInstantiate[AleatoryAnimal], QuestionAnimal.transform);
     Win.SetActive(false);
     Lose.SetActive(false);
 }
Exemple #14
0
 private void System_Reset()
 {
     //establishes base content settings that will be used whenever it is time to reset content
     textBox.Text = "";
     Lighting_off();
     State = 0;
     Level = 1;
     list_Clearer();
     Lose.Play();
 }
Exemple #15
0
    void Awake()
    {
        TransportGo.speed = 1.25f;
        MinesGo.speed     = 1.75f;
        Lose.WIN          = false;

        repeat_time = 5f;
        go_timer    = false;
        rand        = 10;

        destroyed_enemy = 0;
        all_enemy_dest  = 0;

        /*leftCorner = null;
         * rightCorner = null;
         * upCorner = null;
         * downCorner = null;
         *
         * player = null;
         * targetMines = null;
         * portation = null;
         *
         * targetTransport = null;
         * lose = null;
         *
         * controller = null;
         * pool = null;
         * variables = null;*/

        new_parent = GameObject.Find("Zoom").transform;
        lose       = GameObject.FindGameObjectWithTag("GameController").GetComponent <Lose>();
        pool       = GameObject.FindGameObjectWithTag("GameController").GetComponent <Pool>();
        variables  = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <SearchVariable>();
        controller = GameObject.FindGameObjectWithTag("GameController").GetComponent <IGameController>();
        heroGo     = GameObject.FindGameObjectWithTag("Hero").GetComponent <HeroGo>();

        leftCorner  = GameObject.Find("leftCorner");
        rightCorner = GameObject.Find("rightCorner");
        upCorner    = GameObject.Find("upCorner");
        downCorner  = GameObject.Find("downCorner");

        targetMines     = GameObject.Find("MinesPortalIn").transform;   // ціль монстрів
        player          = GameObject.Find("Hero").transform;            // ціль монстрів
        portation       = GameObject.Find("MinesPortalOut").transform;  // ціль монстрів
        targetTransport = GameObject.Find("TransportPortal").transform; // ціль монстрів

        if (controller.lvl() == 2)
        {
            range = 5;
        }
        else
        {
            range = 6;
        }
    }
Exemple #16
0
    public void Awake()
    {
        if (Time.timeScale == 0)
        {
            Time.timeScale = 1;
        }

        cageTransform = GameObject.FindGameObjectWithTag("Player").transform;
        cageScript    = cageTransform.GetComponent <Cage>();
        loseScript    = Camera.main.GetComponent <Lose>();
    }
Exemple #17
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
        public void EndGame(bool win = false)
        {
            Win.SetActive(win);
            Lose.SetActive(!win);

            OnGameOver?.Invoke();

            MainMenu.Hide();
            GameOver.Hide();
            ScoreScreen.Show();

            _gameover = true;
        }
Exemple #19
0
 public void WinOrLose(bool win)     // выграл или проиграл
 {
     if (win)
     {
         Win.SetActive(true);
     }
     else
     {
         Time.timeScale = 0;
         Lose.SetActive(true);
     }
     Restart.SetActive(true);
 }
    void Update()
    {
        score = PlayerPrefs.GetInt("CheckScore");

        if (score == 1)
        {
            Win.SetActive(true);
        }
        if (score == 2)
        {
            Lose.SetActive(true);
        }
    }
Exemple #21
0
    // Update is called once per frame
    void Update()
    {
        time       -= Time.deltaTime;
        UIText.text = time.ToString("f0");


        if (time <= 0)
        {
            Time.timeScale = 0;
            time           = 0;
            Lose.SetActive(true);
            SfxManager.sfxInstance.Audio.PlayOneShot(SfxManager.sfxInstance.Error);
        }
    }
Exemple #22
0
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public void BttnCheck()
    {
        if (Score == 9)
        {
            Win.SetActive(true);
            Lose.SetActive(false);
            SfxManager.sfxInstance.Audio.PlayOneShot(SfxManager.sfxInstance.Confirm);
        }
        else
        {
            Win.SetActive(false);
            Lose.SetActive(true);
            StartCoroutine("Wait");
            SfxManager.sfxInstance.Audio.PlayOneShot(SfxManager.sfxInstance.Error);
        }
    }
Exemple #23
0
    // Update is called once per frame
    void Update()
    {
        spawnTime = SPEEDUP.spawnTime;


        if (wave == 4 && cnt == -1 && Hp.HP >= 1)
        {
            Page.SetActive(true);
            Win.SetActive(true);
        }
        else if (Hp.HP <= 0)
        {
            Page.SetActive(true);
            Lose.SetActive(true);
        }
    }
 public void ActivateGenerator()
 {
     if (this.Activated)
     {
         SlowPrint.Print("This generator is already running...");
     }
     else if (!this.Unlucky)
     {
         this.Activated = true;
         SlowPrint.Print("You hear a soft hum, and lights blink on. The generator is now running.");
     }
     else
     {
         Lose.LoseSequence();
     }
 }
Exemple #25
0
    void Start()
    {
        Win.SetActive(false);
        Lose.SetActive(false);


        HairInitialPos      = Hair.transform.position;
        NoseInitialPos      = Nose.transform.position;
        CejaLeftInitialPos  = CejaLeft.transform.position;
        CejaRightInitialPos = CejaRight.transform.position;
        EyeLeftInitialPos   = EyeLeft.transform.position;
        EyeRightInitialPos  = EyeRigh.transform.position;
        OrejaRInitialPos    = OrejaR.transform.position;
        OrejaIInitialPos    = OrejaI.transform.position;
        MouthInitialPos     = Mouth.transform.position;
    }
Exemple #26
0
    public void End(bool isWin)
    {
        EndPanel.SetActive(true);

        if (isWin)
        {
            Win.SetActive(true);
            Lose.SetActive(false);
        }
        else
        {
            Win.SetActive(false);
            Lose.SetActive(true);
        }
        Time.timeScale = 0f;
    }
Exemple #27
0
 void Awake()
 {
     GetComponent <FileManager>().Retrieve("__level_sequence__.txt", FileManager.RetrievalMode.ALWAYS_ONLINE);
     MobileAds.Initialize(appID);
     mainMenu     = GetComponent <MainMenu>();
     options      = GetComponent <Options>();
     pauseMenu    = GetComponent <PauseMenu>();
     credits      = GetComponent <Credits>();
     password     = GetComponent <Password>();
     highscores   = GetComponent <Highscores>();
     errorMessage = GetComponent <ErrorMessage>();
     win          = GetComponent <Win>();
     lose         = GetComponent <Lose>();
     introLevel   = GetComponent <IntroLevel>();
     gameState    = isDebuggingNewLevel == true ? GameState.PLAYING : GameState.MAIN_MENU;
 }
Exemple #28
0
    // Use this for initialization
    void Start()
    {
        lose = loseGameObject.GetComponent <Lose>();

        playerScript = player.gameObject.GetComponent <Player>();

        btnPause.onClick.AddListener(() => onPauseClick());

        btnResumePausePanel.onClick.AddListener(() => onResumeClick());
        btnMenuPausePanel.onClick.AddListener(() => onMenuClick());

        btnReplayWinPanel.onClick.AddListener(() => onReplyClick());
        btnMenuWinPanel.onClick.AddListener(() => onMenuClick());

        btnReplyLosePanel.onClick.AddListener(() => onReplyClick());
        btnMenuLosePanel.onClick.AddListener(() => onMenuClick());
    }
Exemple #29
0
        void artficialInteligence_Tick(object sender, EventArgs e)
        {
            CharecterSelector.Player.HealthPoints -= (this.collectionOfEnemies[0].AttackPoints - CharecterSelector.Player.DefencePoints < 0) ?
                                                     0 : (this.collectionOfEnemies[0].AttackPoints - CharecterSelector.Player.DefencePoints);
            MonsterAttack monsterAnimation = new MonsterAttack(new FirstLevelMonster(Image.FromFile("monster.png")));

            monsterAnimation.Show();
            if (CharecterSelector.Player.HealthPoints <= 0)
            {
                UpdateScore(CharecterSelector.Player.Name, CharecterSelector.Player.Score);
                Lose lose = new Lose();
                lose.Show();
                this.Close();
                CharecterSelector.levelSelector.Close();
            }
            artficialInteligence.Stop();
        }
Exemple #30
0
        private void ShowIcon()
        {
            if (PlayerHP > 0 && EnemyHP > 0)
            {
                Rock.Visibility     = Visibility.Visible;
                Paper.Visibility    = Visibility.Visible;
                Scissors.Visibility = Visibility.Visible;

                Pselect.Visibility = Visibility.Visible;
                Eselect.Visibility = Visibility.Visible;

                RockSelect.Visibility     = Visibility.Visible;
                ScissorsSelect.Visibility = Visibility.Visible;
                PaperSelect.Visibility    = Visibility.Visible;

                RockText.Visibility     = Visibility.Visible;
                ScissorsText.Visibility = Visibility.Visible;
                PaperText.Visibility    = Visibility.Visible;

                RockPer.Visibility     = Visibility.Visible;
                ScissorsPer.Visibility = Visibility.Visible;
                PaperPer.Visibility    = Visibility.Visible;

                Game();
            }

            else
            {
                HardTheme.Stop();
                End.Visibility = Visibility.Visible;
                if (PlayerHP == 0)
                {
                    Lose.Play();
                    End.Text      = "You Lose!";
                    OK.Visibility = Visibility.Visible;
                }
                else
                {
                    Win.Play();
                    End.Text      = "You Win!";
                    OK.Visibility = Visibility.Visible;
                }
            }
        }
Exemple #31
0
        public Lose GetLose(Person p)
        {
            SqlCommand    cmd    = ConnectSql(string.Format("Select * From Lose Where LoseId = '{0}' ", p.PersonID));
            SqlDataReader reader = cmd.ExecuteReader();
            Lose          lose   = new Lose();
            bool          check  = false;

            if (reader.Read())
            {
                lose  = lose.Initialization(reader);
                check = true;
            }
            connection.DisConnectSql();
            if (check == true)
            {
                return(lose);
            }
            return(null);
        }
 void Awake()
 {
     inputState = GameObject.FindObjectOfType<InputState> ();
     lose = GameObject.FindObjectOfType<Lose> ();
 }
 void Awake()
 {
     PlayerPrefs.SetInt("Titem", 0);
     m_gameManagerComponent = m_gameManager.GetComponent<GameManager>();
     m_loseScript = m_HudPlayer.GetComponent<Lose>();
 }