Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 void Start()
 {
     _pMove    = GetComponent <PlayerMover>();
     _pAnim    = GetComponent <PlayerAnimator>();
     _gm       = GameManager.Instance;
     _renderer = GetComponent <SpriteRenderer>();
 }
Ejemplo n.º 2
0
    public override void StateUpdate()
    {
        if (Input.GetButtonDown("LightAttack") || Input.GetButtonDown("HeavyAttack"))
        {
            TransitionTo <PlayerAttackState>();
        }
        else if (Input.GetButtonDown("Dash"))
        {
            TransitionTo <PlayerDashState>();
        }
        else if (player.CheckSyncPower())
        {
            return;
        }
        else if (!GroundCheck(GroundCheckDist))
        {
            TransitionTo <PlayerAirState>();
            return;
        }

        Velocity += Vector3.down * 0.5f;
        Velocity += GetInputRelativeToCamera() * Time.deltaTime * acceleration;
        AddFriction(GetInputRelativeToCamera(), Time.deltaTime);
        Velocity = Vector3.ClampMagnitude(Velocity, MaxSpeed);
        PlayerAnimator.SetFloat("Velocity", Velocity.magnitude / MaxSpeed);
    }
Ejemplo n.º 3
0
        public void ReloadAllPlayers()
        {
            _playerDrawables.Clear();

            foreach (var playerDataKeyVal in GameData.GetPlayers())
            {
                var playerId       = playerDataKeyVal.Key;
                var playerData     = playerDataKeyVal.Value;
                var playerDrawable = new PlayerDrawable(playerData.Color);
                _playerDrawables.Add(playerId, playerDrawable);

                var playerAnimator = new PlayerAnimator(playerDrawable);
                _playerAnimators.Add(playerDrawable, playerAnimator);

                var concretePlace = (ConcretePlace)playerData.Place.GetPlaceId();
                _playerConcretePlaces[playerId] = concretePlace;
            }

            var distinctConcretePlaces = _playerConcretePlaces.Values.Distinct().ToList();

            foreach (var concretePlace in distinctConcretePlaces)
            {
                var playerIds       = _playerConcretePlaces.Where(x => x.Value == concretePlace).Select(x => x.Key).ToList();
                var playerDrawables = _playerDrawables.Where(x => playerIds.Contains(x.Key)).Select(x => x.Value).ToList();
                var playerAnimators = _playerAnimators.Where(x => playerDrawables.Contains(x.Key)).Select(x => x.Value).ToList();

                var leftCornerPoint = PlacesPositions.GetPlayerPosition(concretePlace);
                PlayerPositionSetterHelper.SetPlayersPositions(playerAnimators, leftCornerPoint);
            }

            _debugInfoDrawable.UpdateCurrentPlayerId(GameData.GetCurrentPlayerId());

            _view.AddDrawables(_playerDrawables.Values);
        }
Ejemplo n.º 4
0
 public override void Exit()
 {
     tempVFX.gameObject.SetActive(false);
     rend.material.SetFloat("Vector1_6DD9F6DE", 1f);
     PlayerAnimator.SetTrigger("ToIdle");
     player.InvincibilityTime = time;
 }
Ejemplo n.º 5
0
        public PlayerAnimationUpdate(ushort playerId, PlayerAnimator animator)
        {
            PlayerId = playerId;

            JumpWeight         = animator.jumpWeight;
            JumpNormalizedTime = animator.jumpNormalizedTime;
            //Compress AnimIndex, assume their values are less than 256
            IdleAnimIndex   = (byte)animator.idleAnimIndex;
            SailAnimIndex   = (byte)animator.sailAnimIndex;
            MiningAnimIndex = (byte)animator.miningAnimIndex;
            MiningWeight    = animator.miningWeight;

            MovementState = animator.movementState;
            HorzSpeed     = animator.controller.horzSpeed;
            VertSpeed     = animator.controller.vertSpeed;
            Turning       = animator.turning;

            Flags = 0;
            if (animator.controller.actionWalk.isGrounded)
            {
                Flags |= EFlags.isGrounded;
            }

            if (animator.controller.actionDrift.inWater)
            {
                Flags |= EFlags.inWater;
            }
        }
Ejemplo n.º 6
0
    // Start is called before the first frame update
    void Awake()
    {
        // references initialization
        input        = new PlayerInput();
        camera       = Camera.main.transform;
        anim         = GetComponentInChildren <Animator>();
        visualScript = GetComponentInChildren <PlayerAnimator>();
        collider     = GetComponent <Collider>();
        hpbar        = GameObject.FindGameObjectWithTag("Hpbar").GetComponent <HitPoint>();

        // key registration
        input.Player.Attack.performed += _ => Attack();
        input.Player.Dash.performed   += _ => Dash(new Vector2(input.Player.HorizontalMove.ReadValue <float>(), input.Player.VerticalMove.ReadValue <float>()));

        // value initialization
        moveSpeedMax = moveSpeed;
        isAttacking  = false;
        attackedEnemy.Clear();
        immuneEnemy.Clear();
        shouldAttack      = false;
        canAttack         = false;
        canRegisterAttack = false;
        isDashing         = false;
        canRegisterDash   = false;

        //debug
        // Time.timeScale = 0.2f;
    }
Ejemplo n.º 7
0
 public override void Enter()
 {
     timer = KnockbackTime;
     RuntimeManager.PlayOneShotAttached(KnockbackSound, player.gameObject);
     PlayerAnimator.SetTrigger(KnockbackAnimationTrigger);
     Velocity = Vector3.zero;
 }
Ejemplo n.º 8
0
        public Player(string Id, Inputs Inputs, Camera2d Camera, NetworkHandler network, bool remote) : base(Id)
        {
            this.Inputs = Inputs;

            animator = new PlayerAnimator(this);
            animator.mainCollider.Collision = new CollisionHandlerAggregation(
                new LogCollision()
                , new BlockCollisionHandler()
                , new FlagAsHit(this)
                );
            animator.groundDetection.Collision = new FlagAsGrounded(this);

            Animation = animator;

            if (remote)
            {
                Update = CreateUpdatesByState(Inputs);
            }
            else
            {
                Update = new UpdateAggregation(
                    CreateUpdatesByState(Inputs)
                    , new BroadCastState(Camera, this, network)
                    );
            }
        }
Ejemplo n.º 9
0
 private void Start()
 {
     m_fpc   = FindObjectOfType <FirstPersonController>();
     m_panim = FindObjectOfType <PlayerAnimator>();
     m_idleBob.Setup(transform, 5f);
     m_firedBob.Setup(transform, 5f);
 }
Ejemplo n.º 10
0
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>();
        if (!player)
            Debug.Log("EndControll.cs: Player not Found!");

		playerAnimator = player.GetComponentInChildren<PlayerAnimator>();
		if (!playerAnimator)
			Debug.Log("EndControll.cs: PlayerAnimator not Found!");

        gridManager = GameObject.FindObjectOfType<GridManager>();
        if (!gridManager)
            Debug.Log("EndControll.cs: Grid Manager not Found!");

        ui = GameObject.FindObjectOfType<UICollectionItems>();
        if (!ui)
            Debug.Log("EndControll.cs: ui not Found!");

        data =  GameObject.FindObjectOfType<ParkourData>();
        if (!data)
            Debug.Log("EndControll.cs: ParkourData not Found!");

		mainParkour = GameObject.FindObjectOfType<MainParkour>();
		if (!mainParkour)
			Debug.Log("EndControll.cs: MainParkour not Found!");
    }
Ejemplo n.º 11
0
    void Update()
    {
        if (drawLetter)
        {
            PenInHand.gameObject.SetActive(true);
            PenInHand.GetComponent <Animator> ().SetInteger("HandAndPenState", 1);
            StartCoroutine(FadeInLetter());
            drawLetter = false;
        }

        if (Letters.transform.GetChild(0).GetChild(0).gameObject.activeSelf == true)
        {
            if (Input.GetKey("j"))
            {
                JAnimator.SetBool("LetterPressed", true);
                PlayerAnimator.SetInteger("PlayerState", 3);
                Chair.GetComponent <BoxCollider2D> ().enabled = false;
                playerRigidbody.velocity = new Vector3(1.8f, playerRigidbody.velocity.y, 0f);
            }
            else
            {
                JAnimator.SetBool("LetterPressed", false);
                PlayerAnimator.SetInteger("PlayerState", 2);
                playerRigidbody.velocity = new Vector3(0f, playerRigidbody.velocity.y, 0f);
            }
        }
    }
Ejemplo n.º 12
0
 void Awake()
 {
     _navMeshAgent   = GetComponent <NavMeshAgent>();
     _rigid          = GetComponent <Rigidbody>();
     _playerAnimator = GetComponent <PlayerAnimator>();
     _status         = GetComponent <Status>();
 }
Ejemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     controller  = GetComponent <CharacterController> ();
     anim        = GetComponentInChildren <PlayerAnimator> ();
     action      = GetComponentInChildren <Action> ();
     playerState = GetComponent <PlayerState> ();
 }
Ejemplo n.º 14
0
 void Start()
 {
     instance           = this;
     transform.position = playerStartingPoint;
     playerAnimator     = gameObject.GetComponent <PlayerAnimator>();
     StartCoroutine(SpawnPlayerIn());
 }
Ejemplo n.º 15
0
        private void OnLeanChanged(PlayerAnimator obj)
        {
            var player = GetUnturnedPlayer(obj.player) !;

            LeanType leanType;

            switch (obj.lean)
            {
            case 1:
                leanType = LeanType.Left;
                break;

            case 0:
                leanType = LeanType.Center;
                break;

            case -1:
                leanType = LeanType.Right;
                break;

            default:
                leanType = LeanType.Center;
                break;
            }

            var @event = new UnturnedPlayerLeanUpdatedEvent(player, leanType);

            Emit(@event);
        }
Ejemplo n.º 16
0
    // Use this for initialization
    void Start()
    {
        rb2d           = GetComponent <Rigidbody2D>();
        actionSystem   = GetComponent <PlayerActionSystem>();
        playerAnimator = GetComponent <PlayerAnimator>();

        // Calculate static values of forces here instead of FixedUpdate() so we
        // only calculate them once, as they never change. For optimsation.
        inAirMoveForce     = moveForce * 0.5f;
        whileAttkMoveForce = moveForce * 0.4f;
        slowdownForce      = moveForce;

        preBuffMaxSpeed   = maxSpeed;
        maxSpeedInAir     = maxSpeed * 0.7f;
        maxSpeedWhileAttk = maxSpeed * 0.5f;

        // Calculate the static vectors here instead of FixedUpdate() so we only
        // calculate them once, as they never change. For optimisation.
        bounceEnemyLeftV  = new Vector2(1, 0.5f) * throwbackForce;
        bounceEnemyRightV = new Vector2(-1, 0.5f) * throwbackForce;
        slowdownLeft      = Vector2.left * slowdownForce;
        slowdownRightV    = Vector2.right * slowdownForce;
        moveLeftV         = Vector2.left * moveForce;
        moveRightV        = Vector2.right * moveForce;
        jumpV             = new Vector2(0f, jumpForce);

        // Abilities
        actionSystem.Setup(moveLeftV, moveRightV);
    }
Ejemplo n.º 17
0
    void Update()
    {
        //------------------------------------------------------------------------------------------//
        //-----------------------------   ATTACK AND MOVEMENT LOGIC   ------------------------------//
        //------------------------------------------------------------------------------------------//
        if (!Target)
        {
            Target = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
        }

        HasPath            = Physics2D.OverlapCircle(GroundCheck.position, CheckRadius, WhatIsGround);
        DistanceFromPlayer = Vector3.Distance(transform.position, Target.transform.position);

        if (HasPath && DistanceFromPlayer < TrackingRange)
        {
            AnimatorTransitionInfo info = PlayerAnimator.GetAnimatorTransitionInfo(0);
            if (!BreakBetweenAttacks)
            {
                if (DistanceFromPlayer <= AttackRange)
                {
                    AttackHandler();
                }
                if (!IsAttacking && CanMove)
                {
                    transform.position = Vector2.MoveTowards(transform.position, Target.position, Speed * Time.deltaTime);
                }
            }
            else if (DistanceFromPlayer > 1.1f && CanMove)
            {
                transform.position = Vector2.MoveTowards(transform.position, Target.position, Speed * Time.deltaTime);
            }
        }

        MovementAnimationHandler();
    }
Ejemplo n.º 18
0
    //ポーズ状態を変更する
    public void ChangePauseState()
    {
        var            go             = GameObject.Find(Common.Player.NAME);
        PlayerAnimator playerAnimator = null;

        if (go)
        {
            playerAnimator = go.GetComponentInChildren <PlayerAnimator>();
        }
        if (!isPausing)
        {
            //ポーズメニューを起動する
            pauseMenu.SetActive(true);
            Pause(0.001f);
            if (playerAnimator)
            {
                playerAnimator.StopAnimation();
            }
        }
        else
        {
            Resume();
            if (playerAnimator)
            {
                playerAnimator.ResumeAnimation();
            }
        }
    }
Ejemplo n.º 19
0
 private void Start()
 {
     player   = GetComponent <PlayerScript> ();
     animator = new PlayerAnimator(GetComponent <Animator> ());
     Init();
     root = SetUp_Behavior_Tree();
 }
Ejemplo n.º 20
0
 // Use this for initialization
 void Start()
 {
     anim            = transform.parent.GetComponentInChildren <PlayerAnimator>();
     npcLayerMask    = LayerMask.NameToLayer("NPC");
     playerLayerMask = LayerMask.NameToLayer("Player");
     attackLayerMask = LayerMask.NameToLayer("Attack");
 }
Ejemplo n.º 21
0
 private void Start()
 {
     animatorControl = GetComponent <PlayerAnimator>();
     verticalSpeed   = minFall;
     character       = GetComponent <CharacterController>();
     screen          = DebugScreen.GetInstance();
 }
Ejemplo n.º 22
0
    // Start is called before the first frame update
    void Start()
    {
        hp = hp_max;
        mp = mp_max;

        magic_object = Instantiate(magic_prefab) as GameObject;
        magic_script = magic_object.GetComponent <MagicBase>();

        ui = GetComponent <PlayerUI>();

        //scoreとUIの初期化
        score = 0;

        ui.SetScore(score);

        //distanceとUIの初期化
        distance = 100000;

        ui.SetDistance(distance);

        ui.SetUIData(hp_max, mp_max);

        p_anim = gameObject.GetComponent <PlayerAnimator>();

        scenechange = 0;
        timecount   = 2f;
        cam         = GameObject.Find("Main Camera");
        camSprite   = cam.GetComponent <CameraControll>();
    }
        public static bool Prefix(PlayerAnimator __instance, CSteamID steamID, byte id)
        {
            var session = Plugin.Instance.SessionManager.Sessions.FirstOrDefault(c => c.Player.channel.owner.playerID.steamID == __instance.player.channel.owner.playerID.steamID);

            session?.OnGesture((EPlayerGesture)id);
            return(true);
        }
	void Awake()
    {
        player = GameObject.FindGameObjectWithTag("Player");
        playerStatistics = player.gameObject.GetComponent<PlayerStatistics>();
        playerAnimator = player.gameObject.GetComponent<PlayerAnimator>();
        animHashes = player.GetComponent<HashIDs>();
    }
Ejemplo n.º 25
0
    void Start()
    {
        _ownRigid = GetComponent <Rigidbody>();
        _animator = FindObjectOfType <PlayerAnimator>();

        CameraMove.target = transform;
    }
Ejemplo n.º 26
0
 private void Start()
 {
     playerAnimation = GetComponent <PlayerAnimator>();
     rb         = GetComponent <Rigidbody>();
     col        = GetComponent <CapsuleCollider>();
     mainCamera = Camera.main.transform;
 }
Ejemplo n.º 27
0
 private void Start()
 {
     anim         = GetComponent <PlayerAnimator>();
     lastPosition = transform.position;
     rb           = GetComponent <Rigidbody>();
     jump         = new Vector3(0.0f, 2.0f, 0.0f);
 }
Ejemplo n.º 28
0
 // Use this for initialization
 void Start()
 {
     currentMilestone   += milestoneDistance;
     playerAnimator      = GetComponent <PlayerAnimator>();
     playerMovement      = GetComponent <PlayerMovement>();
     particleSystem.loop = false;
 }
Ejemplo n.º 29
0
    private void Start()
    {
        playerAnimator = GetComponentInChildren <PlayerAnimator>();
        playerState    = GetComponent <PlayerState>();
        rb             = GetComponent <Rigidbody>();
        inputManager   = FindObjectOfType <InputManager>();

        //找不到组件时输出到控制台
        if (!playerAnimator)
        {
            Debug.LogError(gameObject.name + "找不到PlayerAnimator脚本组件!");
        }
        if (!playerState)
        {
            Debug.LogError(gameObject.name + "找不到PlayerState脚本组件!");
        }
        if (!rb)
        {
            Debug.LogError(gameObject.name + "找不到Rigidbody组件!");
        }

        //分配Layer和LayerMask
        EnemyLayer             = LayerMask.NameToLayer("Enemy");
        DestroyableObjectLayer = LayerMask.NameToLayer("DestroyableObject");
        EnvironmentLayer       = LayerMask.NameToLayer("Environment");
        //开启EnemyLayer和DestroyableObjectLayer层
        HitLayerMask = (1 << EnemyLayer) | (1 << DestroyableObjectLayer);

        //在跳跃过程中设置玩家为无敌
        if (!invulnerableDuringJump)
        {
            HitableStates.Add(PLAYERSTATE.JUMPING);
            HitableStates.Add(PLAYERSTATE.JUMPKICK);
        }
    }
Ejemplo n.º 30
0
    private void DoAttack()
    {
        currentAttackGrade = BeatManager.GetGrade();
        SetupVFX();
        OnAttack?.Invoke(currentAttackGrade);
        if (currentAttackGrade != RhythmGrade.Miss)
        {
            SyncPowerManager.KeepTheBeatGoing();
        }
        else
        {
            SyncPowerManager.Miss();
        }

        player.OnAttackedPressed?.Invoke();
        PlayerAnimator.SetTrigger(CurrentAttack.AttackTag);
        RuntimeManager.PlayOneShotAttached(CurrentAttack.AttackSFX, player.gameObject);
        timer = 0;
        hitObjects.Clear();
        timeOfLastAttack = Time.time + CurrentAttack.Clip.length;

        if (DirectionInput.magnitude > 0)
        {
            PlayerAnimator.transform.LookAt(PlayerAnimator.transform.position + Vector3.ProjectOnPlane(GetInputRelativeToCamera(), Vector3.up));
        }
        AutoTargeting();
    }
Ejemplo n.º 31
0
        // Use this for initialization

        void Start()
        {
            _storedLateralSpeed = lateralSpeed;
            _Controller         = GetComponent <CharacterController>();
            GameController.Instance.GameOver += HaltInput;
            _Animator = GetComponent <PlayerAnimator>();
        }
Ejemplo n.º 32
0
    public void OnLoad()
    {
        PlayerPasser     loadedplayer = FindObjectOfType <PlayerPasser>();
        PlayerStats      stats        = player.GetComponent <PlayerStats>();
        EquipmentManager equipmanager = player.GetComponent <EquipmentManager>();
        Inventory        inventory    = player.GetComponent <Inventory>();
        PlayerAnimator   animator     = player.GetComponent <PlayerAnimator>();

        stats.id            = loadedplayer.playerid;
        stats.CharacterName = loadedplayer.CharacterName;
        stats.coins         = loadedplayer.coins;
        stats.level         = loadedplayer.level;
        stats.currentHealth = loadedplayer.currentHealth;
        stats.maxHealth     = loadedplayer.maxHealth;
        stats.maxExp        = loadedplayer.maxExp;
        stats.currentExp    = loadedplayer.currentExp;
        stats.currentMana   = loadedplayer.currentMana;
        stats.maxMana       = loadedplayer.maxMana;
        stats.defense.SetValue(loadedplayer.defense);
        stats.strength.SetValue(loadedplayer.strength);
        stats.dexterity.SetValue(loadedplayer.dexterity);
        stats.intelligence.SetValue(loadedplayer.intelligence);

        for (int i = 0; i < loadedplayer.equipmentlist.Count; i++)
        {
            equipmanager.Equip(loadedplayer.equipmentlist[i]);
            animator.OnEquipmentChanged(loadedplayer.equipmentlist[i], null);
        }
        foreach (Item item in loadedplayer.itemlist)
        {
            inventory.Add(item);
        }
    }
Ejemplo n.º 33
0
 public void SetUp(Transform rightHandObj, PlayerAnimator newPlayerAnimator, PlayerController newPlayerController, Transform bombTargetPrefab)
 {
     rightHand = rightHandObj;
     playerAnimator = newPlayerAnimator;
     playerController = newPlayerController;
     Transform bombTargetObj = Instantiate(bombTargetPrefab, transform.position, Quaternion.identity) as Transform;
     bombTarget = bombTargetObj.GetComponent<BombTarget>();
 }
Ejemplo n.º 34
0
	// Use this for initialization
	void Start () {
        if (player != null)
        {
            playerAnimator = player.GetComponent<PlayerAnimator>();
        }
        else
        {
            Debug.LogWarning("No object with tag 'Player'");
        }
        transform.position = new Vector3(player.transform.position.x, player.transform.position.y, -p_cameraDistanceZ);  
	}
Ejemplo n.º 35
0
    // Use this for initialization
    void Start()
    {
        controller = GetComponent<PlayerController> ();

        int pID = controller.PLAYER_ID;
        A_INPUT += pID;
        B_INPUT += pID;
        Horizontal_INPUT += pID;
        Vertical_INPUT += pID;
        A_GAMEPAD += pID;
        B_GAMEPAD += pID;
        X_GAMEPAD += pID;
        Horizontal_GAMEPAD += pID;
        Vertical_GAMEPAD += pID;
        Start_INPUT += pID;

        aimDir = Vector2.zero;
        anim = GetComponent<PlayerAnimator> ();
        newRot = Vector3.zero;
    }
	// Use this for initialization
	void Start () {
        gameObject.GetComponent<ParticleSystem>().enableEmission = false;
        playerAnimator = GetComponentInParent<PlayerAnimator>();
        ps = GetComponent<ParticleSystem>();
	}
Ejemplo n.º 37
0
 void Awake()
 {
     characterController = GetComponent<CharacterController>();
     anim = GetComponent<PlayerAnimator> ();
     xPower = gameObject.AddComponent<SpeedPower>();
     yPower = gameObject.AddComponent<GiantHookPower>();
 }
Ejemplo n.º 38
0
	// Use this for initialization
	void Start () {
        guiController = GetComponent<GUIController>();
        playerInput = player.GetComponent<PlayerInput>();
        playerAnimator = player.GetComponent<PlayerAnimator>();
	}
Ejemplo n.º 39
0
 public virtual void Awake()
 {
     gravityAttractors = GameObject.FindObjectsOfType<FauxGravityAttractor>();
     playerAnimator = gameObject.GetComponent<PlayerAnimator> ();
 }
Ejemplo n.º 40
0
    void Awake()
    {
        Transform playerProxy = transform.Find("ThiefProxy");
        Destroy(playerProxy.gameObject);

        thiefObj = Instantiate(playerPrefab, Vector3.zero, Quaternion.identity) as Transform;
        thiefObj.name = "Thief";
        thiefObj.parent = transform;
        thiefObj.localPosition = Vector3.zero;
        thiefObj.localRotation = Quaternion.identity;
        RagDollController playerRagDoll = thiefObj.gameObject.AddComponent<RagDollController>();
        thiefObj.gameObject.AddComponent<AnimationEventListener>();

        playerAnimator = GetComponent<PlayerAnimator>();
        if (!playerAnimator) Debug.Log("ERROR: Can't Find Player Animator");

        playerController = GetComponent<PlayerController>();
        if (!playerController) Debug.Log("ERROR: Can't Find Player Controller");

        playerBombThrower = GetComponent<BombThrower>();
        if (!playerBombThrower) Debug.Log("ERROR: Can't Find Bomb Thrower");

        Transform thiefHead = thiefObj.Find ("Thief_Skeleton/Root/UpperBody/Spine1/Spine2/Neck/Head");
        if (!thiefHead) Debug.Log("ERROR: Can't Find Player Head");

        Transform thiefRightHand = thiefObj.Find ("Thief_Skeleton/Root/UpperBody/Spine1/Spine2/RightShoulder/RightElbow/RightWrist");
        if (!thiefRightHand) Debug.Log("ERROR: Can't Find Player Hand");

        Transform thiefUpperBody = thiefObj.Find ("Thief_Skeleton/Root/UpperBody");
        if (!thiefUpperBody) Debug.Log("ERROR: Can't Find Player UpperBody");

        Transform thiefUpperTorso = thiefObj.Find ("Thief_Skeleton/Root/UpperBody/Spine1/Spine2");
        if (!thiefUpperTorso) Debug.Log("ERROR: Can't Find Player Torso");

        WristWeapon wristWeapon = Instantiate(wristWeaponPrefab, thiefRightHand.position, thiefRightHand.rotation) as WristWeapon;
        wristWeapon.SetUp(thiefRightHand);

        playerAnimator.SetUp(thiefObj, thiefUpperBody);
        playerController.SetUp(thiefHead, playerRagDoll, playerBombThrower, wristWeapon);
        playerBombThrower.SetUp(thiefRightHand, playerAnimator, playerController, bombTargetPrefab);

        setUpData.layerName = "PlayerRagDoll";
        setUpData.rootTransform = thiefObj.Find("Thief_Skeleton/Root");
        setUpData.root.collision.center = new Vector3(0.0f, 0.0f, 0.0f);
        setUpData.root.collision.size = new Vector3(0.296f, 0.321f, 0.479f);

        setUpData.leftHip.collision.center = new Vector3(-0.221f, 0.000f, 0.000f);
        setUpData.leftHip.collision.radius = 0.133f;
        setUpData.leftHip.collision.height = 0.443f;
        setUpData.leftHip.joint.axis = new Vector3(0.0f, -1.0f, 0.0f);
        setUpData.leftHip.joint.swingAxis = new Vector3(1.0f, 0.0f, 0.0f);

        setUpData.leftKnee.collision.center = new Vector3(-0.35f, 0.000f, 0.000f);
        setUpData.leftKnee.collision.radius = 0.119f;
        setUpData.leftKnee.collision.height = 0.476f;
        setUpData.leftKnee.joint.axis = new Vector3(0.0f, 0.0f, -1.0f);
        setUpData.leftKnee.joint.swingAxis = new Vector3(1.0f, 0.0f, 0.0f);

        setUpData.rightHip.collision.center = new Vector3(0.221f, 0.000f, 0.000f);
        setUpData.rightHip.collision.radius = 0.133f;
        setUpData.rightHip.collision.height = 0.443f;
        setUpData.rightHip.joint.axis = new Vector3(0.0f, -1.0f, 0.0f);
        setUpData.rightHip.joint.swingAxis = new Vector3(-1.0f, 0.0f, 0.0f);

        setUpData.rightKnee.collision.center = new Vector3(0.23f, 0.000f, 0.000f);
        setUpData.rightKnee.collision.radius = 0.119f;
        setUpData.rightKnee.collision.height = 0.476f;
        setUpData.rightKnee.joint.axis = new Vector3(0.0f, 0.0f, -1.0f);
        setUpData.rightKnee.joint.swingAxis = new Vector3(-1.0f, 0.0f, 0.0f);

        setUpData.spine.collision.center = new Vector3(-0.1487f, -0.001f, -0.000f);
        setUpData.spine.collision.size = new Vector3(0.296f, 0.321f, 0.479f);
        setUpData.spine.joint.axis = new Vector3(0.0f, 0.0f, -1.0f);
        setUpData.spine.joint.swingAxis = new Vector3(-1.0f, 0.0f, 0.0f);

        setUpData.head.collision.center = new Vector3(0.000f, 0.120f, 0.000f);
        setUpData.head.collision.radius = 0.120f;
        setUpData.head.joint.axis = new Vector3(1.0f, 0.0f, 0.0f);
        setUpData.head.joint.swingAxis = new Vector3(0.0f, 1.0f, 0.0f);

        setUpData.leftShoulder.collision.center = new Vector3(0.172f, 0.000f, 0.000f);
        setUpData.leftShoulder.collision.radius = 0.086f;
        setUpData.leftShoulder.collision.height = 0.345f;
        setUpData.leftShoulder.joint.axis = new Vector3(0.0f, 0.0f, -1.0f);
        setUpData.leftShoulder.joint.swingAxis = new Vector3(0.0f, -1.0f, 0.0f);

        setUpData.leftElbow.collision.center = new Vector3(0.285f, 0.000f, 0.000f);
        setUpData.leftElbow.collision.radius = 0.114f;
        setUpData.leftElbow.collision.height = 0.570f;
        setUpData.leftElbow.joint.axis = new Vector3(0.0f, -1.0f, 0.0f);
        setUpData.leftElbow.joint.swingAxis = new Vector3(0.0f, 0.0f, -1.0f);

        setUpData.rightShoulder.collision.center = new Vector3(-0.174f, 0.000f, 0.000f);
        setUpData.rightShoulder.collision.radius = 0.086f;
        setUpData.rightShoulder.collision.height = 0.345f;
        setUpData.rightShoulder.joint.axis = new Vector3(0.0f, 0.0f, 1.0f);
        setUpData.rightShoulder.joint.swingAxis = new Vector3(0.0f, 1.0f, 0.0f);

        setUpData.rightElbow.collision.center = new Vector3(-0.285f, 0.000f, 0.000f);
        setUpData.rightElbow.collision.radius = 0.114f;
        setUpData.rightElbow.collision.height = 0.570f;
        setUpData.rightElbow.joint.axis = new Vector3(0.0f, 1.0f, 0.0f);
        setUpData.rightElbow.joint.swingAxis = new Vector3(0.0f, 0.0f, 1.0f);

        playerRagDoll.setUp(setUpData);
    }
Ejemplo n.º 41
0
    void Start()
    {
        if(m_WeaponEquipped)
        {
            EquipWeapon (m_WeaponEquipped);
            DrawWeapon(true);
        }
        m_Animator = gameObject.GetComponentInChildren<PlayerAnimator>();

        //m_AudioSource = GetComponent<AudioSource> ();
    }
Ejemplo n.º 42
0
 void Awake()
 {
     playerAnimator = GetComponent<PlayerAnimator>();
     controlType = ControlType.MouseAndKeyboard;
     gui = GameObject.Find("GameManager").GetComponent<GUIController>();
 }
 // Use this for initialization
 void Start()
 {
     mainCam = GameObject.FindGameObjectWithTag ("MainCamera");
     m_PlayerController = GetComponent<CharacterController>();
     m_Animator = gameObject.GetComponentInChildren<PlayerAnimator>();
 }
Ejemplo n.º 44
0
    public void SetUp(Transform thiefHead, RagDollController thiefRagDoll, BombThrower newBombThrower, WristWeapon newWristWeapon)
    {
        ragDoll = thiefRagDoll;
        playerBombThrower = newBombThrower;
        wristWeapon = newWristWeapon;
        characterController = GetComponent<CharacterController>();
        playerAnimator = GetComponent<PlayerAnimator>();

        Transform miniMapDot = transform.Find("MiniMapUnit");
        if (miniMapDot) {
            miniMapDot.renderer.material.color = Color.yellow;
            miniMapDot.renderer.material.renderQueue = 3500;
        }
        GameObject gameControlObj = GameObject.Find ("GameControl");
        gameControl = gameControlObj.GetComponent<GameControl>();
    }
Ejemplo n.º 45
0
    protected override void Awake()
    {
        base.Awake();

        if (playerAnimation == null)
        {
            playerAnimation = this;
        }
    }