コード例 #1
0
        void Awake()
        {
            characterController = GetComponent <CharacterController>();
            if (characterController == null)
            {
                characterController = gameObject.AddComponent <CharacterController>();
            }

            vignette   = head.GetComponentInChildren <VignettingVR>();
            moveScript = GetComponent <SimpleCharacterController>();

            // InitializeClimbableChecks();
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: wolfrug/ldjam45
 // Start is called before the first frame update
 void Start()
 {
     if (controller == null)
     {
         controller = GetComponent <SimpleCharacterController> ();
     }
     GameManager.instance.statUpdateEvent.AddListener(UpdatePlayerAbilities);
     shield.SetActive(false);
     attack.SetActive(false);
     levitate.SetActive(false);
     UpdatePlayerAbilities(InteractableColor.NONE);
     audioSource_attack.PausePlay(true);
     audioSource_fly.PausePlay(true);
     audioSource_shield.PausePlay(true);
 }
コード例 #3
0
        /// <summary>
        /// Constructs the character and internal physics character controller.
        /// </summary>
        /// <param name="owningSpace">Space to add the character to.</param>
        /// <param name="CameraToUse">Camera to attach to the character.</param>
        public SimpleCharacterControllerInput()
        {
            _characterController = new SimpleCharacterController(new Vector3(64), 3, 1f, 0.25f, 1000);

            PhysicsManager.Instance.Space.Add(_characterController);

            Deactivate();

            KeyAssignment.KeyAction wKeyDel = keyState =>
            {
                _movementDir = CameraManager.Instance.World.Forward;
                _totalMovement += Vector2.Normalize(new Vector2(_movementDir.X, _movementDir.Z));
            };
            KeyboardManager.Instance.MapKey(Keys.W, wKeyDel, KeyActionType.KeyDown);

            KeyAssignment.KeyAction sKeyDel = keyState =>
            {
                _movementDir = CameraManager.Instance.World.Forward;
                _totalMovement -= Vector2.Normalize(new Vector2(_movementDir.X, _movementDir.Z));
            };
            KeyboardManager.Instance.MapKey(Keys.S, sKeyDel, KeyActionType.KeyDown);

            KeyAssignment.KeyAction aKeyDel = keyState =>
            {
                _movementDir = CameraManager.Instance.World.Left;
                _totalMovement += Vector2.Normalize(new Vector2(_movementDir.X, _movementDir.Z));
            };
            KeyboardManager.Instance.MapKey(Keys.A, aKeyDel, KeyActionType.KeyDown);

            KeyAssignment.KeyAction dKeyDel = keyState =>
            {
                _movementDir = CameraManager.Instance.World.Right;
                _totalMovement += Vector2.Normalize(new Vector2(_movementDir.X, _movementDir.Z));
            };
            KeyboardManager.Instance.MapKey(Keys.D, dKeyDel, KeyActionType.KeyDown);

            KeyAssignment.KeyAction spaceKeyDel = keyState =>
            {
                _characterController.Jump();
            };
            KeyboardManager.Instance.MapKey(Keys.Space, spaceKeyDel, KeyActionType.KeyPressed);
        }
コード例 #4
0
 private void Awake()
 {
     characterController = GetComponent <SimpleCharacterController>();
 }
コード例 #5
0
 // Start is called before the first frame update
 void Start()
 {
     characterController = gameObject.GetComponent <SimpleCharacterController>();
 }
コード例 #6
0
 //Obtain components from player
 public virtual void Start()
 {
     animator          = GetComponentInParent <Animator>();
     playerInformation = GetComponentInParent <SimpleCharacterController>();
 }
コード例 #7
0
ファイル: Bot.cs プロジェクト: SylvainTran/cart315-w2021
    public Vector3 navGroundOffset; // To be examined later

    // Start is called before the first frame update
    public void Start()
    {
        agent            = this.GetComponent <UnityEngine.AI.NavMeshAgent>();
        ds               = target.GetComponent <SimpleCharacterController>();
        agent.autoRepath = true;
    }
コード例 #8
0
 void Awake()
 {
     moveScript = GetComponent <SimpleCharacterController>();
 }