Пример #1
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject deathCounter = GameObject.Find("Death_counter");

        deathCounterScript = deathCounter.GetComponent <DeathCounter>();
        StartCoroutine("WaitAndDie");
    }
    private void Awake()
    {
        // singleton design pattern
        if (instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
            DontDestroyOnLoad(gameObject);

            if (serverThread == null)
            {
                serverThread = new Thread(() => RunServer());
                serverThread.Start();
                Debug.Log("Starting server");
            }
        }

        spawner = GameObject.Find("BlockSpawner").GetComponent <BlockSpawner>();

        if (spawner == null)
        {
            serverThread.Join();
            serverThread = null;
            Debug.Log("Spawner is required.");
        }

        deathCounter = GetComponent <DeathCounter>();
    }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        //_walkingSpeed = 3;
        _walkingSpeed = 5;
        _runningSpeed = 5;
        _jumpForce    = 1000;

        _deathCounter = DeathCounter.Instance;
        //_lastCheckPoint = new CheckPoint(this.transform.position, 0);
        //_playerController = FindObjectOfType<PlayerController>();

        this.gameObject.AddComponent <CheckPoint>();
        _lastCheckPoint          = this.gameObject.GetComponent <CheckPoint>();
        _lastCheckPoint.index    = 0;
        _lastCheckPoint.Position = this.transform.position;

        IsWalking  = false;
        IsRunning  = false;
        IsJumping  = false;
        IsGrounded = false;
        IsDead     = false;

        arrayCaixas            = FindObjectsOfType(typeof(BoxCheckpoint)) as BoxCheckpoint[];
        arrayPlataformasMoveis = FindObjectsOfType(typeof(PlataformSlider)) as PlataformSlider[];
    }
Пример #4
0
    private void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
            return;
        }

        instance = this;

        DontDestroyOnLoad(this.gameObject);
    }
Пример #5
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
Пример #6
0
    private void Awake()
    {
        if (Instance)
        {
            Destroy(gameObject);
        }
        else
        {
            Instance = this;
        }

        DontDestroyOnLoad(gameObject);
    }
Пример #7
0
    private void Start()
    {
        deathCounter = FindObjectOfType <DeathCounter>();
        if (photonView.IsMine)
        {
        }
        else
        {
            GetComponent <PlayerMovement>().enabled = false;
        }

        _playerCreator = GameObject.Find("MultiplayerManager").GetComponent <PhotonPlayerCreator>();
    }
Пример #8
0
        public Form1()
        {
            InitializeComponent();
            var configPath = AppDomain.CurrentDomain.BaseDirectory;

            configPath = System.IO.Path.Combine(configPath, "ds3DeathCount.conf");
            var fileTarget = System.IO.File.ReadAllText(configPath);

            this.fileTarget = fileTarget.Trim();
            MessageBox.Show(this.fileTarget);
            using (var file = new System.IO.StreamWriter(this.fileTarget))
            {
                file.Write(this.lblDeaths.Text);
            }

            try
            {
                DeathCounter = new DeathCounter();
            }
            catch (NoAdminPrivilegesException)
            {
                if (language == 0)
                {
                    DialogResult ok = MessageBox.Show("Insufficient permissions. Try it again with admin rights.", "Error");
                }

                if (language == 1)
                {
                    DialogResult ok = MessageBox.Show("Permisos insuficientes. Inténtalo de nuevo ejecutándo como administrador.", "Error");
                }

                Environment.Exit(0);
            }
            catch (NoProcessFoundException)
            {
                if (language == 0)
                {
                    DialogResult ok = MessageBox.Show("The game is not running. Start the game and load a savegame before launching the application.", "Error");
                }

                if (language == 1)
                {
                    DialogResult ok = MessageBox.Show("El juego no esta en funcionamiento. Inicia el juego y selecciona una partida antes de ejecutar la aplicación", "Error");
                }

                Environment.Exit(0);
            }

            //starts the process that count deaths every .5 seconds
            new Thread(new ThreadStart(runThread)).Start();
        }
Пример #9
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);
    }
Пример #10
0
    private void Awake()
    {
        if (SceneManager.GetActiveScene().name == "Scrolling Background_current")
        {
            DontDestroyOnLoad(FindObjectOfType <Canvas>());
            DontDestroyOnLoad(FindObjectOfType <Camera>());

            if (dcInstance == null)
            {
                DontDestroyOnLoad(this);
                dcInstance = this;
            }

            player     = GameObject.FindWithTag("Player");
            score      = 0;
            frameCount = 0;
        }
    }
Пример #11
0
    public override BattleState GetNextState()
    {
        BattleState nextState;

        if (IveLost())
        {
            nextState = currentBattleStatesFactory.CreateEndGameState(winnerFactory: currentBattleStatesFactory);
        }
        else if (DeathCounter.AreCardsDyingToFew())
        {
            nextState = currentBattleStatesFactory.CreateIsGameTiedState();
        }
        else
        {
            nextState = currentBattleStatesFactory.CreateBeginTurnState();
        }
        return(nextState);
    }
Пример #12
0
    void Start()
    {
        _rigidbody = GetComponent <Rigidbody2D>();
        resetPos   = transform.position;

        _PlayerHealth = GetComponent <PlayerHealth>();

        direction = 1;

        timer = maxTimeBetweenBullets;

        BulletManager = GetComponent <BulletManager>();
        BulletManager.Init();

        deathCounter = GetComponent <DeathCounter>();
        deathCounter.Init();

        animator = GetComponent <Animator>();
    }
Пример #13
0
    // Use this for initialization
    void Start()
    {
        _walkingSpeed = 3;
        _runningSpeed = 5;
        _jumpForce    = 20;

        _deathCounter = DeathCounter.Instance;
        //_lastCheckPoint = new CheckPoint(this.transform.position, 0);
        _playerController = FindObjectOfType <PlayerController>();

        this.gameObject.AddComponent <CheckPoint>();
        _lastCheckPoint          = this.gameObject.GetComponent <CheckPoint>();
        _lastCheckPoint.index    = 0;
        _lastCheckPoint.position = this.transform.position;

        IsWalking  = false;
        IsRunning  = false;
        IsJumping  = false;
        IsGrounded = false;
        IsDead     = false;
    }
Пример #14
0
        public Form1()
        {
            InitializeComponent();
            try
            {
                DeathCounter = new DeathCounter();
            }
            catch (NoAdminPrivilegesException)
            {
                if (language == 0)
                {
                    DialogResult ok = MessageBox.Show("Insufficient permissions. Try it again with admin rights.", "Error");
                }

                if (language == 1)
                {
                    DialogResult ok = MessageBox.Show("Permisos insuficientes. Inténtalo de nuevo ejecutándo como administrador.", "Error");
                }

                Environment.Exit(0);
            }
            catch (NoProcessFoundException)
            {
                if (language == 0)
                {
                    DialogResult ok = MessageBox.Show("The game is not running. Start the game and load a savegame before launching the application.", "Error");
                }

                if (language == 1)
                {
                    DialogResult ok = MessageBox.Show("El juego no esta en funcionamiento. Inicia el juego y selecciona una partida antes de ejecutar la aplicación", "Error");
                }

                Environment.Exit(0);
            }

            //starts the process that count deaths every .5 seconds
            new Thread(new ThreadStart(runThread)).Start();
        }
Пример #15
0
    void Start()
    {
        textDied.text = "";
        alive         = true;
        GameObject deathObjectCounter = GameObject.FindWithTag("DeathCounter");

        if (deathObjectCounter != null)
        {
            deathCounter = deathObjectCounter.GetComponent <DeathCounter>();
        }
        if (deathCounter == null)
        {
            Debug.Log("Ne moze naci'GameController' skriptu");
        }
        controller      = GetComponent <Controller2D>();
        gravity         = -(2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2);
        maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;
        minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight);
        print("Gravity: " + gravity + "  Jump Velocity: " + maxJumpVelocity);
        animator = GetComponent <Animator>();
        animator.SetBool("heDead", false);
    }
Пример #16
0
    IEnumerator HandleDeath()
    {
        dead      = true;
        deathTime = Time.time;

        // Increment death counter
        DeathCounter deathCounter = GameObject.Find("DeathCount").GetComponent <DeathCounter> ();

        deathCounter.AddDeath();

        // Disable movement
        mv.enabled = false;

        // Stop us from being locked into the knocked down animation
        anim.SetBool("Knocked Down", false);

        // Gib player
        anim.SetTrigger("Dead");

        // Show "You died" message
        deathMessage.SetActive(true);

        for (int i = 0; i < 4; i++)
        {
            yield return(new WaitForSeconds(0.5f));

            music.pitch -= 0.2f;
        }
        yield return(new WaitForSeconds(0.5f));

        music.Stop();

        // Wait for a bit (or for button press)
        yield return(new WaitForSeconds(deathMessageLength - 0.5f));

        // Reload level
        RestartLevel();
    }
Пример #17
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject go = GameObject.Find("GameState");

        if (go == null)
        {
            go      = new GameObject();
            go.name = "GameState";
            go.AddComponent <GameState>();
        }
        GameObject dc = GameObject.Find("Death_counter");

        if (dc == null)
        {
            dc      = Instantiate(Death_counter);
            dc.name = "Death_counter";
        }
        else
        {
            DeathCounter dcScript = dc.GetComponent <DeathCounter>();
            dcScript.loadDeath();
        }
    }
Пример #18
0
 private void Awake()
 {
     instance = this;
 }
Пример #19
0
 private void Start()
 {
     this.deathCount = 0;
     instance        = this;
 }
Пример #20
0
 // Start is called before the first frame update
 void Start()
 {
     gamePlayer   = FindObjectOfType <PlayerController>();
     deathCounter = FindObjectOfType <DeathCounter>();
 }
Пример #21
0
 private void Awake()
 {
     _playerMovement = FindObjectOfType <PlayerMovement>();
     _deathCounter   = FindObjectOfType <DeathCounter>();
 }
Пример #22
0
 public override void ExecuteAction()
 {
     Camera.main.backgroundColor = deckColor;
     DeathCounter.ResetDeathCount();
 }
Пример #23
0
 void Proceed()
 {
     answeredThePopUp = true;
     DeathCounter.ResetDeathCountAndMakeItMoreTolerant();
     customPopUp.ClosePopUpOnTop();
 }
Пример #24
0
 private void Start()
 {
     bestScoreText.text = "Best Score: " + DeathCounter.GetCounter().ToString();
 }
Пример #25
0
 void Awake()
 {
     instance = this;
 }
Пример #26
0
 // Start is called before the first frame update
 void Start()
 {
     deathCounter = FindObjectOfType <DeathCounter>();
 }