Inheritance: MonoBehaviour
Esempio n. 1
0
 // Use this for initialization
 void Start()
 {
     collisionTracker = GetComponentInChildren <PlayerCollision>();
     rb             = GetComponentInChildren <Rigidbody>();
     boostTimeStamp = Time.time;
     circleDiameter = 25f;
 }
Esempio n. 2
0
 /// <summary>
 /// Start.
 /// </summary>
 void Start()
 {
     _isRunning      = false;
     _velocity       = 0.0f;
     _playerCollison = GetComponent <PlayerCollision>();
     _playerCollison.eventObstacleCollision += OnCollision;
 }
Esempio n. 3
0
 private void Awake()
 {
     rb        = GetComponent <Rigidbody2D>();
     stats     = GetComponent <PlayerStats>();
     collision = GetComponent <PlayerCollision>();
     t         = transform;
 }
Esempio n. 4
0
 void Start()
 {
     if (collidePrevention == null)
     {
         collidePrevention = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerCollision>();
     }
 }
Esempio n. 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;
        }
    }
Esempio n. 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;
    }
Esempio n. 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();
    }
Esempio n. 8
0
 void FixedUpdate()
 {
     if (collision == null)
     {
         collision = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerCollision>();
     }
 }
Esempio n. 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);
        }
Esempio n. 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);
        }
    }
Esempio n. 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>();
 }
Esempio n. 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;
        }
    }
Esempio n. 13
0
 private void Start()
 {
     pc     = GetComponent <PlayerCollision>();
     rb     = GetComponent <Rigidbody>();
     _speed = 40f;
     isDead = false;
 }
Esempio n. 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;
         }
     }
 }
Esempio n. 15
0
 private void Awake()
 {
     renderAnimator  = playerRenderer.GetComponent <Animator>();
     rb              = GetComponent <Rigidbody2D>();
     playerCollision = GetComponent <PlayerCollision>();
     hud             = GetComponent <PlayerHUD>();
 }
Esempio n. 16
0
 // Use this for initialization
 void Awake()
 {
     anim            = GetComponent <Animator>();
     enemyMovement   = GetComponent <Enemy2Movement>();
     player          = GameObject.FindGameObjectWithTag("Player");
     playerCollision = player.GetComponent <PlayerCollision>();
 }
Esempio n. 17
0
 private void OnCollisionStay(Collision other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         PlayerCollision.SafeInvoke();
     }
     ;
 }
Esempio n. 18
0
 void Start()
 {
     refAnimator       = GetComponent <Animator>();
     refPlayerMovement = GetComponent <PlayerMovement>();
     refPlayerShoot    = GetComponent <PlayerShoot>();
     rb = GetComponent <Rigidbody2D>();
     refPlayerCollision = GetComponent <PlayerCollision>();
 }
Esempio n. 19
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        // Get parent script
        PlayerCollision parentScript = transform.parent.GetComponent <PlayerCollision>();

        // Let it know a collision happened
        parentScript.CollisionFromChild(collision);
    }
Esempio n. 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;
 }
Esempio n. 21
0
    /// <summary>
    /// PRIVATE
    /// </summary>
    private void Start()
    {
        startPosition = transform.localPosition;

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

        treasureSpawnCounter = Random.Range(spawnTreasureEveryMin, spawnTreasureEveryMax);
    }
Esempio n. 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>();
 }
Esempio n. 24
0
 // Use this for initialization
 void Start()
 {
     GameObject player = GameObject.FindGameObjectWithTag ("Player");
     if (player)
     {
         playerCollision = player.GetComponent<PlayerCollision> ();
     }
 }
Esempio n. 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>();
 }
Esempio n. 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;
 }
Esempio n. 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>();;
    }
Esempio n. 29
0
    private void Start()
    {
        _gameIsPaused = false;
        var player = GameObject.FindGameObjectWithTag("Player");

        _playerCollision = player.GetComponent <PlayerCollision>();

        _android = gameManager.GetComponent <GameManager>().android;
    }
Esempio n. 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;
 }
Esempio n. 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
 }
Esempio n. 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;
 }
Esempio n. 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;
 }
Esempio n. 34
0
 // Use this for initialization
 void Start()
 {
     Imortality = GetComponent<PlayerCollision>();
     Gerenciador = GameObject.Find("GameManager").GetComponent<GameManager>();
     m_PlayerMovement = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerMovement>();
 }
Esempio n. 35
0
 void Awake()
 {
     instance = this;
 }