Inheritance: MonoBehaviour
Example #1
0
 // Use this for initialization
 void Start()
 {
     collisionTracker = GetComponentInChildren <PlayerCollision>();
     rb             = GetComponentInChildren <Rigidbody>();
     boostTimeStamp = Time.time;
     circleDiameter = 25f;
 }
Example #2
0
 /// <summary>
 /// Start.
 /// </summary>
 void Start()
 {
     _isRunning      = false;
     _velocity       = 0.0f;
     _playerCollison = GetComponent <PlayerCollision>();
     _playerCollison.eventObstacleCollision += OnCollision;
 }
Example #3
0
 private void Awake()
 {
     rb        = GetComponent <Rigidbody2D>();
     stats     = GetComponent <PlayerStats>();
     collision = GetComponent <PlayerCollision>();
     t         = transform;
 }
Example #4
0
 void Start()
 {
     if (collidePrevention == null)
     {
         collidePrevention = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerCollision>();
     }
 }
Example #5
0
    // Start is called before the first frame update
    private void Start()
    {
        highscore = Highscore.Get();

        trapDoorRenderer = trapDoorModel.GetComponent <MeshRenderer>();
        trapDoorCollider = trapDoorModel.GetComponentInParent <BoxCollider>();

        playerStatus    = player.GetComponent <PlayerStatus>();
        playerCollision = player.GetComponent <PlayerCollision>();
        playerMovement  = player.GetComponent <PlayerMovement>();

        lastPlayerLives     = playerStatus.getLives();
        playerSpawnLocation = player.transform.position;

        randomWallLocation = wallGenerator.GetComponent <RandomWallLocation>();
        wallsLeft          = randomWallLocation.getWallsAmount();

        playerCollision.onPlayerExit = switchToWin;

        finishPanel = UIFinishPanel.GetComponent <UIFinishPanel>();

        foreach (GameObject enemy in enemies)
        {
            enemiesStatus.Add(enemy.GetComponent <EnemyStatus>());
        }

        foreach (EnemyStatus enemyStatus in enemiesStatus)
        {
            enemyStatus.onEnemyKilled = addPointsEnemyKilled;
        }
    }
Example #6
0
    void Start()
    {
        gameController = GameObject.Find("GameController")
                         .GetComponent <GameController>();
        gameController.OnDeath += OnDeath;

        playerCollision = gameObject.GetComponent <PlayerCollision>();

        checkpointManager = GameObject.Find("CheckpointManager").GetComponent <CheckpointManager>();

        currentRotation = slopRotations[speedIndex];

        speedIndex   = 0;
        forwardSpeed = speeds[speedIndex];

        isCrouched = false;

        pbCol = transform.Find("BodyDeathCollider").GetComponent <CapsuleCollider>();

        Application.targetFrameRate = 60;

        animModel = transform.Find("SkiPerson_Anim");
        animModel.transform.localEulerAngles = Vector3.zero;
        animModel.transform.localPosition    = Vector3.zero;
        transform.rotation = currentRotation;
    }
Example #7
0
    protected virtual void Awake()
    {
        rigbod              = GetComponent <Rigidbody>();
        playerAudio         = GetComponent <PlayerAudio>();
        is_secondary_moving = false;

        stunned                = false;
        death_status           = false;
        attacking              = false;
        current_jump_cool_down = jump_cool_down;

        last_keypress = InputType.No_Press;

        stunned_counter = stunned_wait_timer;

        animator                 = GetComponentInChildren <Animator>();
        animator_2d              = transform.GetChild(1).GetComponent <Animator>();
        child                    = this.transform.GetChild(0).gameObject;
        player_camera            = Camera.main;
        retical                  = new GameObject("Reticle_" + this.gameObject.name);
        retical.transform.parent = transform;
        canvas                   = GameObject.Find("/SceneManagement/Canvas").GetComponent <Canvas>();
        ui_retical               = Instantiate(ui_retical_prefab);
        ui_retical.name          = "UI_Reticle_" + this.gameObject.name;
        ui_retical.transform.SetParent(canvas.transform, false);
        ui_retical.SetActive(true);
        player_collision = GetComponent <PlayerCollision>();

        animator.SetBool("landed", true);


        FindAnimationTimes();
        ResetAnimationState();
    }
 void FixedUpdate()
 {
     if (collision == null)
     {
         collision = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerCollision>();
     }
 }
Example #9
0
        /// <summary>
        /// Makes the player invincible for a set amount of time, and shows the shield.
        /// </summary>
        private IEnumerator ActivateGodMode()
        {
            PlayerCollision playerCollision = FindObjectOfType <PlayerCollision>();

            playerCollision.SetInvincible(true);

            GameObject shield = playerCollision.GetShield();

            shield.SetActive(true);
            shield.GetComponent <Animator>().Play("On");

            yield return(new WaitForSeconds(invincibilityTime));

            // Now flicker
            for (int i = 0; i < FLICKER_COUNT; i++)
            {
                shield.SetActive(false);
                yield return(new WaitForSeconds(FLICKER_DURATION));

                shield.SetActive(true);
                yield return(new WaitForSeconds(FLICKER_DURATION));
            }

            shield.SetActive(false);
            playerCollision.SetInvincible(false);
        }
Example #10
0
    // Update is called once per frame
    void Update()
    {
        Vector2 pos           = transform.position;
        Vector2 cameraLeftPos = Camera.main.ScreenToWorldPoint(new Vector2(0, 0));

        if (pos.x < cameraLeftPos.x)
        {
            PlayerMovement pm = gameObject.GetComponent <PlayerMovement>();

            GameObject    winnerChecker = GameObject.Find("WinnerChecker");
            WinnerChecker script        = winnerChecker.GetComponent <WinnerChecker>();
            script.removePlayer(gameObject.name, pm);

            GameObject    itemGenerator = GameObject.Find("ItemGenerator");
            GenerateItems igScript      = itemGenerator.GetComponent <GenerateItems>();

            PlayerCollision pc = gameObject.GetComponent <PlayerCollision>();

            GameObject    playerSpawner = GameObject.Find("PlayerSpawner");
            PlayerSpawner psScript      = playerSpawner.GetComponent <PlayerSpawner>();

            psScript.registerInactivePlayer(gameObject, pm.playerKey);

            igScript.playerDied(pm.playerKey, gameObject.GetComponent <PlayerMovement>().playerColour, pc.getLastCollidedObstacle());

            gameObject.SetActive(false);
            Instantiate(bloodEffect,
                        new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, bloodEffect.transform.position.z),
                        bloodEffect.transform.rotation);
            RandomShake.randomShake.PlayShakeX();

            //Instantiate(deathSoundObject,transform.position,transform.rotation);
            LevelSounds.inst.playDeath(gameObject.transform.position);
        }
    }
Example #11
0
 // Start is called before the first frame update
 void Start()
 {
     //anim = FindObjectOfType<PlayerUpperAnim>().gameObject.GetComponent<Animator>();
     //shake = FindObjectOfType<CamShake>();
     player_collision = GetComponent <PlayerCollision>();
     anim             = GetComponent <Animator>();
 }
Example #12
0
    void Update()
    {
        GameObject      player          = GameObject.FindWithTag("Player");
        PlayerCollision playerCollision = player.GetComponent <PlayerCollision>();

        if (!playerCollision.gameOver)
        {
            gameObject.transform.position = new Vector3(-5.9f, gameObject.transform.position.y, 0);
            Vector3 rot = new Vector3(0, 0, 0);
            gameObject.transform.rotation = Quaternion.Euler(rot);
        }
        float newY = player.transform.position.y + 1.55f;

        jumpBox.transform.position = new Vector3(-6.0f, newY, 0.0f);

        //PlayerCollision playerCollision = player.GetComponent<PlayerCollision>();

        if (playerCollision.grounded == true)
        {
            animator.SetInteger("Grounded", 0);

            jumpBoxCollider.enabled = false;
        }
        else
        {
            animator.SetInteger("Grounded", 1);


            jumpBoxCollider.enabled = true;
        }
    }
Example #13
0
 private void Start()
 {
     pc     = GetComponent <PlayerCollision>();
     rb     = GetComponent <Rigidbody>();
     _speed = 40f;
     isDead = false;
 }
Example #14
0
 // Update is called once per frame
 void Update()
 {
     playerCollision = GameObject.Find("player").GetComponent <PlayerCollision>();
     boxTeleport     = GameObject.Find("box").GetComponent <BoxTeleport>();
     if (playerCollision.getBool())
     {
         Vector3 position = transform.position;
         if (position.y >= 5.6)
         {
             position.y        -= 0.1f;
             transform.position = position;
         }
     }
     if (boxTeleport.getBool())
     {
         Vector3 position = transform.position;
         if (position.y >= 25.7f)
         {
             position.y        -= 0.1f;
             transform.position = position;
         }
     }
     if (playerCollision.getBool2())
     {
         Vector3 position = transform.position;
         if (position.x >= -46)
         {
             position.x        -= 0.5f;
             transform.position = position;
         }
     }
 }
Example #15
0
 private void Awake()
 {
     renderAnimator  = playerRenderer.GetComponent <Animator>();
     rb              = GetComponent <Rigidbody2D>();
     playerCollision = GetComponent <PlayerCollision>();
     hud             = GetComponent <PlayerHUD>();
 }
Example #16
0
 // Use this for initialization
 void Awake()
 {
     anim            = GetComponent <Animator>();
     enemyMovement   = GetComponent <Enemy2Movement>();
     player          = GameObject.FindGameObjectWithTag("Player");
     playerCollision = player.GetComponent <PlayerCollision>();
 }
Example #17
0
 private void OnCollisionStay(Collision other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         PlayerCollision.SafeInvoke();
     }
     ;
 }
Example #18
0
 void Start()
 {
     refAnimator       = GetComponent <Animator>();
     refPlayerMovement = GetComponent <PlayerMovement>();
     refPlayerShoot    = GetComponent <PlayerShoot>();
     rb = GetComponent <Rigidbody2D>();
     refPlayerCollision = GetComponent <PlayerCollision>();
 }
Example #19
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        // Get parent script
        PlayerCollision parentScript = transform.parent.GetComponent <PlayerCollision>();

        // Let it know a collision happened
        parentScript.CollisionFromChild(collision);
    }
Example #20
0
 // Start is called before the first frame update
 private void Awake()
 {
     rb          = GetComponent <Rigidbody2D>();
     coll        = GetComponent <PlayerCollision>();
     anim        = GetComponentInChildren <PlayerAnimation>();
     shot        = GetComponent <Shot>();
     rb.velocity = Vector2.zero;
 }
    /// <summary>
    /// PRIVATE
    /// </summary>
    private void Start()
    {
        startPosition = transform.localPosition;

        joystick        = FindObjectOfType <Joystick>();
        playerCollision = GetComponent <PlayerCollision>();
        rigidBody       = GetComponent <Rigidbody>();
    }
Example #22
0
    void Start()
    {
        candidates         = new List <int>();
        refPlayer          = GameObject.FindGameObjectWithTag("Player").transform;
        refPlayerCollision = GameObject.FindObjectOfType <PlayerCollision>();

        treasureSpawnCounter = Random.Range(spawnTreasureEveryMin, spawnTreasureEveryMax);
    }
Example #23
0
 private void Start()
 {
     refPlayerMovement  = GameObject.FindObjectOfType <PlayerMovement>();
     refPlayerShoot     = GameObject.FindObjectOfType <PlayerShoot>();
     refOrne            = GameObject.FindObjectOfType <EnemyOrne>();
     refPlayerCollision = GameObject.FindObjectOfType <PlayerCollision>();
     refPlayerUI        = GameObject.FindObjectOfType <PlayerUI>();
 }
Example #24
0
 // Use this for initialization
 void Start()
 {
     GameObject player = GameObject.FindGameObjectWithTag ("Player");
     if (player)
     {
         playerCollision = player.GetComponent<PlayerCollision> ();
     }
 }
Example #25
0
    // Start is called before the first frame update
    void Start()
    {
        rb   = GetComponent <Rigidbody2D>();
        anim = GetComponent <Animator>();
        coll = GetComponent <PlayerCollision>();

        amountOfJumpsLeft = amountOfJumps;
        wallJumpDirection.Normalize();
    }
 public MovementTutorialObjective(ObjectiveSystem objSys) : base(objSys)
 {
     tutorialTextComponent        = objSys.tutorialText.GetComponent <TextMeshProUGUI>();
     tutorialEnemyWeaponCollision = objSys.tutorialEnemyWeapon.GetComponent <EnemyWeaponCollision>();
     playerCollision     = objSys.playerObject.GetComponent <PlayerCollision>();
     playerMovement      = objSys.playerObject.GetComponent <PlayerMovementV2>();
     tutorialEnemyFOV    = objSys.tutorialEnemy.GetComponent <FieldOfView>();
     playerControlScript = objSys.playerObject.GetComponent <PlayerControl>();
 }
Example #27
0
 public void Init(PlayerInput playerInput, PlayerCollision playerCollision, CheckNextLevel checkNextLevel)
 {
     _playerInput     = playerInput;
     _playerCollision = playerCollision;
     _nextLevel       = checkNextLevel;
     _playerCollision.EnterInZoneEvent += OnEnterInZone;
     _playerCollision.DeathEvent       += OnDeath;
     _nextLevel.NextLevelEvent         += OnNextLevel;
 }
Example #28
0
    void Start()
    {
        refPlayerCollision = transform.parent.GetComponent <PlayerCollision>();
        refAudioManager    = GameObject.FindObjectOfType <UtilityAudioManager>();
        startingM          = refPlayerCollision.getCurrentMeters();
        targetM            = startingM + increaseMBy;

        goddessText = GameObject.Find("textGoddess").GetComponent <Text>();;
    }
Example #29
0
    private void Start()
    {
        _gameIsPaused = false;
        var player = GameObject.FindGameObjectWithTag("Player");

        _playerCollision = player.GetComponent <PlayerCollision>();

        _android = gameManager.GetComponent <GameManager>().android;
    }
Example #30
0
 // Use this for initialization
 void Awake()
 {
     anim            = GetComponent <Animator>();
     nav             = GetComponent <NavMeshAgent>();
     enemyMovement   = GetComponent <EnemyMovement>();
     player          = GameObject.FindGameObjectWithTag("Player");
     playerCollision = player.GetComponent <PlayerCollision>();
     nav.enabled     = false;
 }
Example #31
0
 void Start()
 {
     player_collision = GameObject.Find("Player").GetComponent <PlayerCollision>();
     player_movement  = GameObject.Find("Player").GetComponent <PlayerMovement>();
     levelcompleteUI  = GameObject.Find("Canvas").transform.Find("LevelCompletePanel").gameObject;
     gameOverUI       = GameObject.Find("Canvas").transform.Find("GameOverPanel").gameObject;
     player_collision.ObstacleHitTrigger += GameOver;
     player_collision.LevelFinishTrigger += LevelPassed; //it is necessary to install LevelEnd prefab in the environment to trigger this Action
 }
Example #32
0
 void Awake()
 {
     playerCollision = this.GetComponentInChildren<PlayerCollision>();
     ground = GameObject.Find("Ground");
     groundMapper = ground.GetComponent<GroundMapping>();
     this.xMin = 0;
     this.xMax = groundMapper.quadXSize;
     this.zMin = 0;
     this.zMax = groundMapper.quadYSize;
 }
Example #33
0
 // Use this for initialization
 protected override void Awake()
 {
     base.Awake ();
     motor = gameObject.GetComponent<PlayerMotor> ();
     input = gameObject.GetComponent<PlayerInput> ();
     collision = gameObject.GetComponent<PlayerCollision> ();
     graphics = gameObject.GetComponent<PlayerGraphics> ();
     orientation.OnNewOrientation = OnNewOrientation;
 }
Example #34
0
 // Use this for initialization
 void Start()
 {
     Imortality = GetComponent<PlayerCollision>();
     Gerenciador = GameObject.Find("GameManager").GetComponent<GameManager>();
     m_PlayerMovement = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerMovement>();
 }
 void Awake()
 {
     instance = this;
 }