Example #1
0
 private void Start()
 {
     m_playerSounds = GetComponent <PlayerSounds>();
     m_RigidBody    = GetComponent <Rigidbody>();
     m_Capsule      = GetComponent <CapsuleCollider>();
     mouseLook.Init(transform, cam.transform);
 }
Example #2
0
 void Start()
 {
     playerHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <HealthTracker>();
     cameraShake  = Camera.main.GetComponent <ScreenEffects>();
     playerSounds = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <PlayerSounds>();
     _anim        = GetComponentInChildren <Animator>();
 }
    // Use this for initialization
    void Start()
    {
        m_playerSounds = GetComponent <PlayerSounds> ();

        m_playerController = GetComponent <PlayerController> ();
        m_player           = GetComponent <Player> ();
    }
Example #4
0
 // Start is called before the first frame update
 void Start()
 {
     animator     = GetComponentInParent <Animator>();
     gunSprite    = GetComponentInChildren <SpriteRenderer>();
     playerInput  = GetComponentInParent <PlayerInput>();
     playerSounds = GetComponentInParent <PlayerSounds>();
 }
Example #5
0
    //Used for the initialization of internal, non-object variables
    void Awake()
    {
        maxHealth     = DEFAULT_MAX_HEALTH;
        maxStamina    = DEFAULT_MAX_STAMINA;
        movementSpeed = STARTING_SPEED;

        health  = maxHealth;
        isAlive = true;
        stamina = maxStamina;
        this.SetStaminaRecovery(true);
        status = Parameters.PlayerStatus.Default;

        canInteract         = true;
        CurrentInteractable = null;

        ActionFsm = new StateMachine <Player>(this);
        State <Player> startState = new IdleState(this, this.ActionFsm);

        ActionFsm.InitialState(startState);

        anim                  = this.GetComponent <Animator>();
        selfCollider          = this.GetComponentInChildren <Collider>();
        bodyVisual            = this.transform.FindChild("Billboard").gameObject;
        electricCurrentVisual = this.transform.FindChild("Electric Current Visual").gameObject;
        deathVisual           = this.transform.FindChild("Death Animation").gameObject;

        Sounds = GetComponent <PlayerSounds>();
    }
Example #6
0
 public AbilityManager(PlayerController _pc)
 {
     pc           = _pc;
     playerSounds = pc.gameObject.GetComponent <PlayerSounds>();
     playerSounds.Initialize();
     abilities = new Ability[2];  //atm two hardcoded abilities, will refactor to make it scalable  (do as i say, not as i do)
 }
Example #7
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.LeftShift))
     {
         speed = (UserInfo.speed + 2f);
         Debug.Log("shift" + (UserInfo.speed + 2f));
     }
     if (Input.GetKeyUp(KeyCode.LeftShift))
     {
         speed = UserInfo.speed;
     }
     if (Input.GetKeyDown(KeyCode.Space))
     {
         PlayerSounds.PlaySounds("jump");
     }
     if (Input.GetKeyDown(KeyCode.E))
     {
         if (isShop == true)
         {
             if (Shop.activeSelf == false)
             {
                 Shop.SetActive(true);
             }
             else
             {
                 Shop.SetActive(false);
             }
         }
     }
     if (currentScreen == "Screen1" || currentScreen == "Screen2")
     {
         txtScores.text = Enemy.enemyRemains.ToString();
     }
 }
Example #8
0
 private void Start()
 {
     m_PlayerSounds = GetComponentInParent <PlayerSounds>();
     motionBob.Setup(Camera, StrideInterval);
     m_OriginalCameraPosition = Camera.transform.localPosition;
     //     m_CameraRefocus = new CameraRefocus(Camera, transform.root.transform, Camera.transform.localPosition);
 }
Example #9
0
 public PlayerData(PlayerInputConfiguration input, int characterIndex, int playerIndex, PlayerSounds sounds)
 {
     this.input          = input;
     this.characterIndex = characterIndex;
     this.playerIndex    = playerIndex;
     this.sounds         = sounds;
 }
Example #10
0
    void Start()
    {
        DontDestroyOnLoad(gameObject);

        NW_GameLogic.ChangeDimensionEvent += OnChangeDimension;
        //NW_GameLogic.GameStartedEvent += OnGameStarted;

        gun          = GetComponentInChildren <Gun>();
        audioSource  = GetComponent <AudioSource>();
        playerSounds = GetComponent <PlayerSounds>();

        if (isLocalPlayer)
        {
            Input.gyro.enabled = true;
            cameraMounting     = Camera.main.transform.parent;

            //transform.SetParent(cameraMounting);

            bodyTransform = GetComponentInChildren <PlayerOrbit>().transform;
            CmdCountPlayers();
        }
        CreateUIEntry(isLocalPlayer);

        //gameObject.SetActive(false);
    }
Example #11
0
    public override void ActOnTrigger(Collider hitCollider)
    {
        base.ActOnTrigger(hitCollider);

        if (hitCollider.GetComponent <Triggable>() != null)
        {
            hitCollider.GetComponent <Triggable>().OnPlayerTriggerEnter(hitCollider);
        }

        if (hitCollider.GetComponent <LoadScene>() != null)
        {
            GameManager.instance.LoadScene(hitCollider.GetComponent <LoadScene>().sceneIndex);
        }

        if (hitCollider.tag.Equals("Killzone"))
        {
            GameManager.instance.player.playerValues.Die();
        }

        PlayerSounds playerSounds = player.GetComponent <PlayerSounds>();

        if (playerSounds != null)
        {
            playerSounds.PlayTriggerSound(hitCollider);
        }
    }
Example #12
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        string nameCol = collision.gameObject.tag;

        if (nameCol == "Screen2")
        {
            if (Enemy.enemyRemains == 0)
            {
                StartCoroutine(updateUser(UserInfo.UserID, "2", Enemy.coins.ToString(), "Screen2"));
            }
            else
            {
                txtAlert.gameObject.SetActive(true);
            }
        }
        if (nameCol == "Enemy")
        {
            maxHealth -= 1;
            healthBar.SetHealth(maxHealth);
            PlayerSounds.PlaySounds("hurt");
            if (maxHealth <= 0)
            {
                PlayerSounds.PlaySounds("die");
                GetComponent <Rigidbody2D>().bodyType  = RigidbodyType2D.Kinematic;
                GetComponent <BoxCollider2D>().enabled = false;
                GetComponent <Attack>().enabled        = false;
                this.enabled = false;

                anim.SetBool("Die", true);
            }
        }
        if (nameCol == "Heart")
        {
            PlayerSounds.PlaySounds("health");
            maxHealth += 1;
            healthBar.SetHealth(maxHealth);
            if (maxHealth == 8)
            {
                maxHealth = 8;
            }
            Destroy(collision.gameObject);
        }
        if (nameCol == "BossKey")
        {
            if (Enemy.enemyRemains == 0)
            {
                Destroy(collision.gameObject);
                StartCoroutine(updateUser(UserInfo.UserID, "3", Enemy.coins.ToString(), "Screen3"));
            }
            else
            {
                txtAlert.gameObject.SetActive(true);
            }
        }
        if (nameCol == "FireBall")
        {
            Destroy(collision.gameObject);
        }
    }
 void Start()
 {
     _block          = GetComponent<PlayerBlock>();
     _inputToggle    = GetComponent<ToggleEnableInput>();
     _playersounds   = GetComponent<PlayerSounds>();
     _movement       = GetComponent<PlayerMovement>();
     _rigidBody      = GetComponent<Rigidbody>();
 }
Example #14
0
 void Die()
 {
     _playerSounds = FindObjectOfType <PlayerSounds>();
     _playerSounds.Death();
     animator.SetBool("isDead", true);
     isDead = true;
     Respawn();
 }
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         PlayerSounds playerSounds = other.GetComponentInChildren <PlayerSounds>();
         playerSounds.PlaySplash();
     }
 }
Example #16
0
//-----Unity Functions--------------------------------------------------------------------------------------------------------

    void Awake()
    {
        playerData   = GetComponent <PlayerData>();
        keyBind      = GetComponent <KeyBindings>();
        playerSounds = GetComponent <PlayerSounds>();
        rightMelee   = transform.Find("RightSwordBox");
        leftMelee    = transform.Find("LeftSwordBox");
    }
Example #17
0
 private void Awake()
 {
     _movementController              = GetComponent <PlayerMovementController>();
     _combatController                = GetComponent <PlayerCombatController>();
     _playerSounds                    = GetComponent <PlayerSounds>();
     UIManager.OnHeal                += Heal;
     SceneManager.activeSceneChanged += EnablePlayer;
 }
Example #18
0
    private void Start()
    {
        lastPos = transform.position;

        anim         = GetComponent <Animator>();
        rb           = GetComponent <Rigidbody>();
        cc           = GetComponent <CharacterController>();
        playerSounds = transform.Find("Sounds").GetComponent <PlayerSounds>();
    }
Example #19
0
 void Start()
 {
     healthBar    = GetComponentInChildren <HealthBar>();
     tintControl  = GetComponentInChildren <TintControl>();
     sR           = GetComponentInChildren <SpriteRenderer>();
     playerSounds = GetComponent <PlayerSounds>();
     alpha        = Color.white;
     //enabledPowerUps.Add(dash);
 }
Example #20
0
    // Start is called before the first frame update
    void Start()
    {
        body    = this.GetComponent <Rigidbody2D>();
        colider = this.GetComponent <CircleCollider2D>();

        //Sunet
        playerSoundManager = this.gameObject.GetComponent <PlayerSounds>();
        //END Sunet
    }
Example #21
0
    private void Awake()
    {
        bluePressed       = yellowPressed = redPressed = false;
        timeSinceLastShot = Time.time;

        playerMovement = GetComponent <PlayerMovement> ();
        playerSounds   = GetComponent <PlayerSounds> ();
        playerHealth   = GetComponent <PlayerHealth> ();
    }
Example #22
0
    private void Awake()
    {
        _rigidBody = GetComponent <Rigidbody>();
        _transform = transform;

        items          = new List <Item>();
        IsActive       = false;
        m_PlayerSounds = gameObject.GetComponent <PlayerSounds>();
    }
Example #23
0
    void Start()
    {
        target = FindObjectOfType <Base>().transform;
        player = FindObjectOfType <Player>();

        audioSource     = player.GetComponent <AudioSource>();
        playerSounds    = player.GetComponent <PlayerSounds>();
        healthComponent = GetComponent <HealthComponent>();
    }
Example #24
0
    // Start is called before the first frame update
    void Start()
    {
        _controls = ReInput.players.GetPlayer(0);
        _rb       = GetComponent <Rigidbody2D>();
        _animator = GetComponentInChildren <Animator>();

        _horizontalMovementForce = new Vector2(0, 0);

        SoundPlayer = GetComponent <PlayerSounds>();
    }
Example #25
0
    void Start()
    {
        topMinIntensity       = topSpotlight.intensity;
        sceneMaxIntensity     = sceneLights[0].intensity;
        fireplaceMaxIntensity = fireplace.intensity;
        crowdMinHeight        = crowd.localPosition.y;
        crowd.gameObject.SetActive(false);

        sounds = FindObjectOfType <PlayerSounds>();
    }
Example #26
0
    // Use this for initialization
    void Start()
    {
        initialPosition = tongue.position;

        GameObject p = GameObject.FindGameObjectWithTag("Player");
        player = p.GetComponent<Player>();
        playerSounds = p.GetComponent<PlayerSounds>();

        tongueSpeed = tongueNormalSpeed;
    }
 void Start()
 {
     _playersounds = GetComponent<PlayerSounds>();
     _rigidbody          = GetComponent<Rigidbody>();
     _bullsound = GetComponent<BullSound>();
     if (this.tag == Tags.PLAYER)
     {
         _inputToggle    = GetComponent<ToggleEnableInput>();
     }
 }
Example #28
0
 // Use this for initialization
 void Start()
 {
     GameObject p = GameObject.FindGameObjectWithTag("Player");
     toad = p.transform;
     player = p.GetComponent<Player>();
     playerSounds = p.GetComponent<PlayerSounds>();
     tongue = animation["Tongue"];
     tongue.speed = tongueSpeed;
     tongue.wrapMode = WrapMode.Once;
 }
Example #29
0
    void Start()
    {
        shotsPerSecond = settings.shotsPerSecond;
        shotForce      = settings.shotsForce;
        ObjectTilingCtrl tilingCtrl = GetComponent <ObjectTilingCtrl> ();

        if (tilingCtrl && tilingCtrl.isOriginal)
        {
            pSounds = GetComponent <PlayerSounds> ();
        }
    }
Example #30
0
 void Start()
 {
     capsule        = GetComponent <CapsuleCollider>();
     rb             = GetComponent <Rigidbody>();
     interactScript = GetComponent <Interactable>();
     anim           = GetComponent <Animator>();
     playerSounds   = GetComponent <PlayerSounds>();
     respawnPoint   = transform.position;
     playerInput    = GetComponent <PlayerInput>();
     //menuInputs = GetComponent<MenuInputs>();
 }
Example #31
0
    void Start()
    {
        meshRenderer = GetComponent <MeshRenderer>();
        cameraShake  = FindObjectOfType <CameraShake>();
        if (isKingOfDissolve)
        {
            meshRenderer.sharedMaterial.SetFloat("dissolveAmount", 0);
        }

        sounds = FindObjectOfType <PlayerSounds>();
    }
Example #32
0
    // Use this for initialization
    void Start()
    {
        controller = GetComponent<CharacterController>();

        moveDirection = new Vector3(0, 0, 0);

        Physics.IgnoreLayerCollision(8, gameObject.layer);

		playerSounds = GetComponent<PlayerSounds>();
		playerPublicMethods = GetComponent<PlayerPubMethods>();

    }
Example #33
0
        // Gets the approrpiate components for master.
        public override void SetUpReferences()
        {
            base.SetUpReferences();

            particles = GetComponent <ParticleController>();

            movementController = GetComponent <MovementController>();

            playerProperties = GetComponent <PlayerProperties>();

            sounds = GetComponentInChildren <PlayerSounds>();
        }
Example #34
0
    void Start()
    {
        ch    = GetComponent <CharacterController>();
        sound = GetComponent <PlayerSounds>();
        if (!anim)
        {
            anim = GetComponentInChildren <Animator>();
        }

        DamageSystem.instance.OnDealDamage  += Instance_OnDealDamage;
        DamageSystem.instance.OnDeathPlayer += Instance_OnDeathPlayer;
    }
Example #35
0
 void Update()
 {
     if (Time.time >= nextAttakTime)
     {
         if (Input.GetKeyDown(KeyCode.Mouse0))
         {
             attack();
             nextAttakTime = Time.time + 1f / attackRate;
             PlayerSounds.PlaySounds("attack");
         }
     }
 }
Example #36
0
 void Awake()
 {
     sounds = GetComponent<PlayerSounds>();
 }
Example #37
0
 public void Awake()
 {
     PlayerSounds.instance = this;
 }
    void Start()
    {
        _playersounds = GetComponent<PlayerSounds>();
        _bullSound = GetComponent<BullSound>();
        if (this.tag == Tags.PLAYER)
        {
            _movement       = GetComponent<PlayerMovement>();
            _inputToggle    = GetComponent<ToggleEnableInput>();
        }

        if(this.tag == Tags.BULL || this.tag == Tags.PLAYER)
        {
            _adjustHealth   = GetComponent<AdjustHealth>();
        }
        if (this.tag == Tags.PICKUP)
        {
            _pickUp         = GetComponent<HealthPickup>();

        }
    }
 void Start()
 {
     _playersounds = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerSounds>();
     _health         = GameObject.FindGameObjectWithTag("Player").GetComponent<Health>();
     _pickUpCollider = GetComponent<BoxCollider>();
 }
Example #40
0
 void Start()
 {
     playerStance = GetComponent<SpriteRenderer>();
     sounds = GetComponent<PlayerSounds>();
 }
Example #41
0
    private void UpdateFunction()
    {
        if (sounds == null){
            sounds = PlayerSounds.instance;
        }
        if(game.gameState != GameState.RUNNING){
            return;
        }

        if (sprinting){
            CheckSprintDuration();
        }

        Vector3 velocity = movement.velocity;			// We copy the actual velocity into a temporary variable that we can manipulate.
        velocity = ApplyInputVelocityChange(velocity);	// Update velocity based on input
        velocity = ApplyGravityAndJumping (velocity);	// Apply gravity and jumping force

        // Save lastPosition for velocity calculation.
        Vector3 lastPosition = tr.position;

        // We always want the movement to be framerate independent.  Multiplying by Time.deltaTime does this.
        Vector3 currentMovementOffset = velocity * Time.deltaTime;

        // Find out how much we need to push towards the ground to avoid loosing grouning
        // when walking down a step or over a sharp change in slope.
        float pushDownOffset = Mathf.Max(controller.stepOffset, new Vector3(currentMovementOffset.x, 0f, currentMovementOffset.z).magnitude);
        if (grounded){
            Gun currentGun = game.weapons.currentGun;
            if (currentGun.animator != null){
                currentGun.animator.SetBool("hitGround", false);
            }
            currentMovementOffset -= pushDownOffset * Vector3.up;
        }

        // Reset variables that will be set by collision function
        groundNormal = Vector3.zero;

           	// Move our character!
        movement.collisionFlags = controller.Move (currentMovementOffset);

        movement.lastHitPoint = movement.hitPoint;
        lastGroundNormal = groundNormal;

        // Calculate the velocity based on the current and previous position.
        // This means our velocity will only be the amount the character actually moved as a result of collisions.
        Vector3 oldHVelocity = new Vector3(velocity.x, 0, velocity.z);
        movement.velocity = (tr.position - lastPosition) / Time.deltaTime;
        Vector3 newHVelocity = new Vector3(movement.velocity.x, 0, movement.velocity.z);

        // The CharacterController can be moved in unwanted directions when colliding with things.
        // We want to prevent this from influencing the recorded velocity.
        if (oldHVelocity == Vector3.zero) {
            movement.velocity = new Vector3(0f, movement.velocity.y, 0f);
        }
        else {
            float projectedNewVelocity = Vector3.Dot(newHVelocity, oldHVelocity) / oldHVelocity.sqrMagnitude;
            movement.velocity = oldHVelocity * Mathf.Clamp01(projectedNewVelocity) + movement.velocity.y * Vector3.up;
        }

        if (movement.velocity.y < velocity.y - 0.001f) {
            if (movement.velocity.y < 0f) {
                // Something is forcing the CharacterController down faster than it should.
                // Ignore this
                movement.velocity.y = velocity.y;
            }
            else {
                // The upwards movement of the CharacterController has been blocked.
                // This is treated like a ceiling collision - stop further jumping here.
                jumping.holdingJumpButton = false;
            }
        }

        // We were grounded but just loosed grounding
        if (grounded && !IsGroundedTest()) {
            SetOffGround();

            SendMessage("OnFall", SendMessageOptions.DontRequireReceiver);
            // We pushed the character down to ensure it would stay on the ground if there was any.
            // But there wasn't so now we cancel the downwards offset to make the fall smoother.
            tr.position += pushDownOffset * Vector3.up;
        }
        // We were not grounded but just landed on something
        else if (!grounded && IsGroundedTest()) {
            SetOnGround();
            jumping.jumping = false;
            SendMessage("OnLand", SendMessageOptions.DontRequireReceiver);
            if (timeOfAirborne + 0.05f < Time.timeSinceLevelLoad){
                sounds.PlayJumpSound();
            }
            game.weapons.currentGun.animator.SetBool("hitGround", true);
        }
    }
Example #42
0
 // Use this for initialization
 void Start()
 {
     game = GameManager.instance;
     motor = GetComponent<CharacterMotor>();
     sounds = PlayerSounds.instance;
 }
Example #43
0
    // find aggregated objects
    void Awake()
    {
        #region check aggrigated classes/components
        if (input == null)
        {
            input = GetComponent<PlayerInput>();
        }
        if (movement == null || myProperties.myMovement == null)
        {
            movement = GetComponent<PlayerMovement>();
            movement.myOwner = this;
            myProperties.myMovement = movement;
        }
        if (playerAnimation == null)
        {
            playerAnimation = GetComponent<PlayerAnimation>();
        }
        if (playerSounds == null)
        {
            playerSounds = transform.Find("Sounds").GetComponent<PlayerSounds>();
        }
        if (circleGesture == null)
        {
            circleGesture = GetComponent<CircleGestureReader>();
        }
        if (updateControllers == null || updateControllers.Length == 0)
        {
            updateControllers = GetComponentsInChildren<UpdateController>();
        }
        if (punchCircle == null)
        {
            punchCircle = transform.Find("PunchUI").GetComponent<PunchCircle>();
        }
        if (dashCircle == null)
        {
            dashCircle = transform.Find("Geometry/DashUI").GetComponent<CooldownUI>();
        }
        if (stompCircle == null)
        {
            stompCircle = transform.Find("StompUI").GetComponent<CooldownUI>();
        }
        if (col == null)
        {
            col = geometry.GetComponent<Collider>();
        }

        // parent of the actual player model
        if (geometry == null)
        {
            geometry = transform.Find("Geometry");
        }
        // get Animator from player geometry
        if (geometry != null && anim == null)
        {
            anim = geometry.GetComponentInChildren<Animator>();
        }
        // get punch animation event
        if (anim != null && animEvents == null)
        {
            animEvents = anim.GetComponent<LivingAnimationEvents>();
        }

        if (this.myProperties.myPerception == null)
        {
            this.myProperties.myPerception = this.GetComponent<Perception>();
            this.myProperties.myPerception.myOwner = this;
        }
        if (this.myProperties.myAttack == null)
        {
            this.myProperties.myAttack = transform.Find("Attacks").GetComponent<PlayerAttack>();
        }

        //this.myProperties.myTargetting = this.GetComponent<Targetting>();
        //this.myProperties.myTargetting.myOwner = this;

        if (input == null || movement == null || playerAnimation == null || playerSounds == null|| anim == null || animEvents == null || col == null)
        {
            Debug.LogError("Key Component Missing on " + this);
            this.enabled = false;
            return;
        }

        if (myProperties.myAttack == null || myProperties.myPerception == null || circleGesture == null || punchCircle == null)
        {
            Debug.LogError("Attack Component Missing on " + this);
            this.enabled = false;
            return;
        }

        // CHARGE INPUT TYPE
        if (chargeType == ChargeType.Trigger && circleGesture != null)
        {
            circleGesture.enabled = false;
        }
        #endregion

        StartListening();
    }