Exemplo n.º 1
0
    void FixedUpdate()
    {
        //put this in an update loop to prevent forver pausing
        for (int i = 0; i < 4; i++)
        {
            state = GamePad.GetState((PlayerIndex)i, GamePadDeadZone.None);
            if (state.Buttons.Start == ButtonState.Pressed && prestate.Buttons.Start == ButtonState.Released && !isPaused)
            {
                prestate = state;
                pauseGame(i);
            }
        }
        if (spawn)
        {
            count++;
            if (count > 200)
            {
                RespawnScript a = GameObject.Find("RespawnObject").GetComponent <RespawnScript> ();

                for (int i = 0; i < 4; i++)
                {
                    if (players [i])
                    {
                        Debug.Log("adding player: " + i);
                        a.InitialSpawn(i);
                    }
                }
                spawn = false;
            }
        }
        prestate = state;
    }
Exemplo n.º 2
0
    //SoundPlayerScript SPS;
    //bool CanStepSound;
    //int StepCounter;

    // Use this for initialization
    void Start()
    {
        //CanStepSound = true;
        //StepCounter = 0;
        //SPS = GameObject.Find ("Main Camera").GetComponent<SoundPlayerScript> ();
        PauseScript = GameObject.Find("PauseMenuComponent").GetComponent <UIPauseMenuScript>();
        ES          = GameObject.Find("EternalHolder").GetComponent <EternalScript> ();
        RB          = GetComponent <Rigidbody2D> ();
        LR          = GetComponent <LineRenderer> ();
        RS          = GameObject.Find("RespawnObject").GetComponent <RespawnScript>();
        PauseScript.SetPlayer(PlayerNumber, this);
        AimingCursor.SetActive(false);
        ReticleRB = AimingCursor.GetComponent <Rigidbody2D> ();
        AimingCursor.GetComponent <SpriteRenderer> ().color = GetComponent <SpriteRenderer> ().color;
        Color C = ES.GetColor(PlayerNumber);

        C.r += .2f;
        C.g += .2f;
        C.b += .2f;
        Color C2 = C;

        C2.a = .2f;
        LR.SetColors(C, C2);
        currentRot = Quaternion.identity;
        if (BounceReticle)
        {
            LR.SetVertexCount(4);
        }
    }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        RS       = GameObject.Find("RespawnObject").GetComponent <RespawnScript>();
        Stats    = GameObject.Find("TotalStatsHolder").GetComponent <EndGameStatsScript>();
        ES       = GameObject.Find("EternalHolder").GetComponent <EternalScript> ();
        WinText  = GameObject.Find("WinTextObj").GetComponent <Text>();
        WarBarP1 = GameObject.Find("KillBarP1").GetComponent <Image> ();
        WarBarP2 = GameObject.Find("KillBarP2").GetComponent <Image> ();
        WarBarP3 = GameObject.Find("KillBarP3").GetComponent <Image> ();
        WarBarP4 = GameObject.Find("KillBarP4").GetComponent <Image> ();

        WarBarP1.color = ES.GetColor(0);
        WarBarP2.color = ES.GetColor(1);
        WarBarP3.color = ES.GetColor(2);
        WarBarP4.color = ES.GetColor(3);

        WarBarP1.fillAmount = 0;
        WarBarP2.fillAmount = 0;
        WarBarP3.fillAmount = 0;
        WarBarP4.fillAmount = 0;
        P1Kills             = 0;
        P2Kills             = 0;
        P3Kills             = 0;
        P4Kills             = 0;

        KillsToWin      = ES.GetKillNumber();
        WinText.text    = "";
        WinText.enabled = false;

        // temporary dev tool
        KillsToWin = 10;
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        hrvReceiverScript = GameObject.FindWithTag("MeasureObject").GetComponent <OSCReceiver>();
        respawnLocation   = GameObject.FindWithTag("Player").GetComponent <RespawnScript>();
        pillarRoom        = GameObject.FindWithTag("PillarEvent").GetComponent <PillarRoomEvent>();

        //Torch changing related variables
        torches    = GameObject.FindGameObjectsWithTag("Torch");
        baseTorch  = new Vector4(0.97f, 0.73f, 0.21f, 1);
        dreadTorch = new Vector4(0.49f, 0.02f, 0.11f, 1);
        flameBGM   = GameObject.Find("MazeChanges/FlameChangeBGM").GetComponent <AudioSource>();

        //Wall changing related variables
        crossFadeScript = GetComponent <CrossFade>();

        wallOffset = new Vector2(0f, 0f);
        wallTiling = new Vector2(3f, 1.5f);

        threshWallTiling = new Vector2(-0.19f, 1.5f);          //Brick1
        threshWallOffset = new Vector2(0.6f, 0f);

        smallWallTiling = new Vector2(2f, 1.5f);          //Brick3
        smallWallOffset = new Vector2(0f, 0f);

        tinyWallTiling = new Vector2(1.2f, 1.5f);          //Brick4
        tinyWallOffset = new Vector2(0f, 0f);

        mainWallChange = firstWallChange;
        crossFadeScript.setNewMaterial(secondMaterial, secondSmallWallMaterial, secondTinyWallMaterial, secondThreshMaterial);         //The first set of materials it will change to

        //Enemy range manipulation and such
        //endEnemyRadius = GameObject.Find("End Guardian2/ProximityDetector");
        enemyDetectors = GameObject.FindGameObjectsWithTag("EnemyDetectors");
    }
Exemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetButtonDown("Fire1") && Time.time > nextFire)
        {
            nextFire = Time.time + fireTimer;
            System.Console.Out.WriteLine("hack");


            others = Physics.OverlapBox(Collider.transform.position, new Vector3(3, 3, 3));

            foreach (Collider c in others)
            {
                if (c.gameObject.tag == "Attackable")
                {
                    //c.gameObject.GetComponent<Rigidbody>().AddForce(fpsCam.transform.forward * hitForce);

                    RespawnScript rs = c.gameObject.GetComponent <RespawnScript>();
                    if (rs != null)
                    {
                        col.Collect(rs.type);
                        this.StartCoroutine(rs.RespawnEffect());
                        rs.gameObject.SetActive(false);
                    }
                }
            }
        }
    }
Exemplo n.º 6
0
    IEnumerator WaitAndActivate(GameObject go, RespawnScript script, float waitTime)
    {
        Debug.Log("Start spawn Delay...");
        yield return(new WaitForSeconds(waitTime));

        Debug.Log("Spawn Delay Done, trigger spawning...");
        Activate(go, script);
    }
 void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         RespawnScript spawnScript = other.GetComponent <RespawnScript>();
         spawnScript.killPlayer();
     }
 }
Exemplo n.º 8
0
    // Use this for initialization
    void Awake()
    {
        rb             = GetComponent <Rigidbody> ();
        player         = transform.parent.gameObject.GetComponent <StrikerScript>();
        rb.isKinematic = true;
        respawn        = GameObject.FindGameObjectWithTag("GameManager").GetComponent <RespawnScript> ();

        tr = GetComponent <TrailRenderer> ();
    }
Exemplo n.º 9
0
    void OnTriggerEnter(Collider col)
    {
        RespawnScript rs = col.GetComponent <RespawnScript>();

        if (rs != null)
        {
            rs.Respawn();
        }
    }
Exemplo n.º 10
0
    void OnTriggerExit2D(Collider2D collision)
    {
        RespawnScript respawn = collision.gameObject.GetComponent <RespawnScript>();

        if (respawn != null)
        {
            respawn.Respawn();
        }
    }
Exemplo n.º 11
0
 void Awake()
 {
     // get the car controller
     car = GetComponent<CarController>();
     jumpScript = GetComponent<JumpScript>();
     nitroScript = GetComponent<NitroScript>();
     speedMeterScript = GetComponent<SpeedMeterScript>();
     pathIndicatorScript = GetComponent<PathIndicatorScript>();
     respawnScript = GetComponent<RespawnScript>();
 }
Exemplo n.º 12
0
    void Start()
    {
        // получение объекта аниматор
        animator = GetComponent <Animator>();

        _respawn = GetComponent <RespawnScript>();

        _inputs = GetComponent <PlayerInputs>();

        animator.SetInteger("Health", health);
    }
Exemplo n.º 13
0
    void ReactivateWithDelay(GameObject go, RespawnScript script, float delay)
    {
        if (delay <= 0f)
        {
            Activate(go, script);
        }

        else
        {
            StartCoroutine(WaitAndActivate(go, script, delay));
        }
    }
Exemplo n.º 14
0
    public void die(RespawnScript respawnScript, GameObject tombstonePrefab)
    {
        respawnScript.change(-1);

        GameObject      tombStone = Instantiate(tombstonePrefab, transform.position, transform.rotation) as GameObject;
        TombStoneScript script    = tombStone.GetComponent <TombStoneScript> ();

        script.player        = gameObject;
        script.respawnScript = respawnScript;
        script.work();

        gameObject.SetActive(false);
    }
Exemplo n.º 15
0
    //SoundPlayerScript SPS;
    //bool CanStepSound;
    //int StepCounter;

    // Use this for initialization
    void Start()
    {
        //CanStepSound = true;
        //StepCounter = 0;
        //SPS = GameObject.Find ("Main Camera").GetComponent<SoundPlayerScript> ();
        PauseScript = GameObject.Find("PauseMenuComponent").GetComponent <UIPauseMenuScript>();
        RB          = GetComponent <Rigidbody2D> ();
        LR          = GetComponent <LineRenderer> ();
        RS          = GameObject.Find("RespawnObject").GetComponent <RespawnScript>();
        //PauseScript.SetPlayer (PlayerNumber, this);
        AimingCursor.SetActive(false);
        ReticleRB = AimingCursor.GetComponent <Rigidbody2D> ();
        AimingCursor.GetComponent <SpriteRenderer> ().color = GetComponent <SpriteRenderer> ().color;
    }
Exemplo n.º 16
0
 // Use this for initialization
 void Start()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
     count = -1;
     UpdateHits();
 }
    void Start()
    {
        _positionHandler  = GetComponent <PositionHandlerScript>();
        _controllers      = _positionHandler.Controllers;
        _playerPositions  = _positionHandler.PlayerPositions;
        _defaultPositions = _positionHandler.DefaultPositions;
        _carRigidbody     = GetComponent <Rigidbody>();
        _respawnScript    = GetComponent <RespawnScript>();

        _countDownScript = Countdown.GetComponent <CountDown>();

        _maxSpeed = _maxSpeedDefault;

        _canvas    = GameObject.Find("Canvas").transform;
        _pauseMenu = _canvas.GetComponent <PauseMenuScript>();
    }
Exemplo n.º 18
0
    // Use this for initialization
    void Start()
    {
        LeftTrigger     = "p" + playerNum + "LeftTrigger";
        RightTrigger    = "p" + playerNum + "RightTrigger";
        LeftBumper      = "p" + playerNum + "LeftBumper";
        RightBumper     = "p" + playerNum + "RightBumper";
        LeftX           = "p" + playerNum + "LeftX";
        LeftY           = "p" + playerNum + "LeftY";
        RightX          = "p" + playerNum + "RightX";
        RightY          = "p" + playerNum + "RightY";
        AButton         = "p" + playerNum + "A";
        RightStickClick = "p" + playerNum + "RightStickClick";

        rend      = GetComponent <SpriteRenderer>();
        rb        = GetComponent <Rigidbody2D>();
        playerCol = GetComponent <BoxCollider2D>();
        lastGrave = null;
        inHitstun = false;
        frames    = 0;

        //get enemy player num once lol this took me years
        enemyPlayerNum = (playerNum == 1) ? 2 : 1;

        dashCount = dashMax;

        playerShovel = GetComponentInChildren <ShovelScript>();

        //   acceleration = Vector2.zero;
        force = Vector2.zero;
        speed = Vector2.zero;

        spawnManager = GameObject.Find("RespawnManager").GetComponent <RespawnScript>();
        scoreManager = GameObject.Find("ScoreManager").GetComponent <ScoreScript>();
        collManager  = GameObject.Find("CollisionManager").GetComponent <CollisionScript>();
        cameraShake  = GameObject.Find("Main Camera").GetComponentInChildren <CameraShakeScript>();

        hpVisual = GameObject.Find("P" + playerNum + "HP").GetComponentInChildren <HPScript>();
        //transform.position = spawnManager.getSpawnpoint(playerNum).position;

        health = maxHealth;
        hpVisual.updateVisual(health);
        hitstunTimer = hitstunMaxTimer;

        slayTimer = 0;

        //position = transform.position;
    }
Exemplo n.º 19
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag.Equals("Ball"))
        {
            Ball          ball    = other.gameObject.GetComponent <Ball>();
            RespawnScript respawn = other.gameObject.GetComponent <RespawnScript>();

            Score(ball.GetTeam());
            ball.SetTeam(Team.NONE);
            respawn.Respawn();
        }
        else if (other.gameObject.tag.Equals("Player"))
        {
            RespawnScript respawn = other.gameObject.GetComponent <RespawnScript>();
            respawn.Respawn();
        }
    }
Exemplo n.º 20
0
    // Update is called once per frame
    void Update()
    {
        if (startHangEvent)
        {
            waitTime = waitTime + Time.deltaTime;

            if (waitTime >= 5.0f)
            {
                if (eventStarted == false)
                {
                    nooseChair.GetComponentInChildren <Renderer>().transform.rotation = Quaternion.Euler(0, 0, 90f);
                    player.GetComponent <ExampleMovement>().enabled = false;
                    eventStarted = true;
                }
            }

            if (waitTime >= 10f && eventStarted)
            {
                if (soundPlaying == false)
                {
                    womanWhisper.GetComponent <AudioSource>().Play();
                    this.GetComponent <AudioSource>().PlayOneShot(chokeSound);
                    soundPlaying = true;
                }
                else
                {
                    player.GetComponent <CameraMovement>().enabled = false;
                    if (this.GetComponent <AudioSource>().isPlaying == false)
                    {
                        playerDead = true;
                    }
                }
            }

            if (playerDead)
            {
                RespawnScript spawnScript = player.GetComponent <RespawnScript>();
                spawnScript.killPlayer();
                startHangEvent = false;
                playerDead     = false;
            }
        }
    }
Exemplo n.º 21
0
        private void Start()
        {
            Cursor.lockState = CursorLockMode.Locked;
            // Инициализация объекта класса перемещения игрока
            moveCharacter = GetComponent <PlayerControl>();
            // Инициализация объекта класса перемещения камеры
            thirdPersonCamera = GetComponent <ThirdPersonCamera>();
            // Получение главной камеры
            mainCamera = Camera.main;
            // Получение высоты положения камеры для "приседания"
            tempCameraYPosition = moveCharacter.cameraYPosition;
            // Получене дистации от камеры до объекта слежения для камеры "от первого лица" в "присяде".
            tempDistanceFromTarget = thirdPersonCamera.distanceFromTarget;

            rb = GetComponent <Rigidbody>();

            startPosition = rb.transform.position;

            room = GetComponent <RespawnScript>();
        }
Exemplo n.º 22
0
    // Update is called once per frame
    void Update()
    {
        ammunitionText.text = "Ammunition: " + ammunition.ToString();


        if (Input.GetButtonDown("Fire1") && Time.time > nextFire && ammunition > 0)
        {
            ammunition--;
            nextFire = Time.time + fireTimer;
            StartCoroutine(ShotEffect());
            System.Console.WriteLine("shoot");

            Vector3 rayOrigin = fpsCam.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0));
            laserLine.SetPosition(0, gunEnd.position);
            RaycastHit hit;
            if (Physics.Raycast(rayOrigin, fpsCam.transform.forward, out hit, weaponRange))
            {
                laserLine.SetPosition(1, hit.point);
                if (hit.rigidbody != null)
                {
                    hit.rigidbody.AddForce(-hit.normal * hitForce);
                    RespawnScript rs = hit.transform.gameObject.GetComponent <RespawnScript>();
                    if (rs != null)
                    {
                        col.Collect(rs.type);
                        this.StartCoroutine(rs.RespawnEffect());
                        rs.gameObject.SetActive(false);
                    }
                }
            }
            else
            {
                laserLine.SetPosition(1, rayOrigin + (fpsCam.transform.forward * weaponRange));
            }
            laserLine.SetPosition(1, hit.point);
        }
    }
Exemplo n.º 23
0
 // Use this for initialization
 void Start()
 {
     spawnScript = GameObject.FindWithTag("Player").GetComponent <RespawnScript>();
 }
Exemplo n.º 24
0
	// Use this for initialization
	void Start () {
		RS = GameObject.Find ("RespawnObject").GetComponent<RespawnScript>();
		PCS = GetComponent<PlayerControlScript> ();
	}
Exemplo n.º 25
0
 private void Awake()
 {
     Instance = this;
 }
Exemplo n.º 26
0
 public void Start()
 {
     _transform     = GetComponent <Transform>();
     _respawnScript = GetComponent <RespawnScript>();
 }
Exemplo n.º 27
0
 void Awake()
 {
     Instance = this;
 }
Exemplo n.º 28
0
 // Use this for initialization
 void Awake()
 {
     RS  = GameObject.Find("RespawnObject").GetComponent <RespawnScript>();
     PCS = GetComponent <PlayerControlScript> ();
     SS  = GameObject.Find("ScoreObject").GetComponent <ScoreScript>();
 }
Exemplo n.º 29
0
 void Activate(GameObject go, RespawnScript activateionEventScript)
 {
     activateionEventScript.Activate();
 }
 // Use this for initialization
 void Start()
 {
     spawnScript = GameObject.FindWithTag("Player").GetComponent<RespawnScript>();
 }
    // Use this for initialization
    void Start()
    {
        hrvReceiverScript = GameObject.FindWithTag("MeasureObject").GetComponent<OSCReceiver>();
        respawnLocation = GameObject.FindWithTag("Player").GetComponent<RespawnScript>();
        pillarRoom = GameObject.FindWithTag("PillarEvent").GetComponent<PillarRoomEvent>();

        //Torch changing related variables
        torches = GameObject.FindGameObjectsWithTag("Torch");
        baseTorch = new Vector4(0.97f, 0.73f, 0.21f, 1);
        dreadTorch = new Vector4(0.49f, 0.02f, 0.11f, 1);
        flameBGM = GameObject.Find("MazeChanges/FlameChangeBGM").GetComponent<AudioSource>();

        //Wall changing related variables
        crossFadeScript = GetComponent<CrossFade>();

        wallOffset = new Vector2 (0f,0f);
        wallTiling = new Vector2 (3f,1.5f);

        threshWallTiling = new Vector2 (-0.19f, 1.5f); //Brick1
        threshWallOffset = new Vector2 (0.6f,0f);

        smallWallTiling = new Vector2 (2f, 1.5f); //Brick3
        smallWallOffset = new Vector2 (0f,0f);

        tinyWallTiling = new Vector2 (1.2f, 1.5f); //Brick4
        tinyWallOffset = new Vector2 (0f,0f);

        mainWallChange = firstWallChange;
        crossFadeScript.setNewMaterial(secondMaterial, secondSmallWallMaterial, secondTinyWallMaterial, secondThreshMaterial); //The first set of materials it will change to

        //Enemy range manipulation and such
        //endEnemyRadius = GameObject.Find("End Guardian2/ProximityDetector");
        enemyDetectors = GameObject.FindGameObjectsWithTag("EnemyDetectors");
    }
Exemplo n.º 32
0
 void Start()
 {
     stats   = GetComponent <PlayerStats> ();
     health  = GetComponent <PlayerStats> ().maxHealth;
     respawn = GameObject.FindGameObjectWithTag("GameManager").GetComponent <RespawnScript> ();
 }