public override void Respawn()
        {
            SetModel("models/citizen/citizen.vmdl");

            //
            // Use WalkController for movement (you can make your own PlayerController for 100% control)
            //
            Controller = new WalkController();

            //
            // Use StandardPlayerAnimator  (you can make your own PlayerAnimator for 100% control)
            //
            Animator = new StandardPlayerAnimator();

            //
            // Use FirstPersonCamera (you can make your own Camera for 100% control)
            //
            Camera = new FirstPersonCamera();

            EnableAllCollisions       = true;
            EnableDrawing             = true;
            EnableHideInFirstPerson   = true;
            EnableShadowInFirstPerson = true;

            base.Respawn();
        }
Example #2
0
    public override void Respawn()
    {
        SetModel("models/citizen/citizen.vmdl");

        Controller = new WalkController();
        Animator   = new StandardPlayerAnimator();
        Camera     = new FirstPersonCamera();

        EnableAllCollisions       = true;
        EnableDrawing             = true;
        EnableHideInFirstPerson   = true;
        EnableShadowInFirstPerson = true;

        Dress();
        ClearAmmo();

        SupressPickupNotices = true;

        Inventory.Add(new Pistol(), true);
        //Inventory.Add( new Shotgun() );
        //Inventory.Add( new SMG() );
        //Inventory.Add( new Crossbow() );

        GiveAmmo(AmmoType.Pistol, 100);
        GiveAmmo(AmmoType.Buckshot, 8);
        GiveAmmo(AmmoType.Crossbow, 4);

        SupressPickupNotices = false;
        Health = 100;

        base.Respawn();
    }
Example #3
0
    public override void Respawn()
    {
        SetModel("models/citizen/citizen.vmdl");

        Controller = new WalkController();
        Animator   = new StandardPlayerAnimator();
        Camera     = new FirstPersonCamera();

        EnableAllCollisions       = true;
        EnableDrawing             = true;
        EnableHideInFirstPerson   = true;
        EnableShadowInFirstPerson = true;

        Inventory.Add(new Gun(), true);
        Inventory.Add(new Tool());
        Inventory.Add(new PhysGun());
        Inventory.Add(new GravGun());
        //Inventory.Add( new BoxShooter() );
        //Inventory.Add( new Welder() );
        //Inventory.Add( new Thruster() );
        //Inventory.Add( new Wheel() );
        //Inventory.Add( new Balloon() );
        //Inventory.Add( new Remover() );
        //Inventory.Add( new Drone() );

        base.Respawn();
    }
Example #4
0
    public override void Respawn()
    {
        SetModel("models/citizen/citizen.vmdl");

        Controller = new WalkController();
        Animator   = new StandardPlayerAnimator();
        Camera     = LastCamera;

        if (DevController is NoclipController)
        {
            DevController = null;
        }

        EnableAllCollisions       = true;
        EnableDrawing             = true;
        EnableHideInFirstPerson   = true;
        EnableShadowInFirstPerson = true;

        Dress();

        Inventory.Add(new PhysGun(), true);
        Inventory.Add(new GravGun());
        Inventory.Add(new Tool());
        Inventory.Add(new Gun());

        base.Respawn();
    }
Example #5
0
    /// <summary>
    /// This is the Start method, called at the initialization of the class and used to set walkController to the instance of
    /// WalkController on this object.
    /// </summary>
    void Start()
    {
        // Initialize the raycastLayers
        raycastLayers = 1 << 9;
        raycastLayers = ~raycastLayers;

        // Initialize the walkController.
        walkController = GetComponent<WalkController>();
    }
Example #6
0
 private void Construct(MovementController movementController,
                        WalkController walkController,
                        PauseMenuToggler pauseMenuToggler,
                        [Inject(Id = "Player")] Transform playerTransform,
                        CharacterController characterController)
 {
     _movementController  = movementController;
     _walkController      = walkController;
     _pauseMenuToggler    = pauseMenuToggler;
     _playerTransform     = playerTransform;
     _characterController = characterController;
 }
Example #7
0
    // Use this for initialization
    void Start()
    {
        _rootPoint = new MotionPoint(0, 0, 0); //Can be anything

        _animationList = new List <Animation>();
        Util.FindChildrenWithAnimation(transform, _animationList);

        _ikList = new List <IterativeIK>();
        FindChildrenIKs(transform, _ikList);

        _walkController = new WalkController(transform, null, _rootPoint, _minCyclesPerSecond, _maxCyclesPerSecond, _heightCorrection);
    }
        public WalkControllerTest()
        {
            _userRepository         = Substitute.For <IUserRepository>();
            _walkRepository         = Substitute.For <IWalkRepository>();
            _registrationRepository = Substitute.For <IRegistrationRepository>();
            _routeRepository        = Substitute.For <IRouteRepository>();
            _mailService            = Substitute.For <IMailService>();
            _configuration          = Substitute.For <IConfiguration>();
            _trackingHub            = Substitute.For <IHubContext <TrackingHub> >();

            _sut = new WalkController(_userRepository, _walkRepository, _registrationRepository, _routeRepository, _mailService, _configuration, _trackingHub);
        }
Example #9
0
        public override void Respawn()
        {
            SetModel("models/citizen/citizen.vmdl");

            Controller = new WalkController();
            Animator   = new StandardPlayerAnimator();
            Camera     = new FirstPersonCamera();

            EnableAllCollisions       = true;
            EnableDrawing             = true;
            EnableHideInFirstPerson   = true;
            EnableShadowInFirstPerson = true;

            base.Respawn();
        }
Example #10
0
 private void EnsureControllers()
 {
     if (VisionController == null)
     {
         VisionController = FindObjectOfType <VisionController>();
     }
     if (ServerController == null)
     {
         ServerController = FindObjectOfType <ServerController>();
     }
     if (WalkController == null)
     {
         WalkController = FindObjectOfType <WalkController>();
     }
     if (AtmosController == null)
     {
         AtmosController = FindObjectOfType <AtmosController>();
     }
 }
Example #11
0
    private void CreateGeneral()
    {
        GameObject general = Instantiate(GeneralResource, transform) as GameObject;

        general.transform.position = new Vector2(Random.Range(0, 20), Random.Range(0, 20));

        WalkController walkController = general.GetComponent <WalkController>();

        if (walkController == null)
        {
            return;
        }

        walkController.SetPosition(general.transform.position);

        m_CharacterList.Add(walkController);

        FollowTarget = general.transform;
    }
    protected void Start()
    {
        if (this.button == null)
        {
            Debug.LogError("No button assigned", this);
            return;
        }
        if (this.player == null)
        {
            Debug.LogError("No player assigned", this);
            return;
        }

        this.walkController = this.player.GetComponent <WalkController>();
        if (this.walkController == null)
        {
            Debug.LogError("No WalkController assigned to player " + this.player, this);
            return;
        }
    }
    void Spawn(Enemy enemyToSpawn)
    {
        GameObject enemyPrefab = PrefabHolder.Instance.GetEnemy(enemyToSpawn.EnemyType());

        if (enemyPrefab)
        {
            float          t              = Random.Range(0f, 1f);
            Vector3        pointToSpawn   = Vector3.Lerp(leftBorder.position, rightBorder.position, t);
            GameObject     enemy          = animator.CreateObject(enemyPrefab, pointToSpawn, tower);
            WalkController walkController = enemy.GetComponent <WalkController>();
            if (!walkController)
            {
                return;
            }

            enemyToSpawn.EnemyDelegate += OnEnemyGotDamage;
            walkController.Init(tower.localPosition, enemyToSpawn.GetSpeed(), enemyToSpawn.enemyId);
            walkController.SignalOnEnemyDamagedTower.AddListener(OnEnemyWalkedToTower);
            enemies[enemyToSpawn.enemyId] = walkController;
        }
    }
Example #14
0
 private void Construct(WalkController walkController)
 {
     _moveController = walkController;
 }
Example #15
0
        public void DoMove(Direction direction)
        {
            float speed = MoveSpeed;

            if (IsLying)
            {
                return;
            }

            if (!_movementFinished)
            {
                //Debug.Log("Movement not finished!");
                return;
            }

            Vector2Int nextCell = Cell;
            Vector2    shift;

            Rotation = direction;

            switch (direction)
            {
            case Direction.Forward:

                nextCell += Vector2Int.up;
                shift     = Vector2.up;
                break;

            case Direction.Backward:
                nextCell += Vector2Int.down;
                shift     = Vector2.down;
                break;

            case Direction.Left:
                nextCell += Vector2Int.left;
                shift     = Vector2.left;
                break;

            case Direction.Right:
                nextCell += Vector2Int.right;
                shift     = Vector2.right;
                break;

            default:
                throw new ArgumentOutOfRangeException("direction", direction, null);
            }

            if (WalkController.CanPass(nextCell))
            {
                _movementFinished = false;

                Cell = nextCell;
                Vector3Int cell     = new Vector3Int(Cell.x, Cell.y, 0);
                Vector3    offset3d = Grid.CellToWorld(cell) - transform.position;
                Vector2    offset   = new Vector2(offset3d.x, offset3d.y);
                CellOffset = -offset;

                StartCoroutine(AnimateMovement(shift * speed, 1 / speed * Time.deltaTime));
            }
            else // Find a door
            {
                Door door = TileController.Find <Door>(nextCell.x, nextCell.y);

                if (door != null)
                {
                    door.TryToPass();
                }
            }
        }
Example #16
0
 private void Construct(WalkController walkController, MovementController movementController)
 {
     _walkController     = walkController;
     _movementController = movementController;
 }