Exemple #1
0
 void Awake()
 {
     WeapDic.TryGetValue("Punch", out currentWeapon);
     shootableMask = LayerMask.GetMask("Shootable");
     wallMask      = LayerMask.GetMask("Wall");
     //gunParticles = GetComponent<ParticleSystem> ();
     gunLine = GetComponent <LineRenderer> ();
     //gunAudio = GetComponent<AudioSource> ();
     ammotext         = GameObject.FindWithTag("ammotext").GetComponent <Text>();
     flashuptext      = GameObject.FindWithTag("flashtxt").GetComponent <Text>();
     controllerscript = GetComponentInChildren <PlayerAnimController>();
     Resetflashputext();
     ammototal = 100;
 }
Exemple #2
0
    // Use this for initialization
    void Awake()
    {
        playerMovement       = GetComponent <PlayerMovement>();
        playerAnimController = GetComponent <PlayerAnimController>();
        playerSound          = GetComponent <PlayerSound>();
        gc = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();

        health = maxHealth;
        ammo   = startingAmmo;
        playerMovement.AllowControl(true);
        gc.SetPlayerHealthMax(maxHealth);
        UpdateUI();
        GunReload();
    }
Exemple #3
0
    void Start()
    {
        _PlayerState     = "ready";
        _direction       = Vector3.zero;
        _playerAirFlag   = false;
        Vertical         = 0.0f;
        Horizontal       = 0.0f;
        axisNumber       = -1;
        beforeaxisNumber = 3;

        _PlayerDefaultScale = new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z);
        StartCoroutine(test());

        _playerAnimCtl = GetComponent <PlayerAnimController>();
    }
    // Use this for initialization
    void Start()
    {
        _energyHandler        = GetComponent <EnergyHandler>();
        _playerController     = GetComponent <Player>();
        _playerAnimController = GetComponent <PlayerAnimController>();
        _playerCollider       = GetComponent <Collider>();
        _charachterController = GetComponent <CharacterController>();

        _respawnParticle.Clear();
        _respawnParticle.Play();
        _acessories.Pick();

        _initialPos = transform.position;
        SoundManager.Instance.PlaySomeAudio("Respawn");
    }
Exemple #5
0
    public override void init(Animator _animator)
    {
        base.init(_animator);

        m_property  = new RoleProperty();
        m_equipment = new RoleEquipment();
        m_equipment.init(GameResources.Instance()._ObjPlayer.transform);

        m_skillcontroler = new PlayerSkillController();
        m_skillcontroler.init();

        m_animcontroler = new PlayerAnimController();
        m_animcontroler.init(_animator);

        InventoryImpl.Instance().init();
    }
Exemple #6
0
    void AddDelayedEffectsToPlayer(PlayerAnimController pac)
    {
        int numEffects = (int)((UnityEngine.Random.value * numBurningEffectsToSpawn) + 1);

        for (int i = 0; i < numEffects; i++)
        {
            int     effectIndex = (int)(UnityEngine.Random.value * effectsForBurningPlayer.Length);
            Vector3 pos         = pac.transform.position;
            pos.y = UnityEngine.Random.value * 3;// magic number
            float delay = UnityEngine.Random.value * (howLongDoesPlayerBurn / 2);

            DelayedEffectInstanciation dei = new DelayedEffectInstanciation();
            dei.position    = pos;
            dei.timeToSpawn = Time.time + delay;
            dei.effectIndex = effectIndex;

            pendingEffects.Add(dei);
        }
    }
Exemple #7
0
    private void OnTriggerEnter(Collider other)
    {
        var pac = other.GetComponent <PlayerAnimController>();

        if (pac != null && worldScroller != null)
        {
            timeToReset           = Time.time + howLongDoesPlayerBurn;
            areWeBurningThePlayer = true;
            worldScroller.PlayerIsBurning(howLongDoesPlayerBurn);
            // spawn effects on player that expire after a set time

            player = pac;
            var burn = other.GetComponent <BurningEffect>();

            SetupCameraMovement(burn.cameraZoomSpot.position);
            AddDelayedEffectsToPlayer(player);
            player.PlayerIsDying();

            burn.StartBurn();
        }
    }
Exemple #8
0
 private void Awake()
 {
     Instance              = this;
     _energyHandler        = GetComponent <EnergyHandler>();
     _playerAnimController = GetComponent <PlayerAnimController>();
 }
Exemple #9
0
 public virtual void SetPlayerAnimController(PlayerAnimController playerAnimController)
 {
     this.playerAnimController = playerAnimController;
 }
Exemple #10
0
 private void Awake()
 {
     playerInputListener    = gameObject.GetComponentIfUnassigned(playerInputListener);
     playerAnimController   = gameObject.GetComponentIfUnassigned(playerAnimController);
     spellcastAudioTriggers = gameObject.GetComponentIfUnassigned(spellcastAudioTriggers);
 }
 private void Start()
 {
     CanvasBox.SetActive(false); // close the dialogue box on play
     animController = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerAnimController>();
 }
Exemple #12
0
    //------------------------------------//
    //--------------METHODS---------------//
    //------------------------------------//

    private void Awake()
    {
        playerInput          = GetComponent <PlayerInput>();
        playerStats          = GetComponent <PlayerStats>();
        playerAnimController = GetComponent <PlayerAnimController>();
    }
 void Start()
 {
     zombieAnim   = GetComponent <Animator> ();                                      //is animator componenet of zombie
     boxCol       = GetComponent <BoxCollider>();                                    //hitbox of zombie
     playerScript = GameObject.Find("Player").GetComponent <PlayerAnimController>(); //is the script for the player
 }
 private void DisablePlayerController()
 {
     animController = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerAnimController>();
     animController.ForceIdle();
     animController.enabled = false;
 }
 private void Awake()
 {
     _instance = this;
 }
        public static bool LateUpdateReplacement(
            PlayerAnimController __instance)
        {
            var isGrounded     = __instance._playerController.IsGrounded();
            var isAttached     = PlayerState.IsAttached();
            var isInZeroG      = PlayerState.InZeroG();
            var isFlying       = __instance._playerJetpack.GetLocalAcceleration().y > 0f;
            var movementVector = Vector3.zero;

            if (!isAttached)
            {
                movementVector = __instance._playerController.GetRelativeGroundVelocity();
            }

            if (Mathf.Abs(movementVector.x) < 0.05f)
            {
                movementVector.x = 0f;
            }

            if (Mathf.Abs(movementVector.z) < 0.05f)
            {
                movementVector.z = 0f;
            }

            if (isFlying)
            {
                __instance._ungroundedTime = Time.time;
            }

            var freefallMagnitude = 0f;
            var timeInFreefall    = 0f;
            var lastGroundBody    = __instance._playerController.GetLastGroundBody();

            if (!isGrounded && !isAttached && !isInZeroG && lastGroundBody != null)
            {
                freefallMagnitude = (__instance._playerController.GetAttachedOWRigidbody().GetVelocity() - lastGroundBody.GetPointVelocity(__instance._playerController.transform.position)).magnitude;
                timeInFreefall    = Time.time - __instance._ungroundedTime;
            }

            __instance._animator.SetFloat("RunSpeedX", movementVector.x / 3f);
            __instance._animator.SetFloat("RunSpeedY", movementVector.z / 3f);
            __instance._animator.SetFloat("TurnSpeed", __instance._playerController.GetTurning());
            __instance._animator.SetBool("Grounded", isGrounded || isAttached || PlayerState.IsRecentlyDetached());
            __instance._animator.SetLayerWeight(CrouchSync.CrouchLayerIndex, __instance._playerController.GetJumpCrouchFraction());
            __instance._animator.SetFloat("FreefallSpeed", freefallMagnitude / 15f * (timeInFreefall / 3f));
            __instance._animator.SetBool("InZeroG", isInZeroG || isFlying);
            __instance._animator.SetBool("UsingJetpack", isInZeroG && PlayerState.IsWearingSuit());
            if (__instance._justBecameGrounded)
            {
                if (__instance._justTookFallDamage)
                {
                    __instance._animator.SetTrigger("LandHard");
                    new AnimationTriggerMessage("LandHard").Send();
                }
                else
                {
                    __instance._animator.SetTrigger("Land");
                    new AnimationTriggerMessage("Land").Send();
                }
            }

            if (isGrounded)
            {
                var leftFootLift = __instance._animator.GetFloat("LeftFootLift");
                if (!__instance._leftFootGrounded && leftFootLift < 0.333f)
                {
                    __instance._leftFootGrounded = true;
                    __instance.RaiseEvent(nameof(__instance.OnLeftFootGrounded));
                }
                else if (__instance._leftFootGrounded && leftFootLift > 0.666f)
                {
                    __instance._leftFootGrounded = false;
                    __instance.RaiseEvent(nameof(__instance.OnLeftFootLift));
                }

                var rightFootLift = __instance._animator.GetFloat("RightFootLift");
                if (!__instance._rightFootGrounded && rightFootLift < 0.333f)
                {
                    __instance._rightFootGrounded = true;
                    __instance.RaiseEvent(nameof(__instance.OnRightFootGrounded));
                }
                else if (__instance._rightFootGrounded && rightFootLift > 0.666f)
                {
                    __instance._rightFootGrounded = false;
                    __instance.RaiseEvent(nameof(__instance.OnRightFootLift));
                }
            }

            __instance._justBecameGrounded = false;
            __instance._justTookFallDamage = false;
            var usingTool = Locator.GetToolModeSwapper().GetToolMode() != ToolMode.None;

            if ((usingTool && !__instance._rightArmHidden) || (!usingTool && __instance._rightArmHidden))
            {
                __instance._rightArmHidden = usingTool;
                for (var i = 0; i < __instance._rightArmObjects.Length; i++)
                {
                    __instance._rightArmObjects[i].layer = (!__instance._rightArmHidden) ? __instance._defaultLayer : __instance._probeOnlyLayer;
                }
            }

            return(false);
        }
Exemple #17
0
    private void Awake()
    {
        //get Suimono Specific Objects
        suimonoGameObject = GameObject.Find("SUIMONO_Module");
        if (suimonoGameObject != null) suimonoModuleObject = suimonoGameObject.GetComponent<SuimonoModule>();

        targetPosition = cameraTarget.position;
        targetRotation = cameraTarget.rotation;

        if (cameraTarget != null)
        {
            targetAnimator = cameraTarget.gameObject.GetComponent<PlayerAnimController>();
        }

        //if (vehicleTarget != null){
        //	vehiclePosition = vehicleTarget.gameObject.Find("PlayerPositionMarker").transform;
        //	vehicleExitPosition = vehicleTarget.gameObject.Find("PlayerExitMarker").transform;
        //	vehicle_engine_object = vehicleTarget.gameObject.GetComponent(sui_demo_boatAnim) as sui_demo_boatAnim;
        //}

        if (buoyancyTarget != null)
        {
            buoyancyObject = buoyancyTarget.GetComponent<fx_buoyancy>();
        }

        MC = this.gameObject.GetComponent<PlayerControllerMaster>();
        IC = this.gameObject.GetComponent<PlayerInputController>();
    }
 // Use this for initialization
 void Start()
 {
     initX = transform.position.x;
     initY = transform.position.y;
     health = maxHealth;
     hurtControl = GetComponent<HurtController> ();
     anim = GetComponent<PlayerAnimController> ();
     controller = GetComponent<Controller2D> ();
     gravity = -(2 * jumpHeight) / Mathf.Pow (jumpTime, 2) / 100f;
     jumpVelocity = Mathf.Abs(gravity) * jumpTime;
 }
Exemple #19
0
 // Use this for initialization
 void Start()
 {
     PAC = FindObjectOfType <PlayerAnimController>();
 }
Exemple #20
0
 private void Awake()
 {
     _playerAnimController = GetComponent <PlayerAnimController>();
     _playerController     = GetComponent <Player>();
 }
 void Start()
 {
     playerScript = GameObject.Find("Player").GetComponent <PlayerAnimController>();        //is the script for the player
 }