Inheritance: MonoBehaviour
        private ProcessDefinition ExtractProcessFromCompiledSource(Compilation compilation, string processName)
        {
            var w = new Walk();
            var processType = w.Visit(compilation.SourceModule.GlobalNamespace);

            if (!processType.Any()) return null;

            INamedTypeSymbol processSymbol = null;
            if (string.IsNullOrWhiteSpace(processName))
            {
                processSymbol = processType.FirstOrDefault(x => x.Interfaces.Any(i => i.Name == ProcessIfxName));
            }
            else
            {
                processSymbol = processType.FirstOrDefault(x => x.Name.Contains(processName) && x.Interfaces.Any(i => i.Name == ProcessIfxName));
            }

            if (processSymbol == null)
                return null;

            var p = new ProcessDefinition(processSymbol, ProcessIfxName);
            p.SetStateEnumUsingStrategy(defaultStateDiscoveryStrategy);

            return p;
        }
Example #2
0
	void Awake () {
		inputState = GetComponent<InputState> ();
		walkBehaviour = GetComponent<Walk> ();
		duckBehaviour = GetComponent<Duck> ();
		animator = GetComponent<Animator> ();
		collisionState = GetComponent<CollisionState> ();
	}
Example #3
0
    // Use this for initialization
    void Start()
    {
        _animator = gameObject.GetComponentInChildren<Animator> ();
        w = _animator.GetBehaviour<Walk> ();

        w.Init (velocity, transform);
    }
Example #4
0
 // Use this for initialization
 void Start()
 {
     towerParent = LayerBuildScript.buildLayer.transform;
     walk = GetComponent<Walk>();
     if(target == null | blueprint == null & bit == bitTypes.NONE){
         Destroy(gameObject);
     }
 }
Example #5
0
 void Awake()
 {
     inputState = GetComponent<InputState> ();
     walkBehavior = GetComponent<Walk> ();
     animator = GetComponent<Animator> ();
     collisionState = GetComponent<CollisionState> ();
     shootBehavior = GetComponent<Shoot> ();
 }
Example #6
0
 private void Update()
 {
     if(Input.GetKeyDown(KeyCode.Return))
     {
         line = InputBuffer.GetLineBuffer();
         walk = FindObjectOfType<Walk>();
         if(!walk.walking)
             action.DoAction(line);
     }
 }
Example #7
0
    public void Awake()
    {
        S = this;
        distance = transform.lossyScale.y / 2 + 0.1f;

        r = GetComponent<Rigidbody2D>();
        surfaceMask = 1 << LayerMask.NameToLayer("Terrain") | 1 << LayerMask.NameToLayer("Water");

        Events.Register<OnDeathEvent>(() => { r.velocity = Vector3.zero; });
        doubleJumpSmoke = Resources.Load("Jump Smoke");
    }
Example #8
0
    void Start()
    {
        ++count;
        active = false;

        flame = transform.Find("Flame").gameObject;
        flame.SetActive(false);
        altarLight = transform.Find("Torchlight").gameObject;
        altarLight.SetActive(false);

        // Get references to the different ability scripts
        walk = Walk.S;
        teleport = Teleport.S;
        rewind = Rewind.S;
    }
Example #9
0
    public void Start()
    {
        targetPosition = target.transform.position;
        //Get a reference to the Seeker component we added earlier
        seeker = GetComponent<Seeker>();
        controller = GetComponent<CharacterController>();

        //Start a new path to the targetPosition, return the result to the OnPathComplete function
        seeker.StartPath (transform.position,targetPosition, OnPathComplete);

        //body = GetComponent<BodyScript> ();
        walker = GetComponent<Walk> ();
        if (walker != null) {
            speed = walker.baseSpeed;
        }
    }
Example #10
0
    // Use this for initialization
    void Awake()
    {
        if (!Effects && GetComponent<Effects> ())
            Effects = GetComponent<Effects> ();
        else if (!Effects)
            Effects = (Effects) gameObject.AddComponent<Effects> ();
        EnemyGC2 = enemyGC2;
        DontDestroyOnLoad (gameObject);
        PlayerManager.Players.Add (this);
        Walk = GetComponent<Walk> ();
        Punch = GetComponent<Punch> ();
        Health = GetComponent<Health> ();
        Mana = GetComponent<Mana> ();
        TurnBody = TB;
        TurnHead = TH;
        EnemyLOS = enemyLOS;
        SpawnLOS = spawnLOS;

        walk = Walk;
        health = Health;
        punch = Punch;
        mana = Mana;
    }
Example #11
0
        public void AWalkWithNoTownsHasLength0()
        {
            var sut = new Walk(new List <Town>());

            sut.Length.Should().Be(0);
        }
Example #12
0
 void standOnRightLeg()
 {
     print("changing to RIGHT_STAND...");
     state = Walk.RIGHT_STAND;
 }
Example #13
0
    /// ==============================================
    /// <summary>
    ///
    /// </summary>
    public void UnitCommandRutine()
    {
        if (this.status != PUMStatus.IDLE && this.status != PUMStatus.COMMAND)
        {
            return;
        }

        if (this.selectedUnits.Count == 0)
        {
            return;
        }

        // Empezamos a comandar
        if (Input.GetMouseButtonDown(1))
        {
            this.status = PUMStatus.COMMAND;

            Ray   ray = sceneCamera.ScreenPointToRay(Input.mousePosition);
            float distance;
            groundPlane.Raycast(ray, out distance);

            this.commandPosition = ray.GetPoint(distance);

            var go = Instantiate(this.commandMarkerPrfb, this.commandPosition, Quaternion.identity);

            this.marker = go.GetComponent <CommandMarker>();
        }

        if (this.status == PUMStatus.COMMAND)
        {
            if (Input.GetAxis("Mouse X") != 0 || Input.GetAxis("Mouse Y") != 0)
            {
                Ray   ray = sceneCamera.ScreenPointToRay(Input.mousePosition);
                float distance;
                groundPlane.Raycast(ray, out distance);

                Vector3 point = ray.GetPoint(distance);

                this.marker.RotateTo((point - this.commandPosition).normalized);
                this.commandRotation = this.marker.transform.rotation;
            }
        }

        // Terminamos de comandar
        if (Input.GetMouseButtonUp(1))
        {
            this.status = PUMStatus.IDLE;

            float index = 0;

            foreach (Unit u in this.selectedUnits)
            {
                Vector3 offset = Walk.GetPhyllotaxisOffsetByIndex(index, 2);

                u.ExecuteOrder(this.commandPosition + offset, this.commandRotation);

                index++;
            }

            this.marker.End();
        }
    }
    protected void Awake()
    {
        anim         = GetComponent <Animator>();
        Shaker       = GameObject.FindGameObjectWithTag("Shake");
        maxGrip      = fighter.weight;
        HP           = fighter.HitPoints;
        jumpHeight   = fighter.jumpHeight;
        moveSpeed    = fighter.speed;
        maxJumpCount = fighter.jumpCount;
        rigidBody    = GetComponent <Rigidbody2D>();
        Target       = GameObject.FindGameObjectWithTag("Floor").GetComponent <GravAttractor>();
        Shield       = GetComponentInChildren <Barrier>(true).gameObject;
        if (isPlayer)
        {
            player = ReInput.players.GetPlayer(playerID); //The player controlling this fighter
        }
        gameObject.name = fighter.name.ToString() + playerID;
        statemachine    = new StateMachine();
        var flinch       = new Flinch(this);
        var walk         = new Walk(this);
        var run          = new Run(this);
        var idle         = new Idle(this);
        var jump         = new Jump(this);
        var groundattack = new GroundAttack(this, attack);
        var airattack    = new AirAttack(this, attack);
        var stun         = new Stun(this);
        var leapprep     = new LeapPrep(this);
        var blocking     = new Blocking(this);
        var dodge        = new AirDodge(this);
        var leap         = new Leaping(this);
        var prone        = new Prone(this);

        At(dodge, idle, landed());
        At(flinch, idle, stunless());
        At(run, idle, stop());
        At(walk, idle, stop());
        At(idle, jump, jumping());
        At(idle, jump, unground());
        At(jump, jump, jumping());
        At(walk, jump, unground());
        At(run, jump, unground());
        At(walk, jump, jumping());
        At(run, jump, jumping());
        At(walk, run, running());
        At(run, walk, walking());
        At(idle, walk, walking());
        At(idle, run, running());
        At(idle, groundattack, offensive());
        At(walk, groundattack, offensive());
        At(run, groundattack, offensive());
        At(jump, airattack, offensive());
        At(groundattack, idle, unoffensive());
        At(airattack, jump, unoffensive());
        At(airattack, idle, landed());
        At(jump, airattack, offensive());
        At(jump, idle, landed());
        At(jump, dodge, guard());
        At(blocking, stun, pierce());
        At(idle, blocking, guard());
        At(walk, blocking, guard());
        At(run, blocking, guard());
        At(leapprep, idle, cancelleap());
        At(leapprep, leap, gravityChange());
        At(blocking, idle, unguard());
        At(leap, idle, landed());
        At(prone, idle, stunless());
        statemachine.AddAnyTransition(leapprep, () => LeapPrep && leapCooldown <= 0);
        statemachine.AddAnyTransition(stun, () => stunned);
        statemachine.AddAnyTransition(flinch, () => isDamaged);
        statemachine.AddAnyTransition(prone, () => slam);
        Func <bool> stunless() => () => doneStun == true;
        Func <bool> walking() => () => speed > 0.3 && speed < 0.7;
        Func <bool> running() => () => speed > 0.7;
        Func <bool> stop() => () => speed < 0.3;
        Func <bool> jumping() => () => (jumpTimer > Time.time) && (maxJumpCount > jumpCount) && !action && actionCooldown > 0;
        Func <bool> offensive() => () => attack != null && actionCooldown > 0;
        Func <bool> unoffensive() => () => attack == null;
        Func <bool> landed() => () => grounded;
        Func <bool> pierce() => () => Guard <= 0;
        Func <bool> guard() => () => isBlocking && actionCooldown > 0;
        Func <bool> unguard() => () => !isBlocking;
        Func <bool> gravityChange() => () => LeapRelease;
        Func <bool> cancelleap() => () => cancelled;
        Func <bool> unground() => () => !grounded;

        statemachine.SetState(idle);
    }
Example #15
0
        public async Task <ActionResult <Walk> > PostWalk([FromHeader] string token, [FromHeader] string email, [FromBody] Walk walk)
        {
            // if user not authenticated
            if (!await _walkerRepository.Authenticated(token, email))
            {
                return(Unauthorized());
            }

            if (await _walkRepository.Exists(email))
            {
                return(Conflict());
            }

            Guid guid = Guid.NewGuid();

            walk.Id        = guid.ToString();
            walk.Status    = 0;
            walk.UserEmail = email;
            await _walkRepository.Add(walk);

            walk.WithoutWalkerInfo();
            return(Ok(walk));
        }
Example #16
0
 void Start()
 {
     instance = this;
 }
Example #17
0
        static void Main(string[] args)
        {
            var minx = Walk.MinX(Input.Paths[0], Input.Paths[1]);

            Console.WriteLine($"Min distance: {minx}");
        }
Example #18
0
 void Start()
 {
     speakBehavior = new Meow();
     moveBehavior  = new Walk();
 }
Example #19
0
 // OnStateEnter is called before OnStateEnter is called on any state inside this state machine
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     Debug.Log("We have entered the patrol state");
     walk = animator.gameObject.GetComponent <Walk>();
     walk.SetNextPoint();
 }
Example #20
0
        public override void Update()
        {
            if (ProgramConstants.s_max3DMarkTestDuration != 3)
            {
                ProgramConstants.s_max3DMarkTestDuration = 3;
            }
            CareerStatus status = CareerStatus.Get();

            CareerStatus.State state = CareerStatus.GetState();
            WorkshopController workshopController = WorkshopController.Get();
            ModdedJob          moddedjobs         = new ModdedJob();

            if (!moddedjobs.IsInitialized())
            {
                moddedjobs.OnInit();
            }
            if (Input.GetKeyDown(KeyCode.F))
            {
                if (state.m_cash > 999999)
                {
                    return;
                }
                status.AddCash(999999);
            }

            if (Input.GetKeyDown(KeyCode.G))
            {
                status.AddKudos(150);
            }

            if (Input.GetKeyDown(KeyCode.V))
            {
                this.AddReview(status, state, new ReviewModded());
            }

            if (Input.GetKeyDown(KeyCode.K) || Input.GetKeyDown(KeyCode.LeftShift))
            {
                GameObject obj = GameObject.Find("Player");
                if (obj)
                {
                    Walk w = obj.GetComponent <Walk>();
                    if (w.walkSpeed <= this.walkSpeed)
                    {
                        w.walkSpeed = 3.7f;
                    }
                    else
                    {
                        w.walkSpeed = this.walkSpeed;
                    }
                }
            }
            if (Input.GetKeyUp(KeyCode.LeftShift))
            {
                GameObject obj = GameObject.Find("Player");
                if (obj)
                {
                    Walk w = obj.GetComponent <Walk>();
                    if (w.walkSpeed == 3.7f)
                    {
                        w.walkSpeed = this.walkSpeed;
                    }
                }
            }

            if (Input.GetKeyDown(KeyCode.J))
            {
                if (!multipleJobs)
                {
                    multipleJobs = true;
                    return;
                }
                multipleJobs = false;
            }
            if (state.m_calendar.GetToday() != atualDay && multipleJobs)
            {
                atualDay = state.m_calendar.GetToday();
                for (int i = 0; i < UnityEngine.Random.Range(1, 9); i++)
                {
                    if (i == UnityEngine.Random.Range(0, 9))
                    {
                        moddedjobs.GeneratePreviewJob(status, state);
                        continue;
                    }
                    moddedjobs.GenerateJob(status, state);
                }
            }
        }
        /// <summary>
        /// Main loop for Activity tracking. 
        ///     Start and stops an activity.
        ///     Persists to 
        ///         - SkyDrive 
        ///         - Azure
        ///         - .gpx file viewer
        ///             as determined by SettingsView.xaml
        /// </summary>
        public async void ToggleActivity()
        {
            if (Vm == null)
                Vm = SimpleIoc.Default.GetInstance<Wp8AppHubViewModel>();

            if (isActive)
            {
                Vm.StatusMessages += "ToggleActivity Stop";
                activityTimer.Stop();
                isActive = false;
                _activity.Stop = DateTime.Now;
                activityEnd = _CurrentGeoCoordinate;
                TimeSpan ts = _activity.Stop - _activity.Start;
                var distance = (activityEnd).GetDistanceTo(activityBegin);
                _activity.Distance = distance;
                var distanceInFeet = distance * 3.281;
                var distanceInMiles = distanceInFeet / 5280;

                if (Geos.Count > 0)
                {
                    string skyDriveFileName = "Walker";
                    skyDriveFileName += DateTime.Now.ToString("yyyy-MM-dd-hh-mm");
                    skyDriveFileName += ".gpx";
                    _logger.Log(this, skyDriveFileName);

                    byte[] bytes = Encoding.UTF8.GetBytes(ToGpx());
                    MemoryStream gpxMemoryStream = new MemoryStream(bytes);

                    try
                    {
                        if (_client == null)
                        {
                            // _client = new LiveConnectClient(e.Session);
                            _client = App.LiveConnectClient;
                        }
                        _logger.Log(this, "_client.UploadAsync(MeDetails.TopLevelSkyDriveFolder, skyDriveFileName, gpxMemoryStream,");

                        var result = await _client.UploadAsync(MeDetails.TopLevelSkyDriveFolder, skyDriveFileName, gpxMemoryStream,
                                                OverwriteOption.Overwrite);
                        _logger.Log(this, "Upload to skyDrive apparently worked!", result.ToString());
                        // var success = await Windows.System.Launcher.LaunchFileAsync(ms);
                        // var success = await Windows.System.Launcher.  LaunchFileAsync(ms);
                    }
                    catch (Exception ex)
                    {
                        _logger.Log(this, "Upload to skyDrive exception: ", ex.ToString());
                    }
                    gpxMemoryStream.Dispose();
                    if (_walkerAppSettings.GpxEnabled)
                        LaunchGpxFileAssociation(skyDriveFileName);

                    PersistIt(skyDriveFileName);
                }

                Vm.StatusMessages = string.Empty;
                Vm.StatusMessages += String.Format("Walked: {0:0000.00} meters ({2:00.000} miles) in {1} seconds.\n", distance, ts.ToString(), distanceInMiles);
                Vm.StatusMessages += String.Format("(new calc) Walked: {0:0000.00} meters \n", _CurrentDistance);
                _CurrentDistance = 0;
            }
            else
            {
                Vm.StatusMessages += "ToggleActivity Start";
                StartTimer();
                isActive = true;
                _activity = new Walk();
                _activity.Start = DateTime.Now;
                activityBegin = _CurrentGeoCoordinate;
                
                Geos = new List<GeoCoordinate>();   // clear Geos list as we're starting a new activity track.
                Geos.Add(_CurrentGeoCoordinate);    // Begin activity with current location. 
            }
        }
Example #22
0
        public static void FillWalkFromFormVariables(ref Walk oWalk, NameValueCollection oForm)
        {
            int iLoc           = 0;
            int iWalkTotalTime = 0;

            try {
                oWalk.WalkDate = DateTime.Parse(oForm["WalkDate"]);
            }
            catch (Exception)
            {
                oWalk.WalkDate = DateTime.MinValue;
            }
            oWalk.WalkDescription = oForm["WalkDescription"];
            oWalk.WalkTitle       = oForm["WalkTitle"];
            oWalk.WalkSummary     = oForm["WalkSummary"];
            oWalk.WalkStartPoint  = oForm["WalkStartPoint"];
            oWalk.WalkEndPoint    = oForm["WalkEndPoint"];
            oWalk.WalkType        = oForm["WalkTypes"];
            iLoc = oForm["WalkAreaName"].IndexOf(", Type:");

            if ((iLoc > 0))
            {
                oWalk.WalkAreaName = oForm["WalkAreaName"].Substring(0, iLoc);
            }
            else
            {
                oWalk.WalkAreaName = oForm["WalkAreaName"].Trim();
            }

            try
            {
                oWalk.CartographicLength = double.Parse(oForm["CartographicLength"]);
            }
            catch (Exception)
            {
                oWalk.CartographicLength = null;
            }

            try
            {
                oWalk.MetresOfAscent = Int16.Parse(oForm["MetresOfAscent"]);
            }
            catch (Exception)
            {
                oWalk.MetresOfAscent = null;
            }

            try
            {
                oWalk.WalkAverageSpeedKmh = double.Parse(oForm["WalkAverageSpeedKmh"]);
            }
            catch (Exception)
            {
                oWalk.WalkAverageSpeedKmh = null;
            }

            try
            {
                oWalk.MovingAverageKmh = double.Parse(oForm["MovingAverageKmh"]);
            }
            catch (Exception)
            {
                oWalk.MovingAverageKmh = null;
            }

            oWalk.WalkCompanions = oForm["WalkCompanions"];

            try
            {
                if ((oForm["total_time_hours"] != null && (oForm["total_time_hours"].Length > 0)))
                {
                    iWalkTotalTime = (int.Parse(oForm["total_time_hours"]) * 60);
                }
            }
            catch (Exception)
            {
                iWalkTotalTime = 0;
            }

            try {
                if ((oForm["total_time_mins"] != null && (oForm["total_time_mins"].Length > 0)))
                {
                    iWalkTotalTime = (iWalkTotalTime + int.Parse(oForm["total_time_mins"]));
                }
            }
            catch (Exception)
            {
            }

            if ((iWalkTotalTime > 0))
            {
                oWalk.WalkTotalTime = iWalkTotalTime;
            }

            if (oForm["summary_auto"] != null)
            {
                var oSB = new StringBuilder();
                oSB.Append(oForm["WalkStartPoint"]);
                int  iCounter  = 1;
                bool bContinue = true;
                int  iFirstLocation;
                int  iLastLocation;
                while (bContinue)
                {
                    if ((oForm[("VisitedSummit" + iCounter)] != null &&
                         (oForm[("VisitedSummit" + iCounter)]).Length > 0))
                    {
                        // ----Append {hillname}(classifications) -> -----------
                        if ((oSB.ToString().Length > 0))
                        {
                            oSB.Append(" -> ");
                        }
                        iFirstLocation = oForm[("VisitedSummit" + iCounter)].IndexOf(",");
                        iLastLocation  = oForm[("VisitedSummit" + iCounter)].LastIndexOf(",");
                        if (((iFirstLocation < 0) ||
                             (iLastLocation < 0)))
                        {
                            oSB.Append(oForm[("VisitedSummit" + iCounter)]);
                        }
                        else
                        {
                            oSB.Append((oForm[("VisitedSummit" + iCounter)]).Substring(0, iFirstLocation));
                        }
                        iCounter = (iCounter + 1);
                    }
                    else
                    {
                        bContinue = false;
                    }
                }
                if ((oForm["WalkEndPoint"] != null &&
                     (oForm["WalkEndPoint"].Length > 0)))
                {
                    oSB.Append((" -> " + oForm["WalkEndPoint"]));
                }
                oWalk.WalkSummary = oSB.ToString();
            }
            else
            {
                oWalk.WalkSummary = oForm["WalkSummary"];
            }
            if (oForm["WalkConditions"] != null)
            {
                oWalk.WalkConditions = oForm["WalkConditions"];
            }
        }
Example #23
0
 public void SetUp()
 {
     _randomNumberGenerator = new RandomNumberGenerator();
     _sut = new Walk(_randomNumberGenerator);
 }
Example #24
0
 // Use this for initialization
 void Start()
 {
     state = Walk.STAND;
 }
Example #25
0
 public override void Awake()
 {
     base.Awake();
     walk = GetComponent<Walk>();
 }
Example #26
0
 public void UpdatePosition(Walk step)
 {
     this.Row    += step.Vertical;
     this.Column += step.Horizontal;
 }
Example #27
0
        public List <Walk> GetWalksByWalkerId(int walkerId)
        {
            using (SqlConnection conn = Connection)
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = @"SELECT Walks.Id,
                                               Walks.Date,
                                               Walks.Duration, 
                                               Walks.WalkerId,
                                               Walks.DogId,
                                               Dog.Name,
                                               Dog.OwnerId,
                                               Dog.Breed,
                                               Owner.Name AS OwnerName
                                        FROM Walks 
                                        JOIN Dog ON Dog.Id = Walks.DogId
                                        JOIN Owner ON Dog.OwnerId = Owner.Id
                                        WHERE Walks.WalkerId = @walkerId";

                    cmd.Parameters.AddWithValue("@walkerId", walkerId);

                    SqlDataReader reader = cmd.ExecuteReader();

                    List <Walk> walks = new List <Walk>();

                    while (reader.Read())
                    {
                        Walk walk = new Walk()
                        {
                            Id       = reader.GetInt32(reader.GetOrdinal("Id")),
                            Date     = reader.GetDateTime(reader.GetOrdinal("Date")),
                            Duration = reader.GetInt32(reader.GetOrdinal("Duration")),
                            WalkerId = reader.GetInt32(reader.GetOrdinal("WalkerId")),
                            DogId    = reader.GetInt32(reader.GetOrdinal("DogId"))
                        };
                        Dog dog = new Dog()
                        {
                            Id      = reader.GetInt32(reader.GetOrdinal("DogId")),
                            Name    = reader.GetString(reader.GetOrdinal("Name")),
                            OwnerId = reader.GetInt32(reader.GetOrdinal("OwnerId")),
                            Breed   = reader.GetString(reader.GetOrdinal("Breed"))
                        };

                        walk.Dog = dog;

                        Owner owner = new Owner()
                        {
                            Id   = reader.GetInt32(reader.GetOrdinal("OwnerId")),
                            Name = reader.GetString(reader.GetOrdinal("OwnerName"))
                        };
                        walk.Owner = owner;

                        walks.Add(walk);
                    }

                    reader.Close();

                    return(walks);
                }
            }
        }
Example #28
0
        public async Task <IActionResult> PutWalk([FromHeader] string token, [FromHeader] string email,
                                                  [FromRoute] string id, [FromHeader] bool isUser, [FromBody] Walk walk)
        {
            // if user and not authenticated
            if (isUser && !await _walkerRepository.Authenticated(token, email))
            {
                return(Unauthorized());
            }
            // is safewalker and not authenticated
            else if (!isUser && !await _safewalkerRepository.Authenticated(token, email))
            {
                return(Unauthorized());
            }

            var oldWalk = await _walkRepository.Get(id);

            if (oldWalk == null)
            {
                return(NotFound());
            }

            // Check if person is part of the walk
            if (isUser && oldWalk.UserEmail != email)
            {
                return(Unauthorized());
            }

            // map fields from input walk to existing walk
            if (isUser)
            {
                oldWalk.UserMapFields(walk);
            }
            else
            {
                oldWalk.WalkerEmail = email;
                oldWalk.WalkerMapFields(walk);
            }

            var newWalk = await _walkRepository.Update(oldWalk);

            return(Ok(newWalk));
        }
 public Viking()
 {
     MoveBehavior = new Walk();
 }
        public PacketHandlers()
        {
            setPacketSizes();
            PacketHandler temp;

            temp = new ActionButton();
            handlers.Add(PacketId.CLOSE, temp);         //Close
            handlers.Add(PacketId.ACTIONBUTTON, temp);  //Actionbutton #1
            handlers.Add(PacketId.ACTIONBUTTON2, temp); //Actionbutton #2
            handlers.Add(PacketId.ACTIONBUTTON3, temp); //Actionbutton #3

            temp = new ClientAction();
            handlers.Add(PacketId.IDLE, temp);           //Idle
            handlers.Add(PacketId.MOVE_CAMERA, temp);    //Move camera
            handlers.Add(PacketId.PING, temp);           //Ping
            handlers.Add(PacketId.FOCUS, temp);          //Window focus
            handlers.Add(PacketId.CLICK_MOUSE, temp);    //Mouse
            handlers.Add(PacketId.WINDOW_TYPE, temp);    //Window type
            handlers.Add(PacketId.SOUND_SETTINGS, temp); //Toggle sound (sounds)

            temp = new Command();
            handlers.Add(PacketId.COMMAND, temp); //Commands

            temp = new Communication();
            handlers.Add(PacketId.ADD_FRIEND, temp);       //Add friend
            handlers.Add(PacketId.DELETE_FRIEND, temp);    //Delete friend
            handlers.Add(PacketId.ADD_IGNORE, temp);       //Add ignore
            handlers.Add(PacketId.DELETE_IGNORE, temp);    //Delete ignore
            handlers.Add(PacketId.SEND_PM, temp);          //Send PM
            handlers.Add(PacketId.CLAN_RANKS, temp);       //Set clan ranks
            handlers.Add(PacketId.CLAN_CHAT, temp);        //Join clan chat
            handlers.Add(PacketId.PUBLIC, temp);           //Public chat
            handlers.Add(PacketId.CLAN_KICK, temp);        //Clan chat kick
            handlers.Add(PacketId.PRIVACY_SETTINGS, temp); //public/private/trade chat settings

            temp = new Walk();
            handlers.Add(PacketId.WALK_1, temp); //Walk
            handlers.Add(PacketId.WALK_2, temp); //Walk
            handlers.Add(PacketId.WALK_3, temp); //Walk

            temp = new PlayerInteract();
            handlers.Add(PacketId.ATTACK_PLAYER, temp);   //Attack
            handlers.Add(PacketId.FOLLOW, temp);          //Follow
            handlers.Add(PacketId.TRADE, temp);           //Trade
            handlers.Add(PacketId.MAGIC_ON_PLAYER, temp); //Magic on player

            temp = new NPCInteract();
            handlers.Add(PacketId.NPC_FIRST_CLICK, temp);  //Attack
            handlers.Add(PacketId.NPC_SECOND_CLICK, temp); //Second click
            handlers.Add(PacketId.NPC_THIRD_CLICK, temp);  //Third click
            handlers.Add(PacketId.NPC_FOURTH_CLICK, temp); //Fourth click
            handlers.Add(PacketId.NPC_FIFTH_CLICK, temp);  //Fifth click
            handlers.Add(PacketId.NPC_EXAMINE, temp);      //Examine Npc
            handlers.Add(PacketId.MAGIC_ON_NPC, temp);     //Magic on NPC
            handlers.Add(PacketId.ITEM_ON_NPC, temp);      //Item on NPC


            temp = new ObjectInteract();
            handlers.Add(PacketId.OBJECT_FIRST_CLICK, temp);  //First click
            handlers.Add(PacketId.OBJECT_SECOND_CLICK, temp); //Second click
            handlers.Add(PacketId.OBJECT_THIRD_CLICK, temp);  //Third click
            handlers.Add(PacketId.OBJECT_FOURTH_CLICK, temp); //Fourth click
            handlers.Add(PacketId.OBJECT_FIFTH_CLICK, temp);  //Fifth click
            handlers.Add(PacketId.OBJECT_EXAMINE, temp);      //object examine

            temp = new ItemInteract();
            handlers.Add(PacketId.EQUIP, temp);                   //Equip item
            handlers.Add(PacketId.ITEM_ON_ITEM, temp);            //Item used on item
            handlers.Add(PacketId.INV_CLICK, temp);               //Inventory click item
            handlers.Add(PacketId.ITEM_ON_OBJECT, temp);          //Item used on object
            handlers.Add(PacketId.ITEM_ON_GROUND_ITEM, temp);     //Item used on ground item.
            handlers.Add(PacketId.INV_OPERATE, temp);             //Operate option
            handlers.Add(PacketId.INV_DROP, temp);                //Drop item
            handlers.Add(PacketId.PICKUP, temp);                  //Pick up item
            handlers.Add(PacketId.INV_SWAP_SLOT, temp);           //Swap item slot 1
            handlers.Add(PacketId.INV_SWAP_SLOT2, temp);          //Swap item slot 2
            handlers.Add(PacketId.INV_RIGHT_CLICK_OPTION1, temp); //Right click option 1
            handlers.Add(PacketId.INV_RIGHT_CLICK_OPTION2, temp); //Right click option 2
            handlers.Add(PacketId.INV_EXAMINE_ITEM, temp);        //Inventory item examine
            handlers.Add(PacketId.INV_EXAMINE_ITEM_GE, temp);     //Inventory item examine in GE_SELL_ITEM

            temp = new InterfaceOptions();
            handlers.Add(PacketId.ENTER_AMOUNT, temp);       //Enter amount
            handlers.Add(PacketId.ENTER_TEXT, temp);         // Enter text
            handlers.Add(PacketId.INTERFACE_CLICK_1, temp);  //Option 1
            handlers.Add(PacketId.INTERFACE_CLICK_2, temp);  //Option 2
            handlers.Add(PacketId.INTERFACE_CLICK_3, temp);  //Option 3
            handlers.Add(PacketId.INTERFACE_CLICK_4, temp);  //Option 4
            handlers.Add(PacketId.INTERFACE_CLICK_5, temp);  //Option 5
            handlers.Add(PacketId.INTERFACE_CLICK_6, temp);  //Option 6
            handlers.Add(PacketId.INTERFACE_CLICK_7, temp);  //Option 7
            handlers.Add(PacketId.INTERFACE_CLICK_8, temp);  //Option 8
            handlers.Add(PacketId.INTERFACE_CLICK_9, temp);  //Option 9
            handlers.Add(PacketId.INTERFACE_CLICK_10, temp); //Option 9
            handlers.Add(PacketId.GE_SEARCH, temp);          //Grand exchange search

            temp = new Unused();
            handlers.Add(PacketId.REIGON_LOADING, temp);     //Region loading, varied size
            handlers.Add(PacketId.PACKET_COUNT, temp);       //Sent after any click which increases 'count' in getPackets
            handlers.Add(PacketId.CLIENT_VARIABLE_30, temp); //Sent if a client variable is 30..unknown
            handlers.Add(PacketId.DODGY_PACKET, temp);       //Caused by a dodgy packet

            Console.WriteLine("Binded packetHandlers");
        }
Example #31
0
 void Awake()
 {
     walk = GetComponent <Walk>();
 }
Example #32
0
 // Use this for initialization
 void Start()
 {
     player          = FindObjectOfType <Walk>();
     power           = FindObjectOfType <PowerUps>();
     playerTransform = player.transform;
 }
Example #33
0
 private void Start()
 {
     instance = this;
 }
Example #34
0
 void Start()
 {
     speakBehavior = new Bark();
     moveBehavior  = new Walk();
 }
        public StateController <CharacterState, CharacterContext> BuildCharacterControllerImpl(StateControllerBuilder <CharacterState, CharacterContext> builder)
        {
            Builder = builder;
            InjectState(this);

            // Declare Smash Attacks
            SmashUp.Charge.Data.SmashAttack   = SmashAttack.Charge;
            SmashSide.Charge.Data.SmashAttack = SmashAttack.Charge;
            SmashDown.Charge.Data.SmashAttack = SmashAttack.Charge;

            SmashUp.Attack.Data.SmashAttack   = SmashAttack.Attack;
            SmashSide.Attack.Data.SmashAttack = SmashAttack.Attack;
            SmashDown.Attack.Data.SmashAttack = SmashAttack.Attack;

            // Ground Attacks
            new [] { Idle, Walk, CrouchStart, Crouch, CrouchEnd }
            // Smash Attacks
            .AddTransitions <CharacterState, CharacterContext>(context => {
                var input = context.Input;
                if (!input.Attack.WasPressed)
                {
                    return(null);
                }
                switch (input.Smash.Direction)
                {
                case Direction.Right:
                case Direction.Left:
                    return(SmashSide.Charge);

                case Direction.Up:
                    return(SmashUp.Charge);

                case Direction.Down:
                    return(SmashDown.Charge);
                }
                return(null);
            })
            // Tilt Attacks
            .AddTransitions <CharacterState, CharacterContext>(context => {
                var input = context.Input;
                if (!input.Attack.WasPressed)
                {
                    return(null);
                }
                switch (input.Movement.Direction)
                {
                case Direction.Right:
                case Direction.Left:
                    return(TiltSide);

                case Direction.Up:
                    return(TiltUp);

                case Direction.Down:
                    return(TiltDown);
                }
                return(Neutral);
            });
            SmashUp.Charge.AddTransitionTo(SmashUp.Attack);
            SmashDown.Charge.AddTransitionTo(SmashDown.Attack);
            SmashSide.Charge.AddTransitionTo(SmashSide.Attack);
            TiltDown.AddTransitionTo(Crouch, Input(i => i.Movement.Direction == Direction.Down));
            new[] { Neutral, TiltUp, TiltDown, TiltSide, SmashUp.Attack, SmashDown.Attack, SmashSide.Attack }
            .AddTransitionTo(Idle);

            new [] { Fall, Jump, JumpAerial }
            .AddTransitions(Land, ctx => ctx.IsGrounded)
            // Aerial Attacks
            .AddTransitions <CharacterState, CharacterContext>(context => {
                var input = context.Input;
                if (!input.Attack.WasPressed)
                {
                    return(null);
                }
                switch (input.Movement.Direction)
                {
                case Direction.Right:
                    return(context.Direction >= 0f ? AerialForward : AerialBackward);

                case Direction.Left:
                    return(context.Direction >= 0f ? AerialBackward : AerialForward);

                case Direction.Up:
                    return(AerialUp);

                case Direction.Down:
                    return(AerialDown);
                }
                return(AerialNeutral);
            });
            new[] { AerialForward, AerialBackward, AerialDown, AerialUp, AerialNeutral }
            .AddTransitions(AerialAttackLand, ctx => ctx.IsGrounded)
            .AddTransitionTo(Fall);
            AerialAttackLand.AddTransitionTo(Idle);

            // Aerial Movement
            new [] { Idle, Walk, Dash, Run, RunTurn, RunBrake, CrouchStart, Crouch, CrouchEnd, Shield.Main }
            .AddTransitions(JumpStart, ctx => ctx.Input.Jump.WasPressed && ctx.CanJump);
            new[] { JumpStart, JumpAerial }.AddTransitionTo(Jump);
            new[] { Jump, Fall }.AddTransitions(JumpAerial, ctx => ctx.Input.Jump.WasPressed && ctx.CanJump)
            .AddTransitions(EscapeAir, Input(i => i.Shield.WasPressed));
            Jump.AddTransition(Idle, ctx => ctx.NormalizedStateTime >= 1.0f && ctx.IsGrounded)
            .AddTransition(Fall, ctx => ctx.NormalizedStateTime >= 1.0f && !ctx.IsGrounded);
            EscapeAir.AddTransitionTo(FallHelpless);
            new[] { Fall, FallHelpless, EscapeAir }.AddTransitions(Land, ctx => ctx.IsGrounded);
            Land.AddTransitionTo(Idle);

            Func <Func <PlayerInputContext, DirectionalInput>, Func <CharacterContext, bool> >
            movementContext = func => {
                return(ctx => !DirectionInput(Direction.Down)(ctx) &&
                       Input(i => Mathf.Abs(func(i).Value.x) > DirectionalInput.DeadZone)(ctx));
            };

            // Running States
            Idle.AddTransition(Dash, movementContext(i => i.Smash));
            Dash.AddTransitionTo(Idle, DirectionInput(Direction.Neutral));
            new[] { Dash, RunTurn }.AddTransitionTo(Run);
            Run.AddTransition(RunBrake, DirectionInput(Direction.Neutral));
            Run.AddTransition(RunTurn,
                              ctx => !Mathf.Approximately(Mathf.Sign(ctx.Input.Movement.Value.x), Mathf.Sign(ctx.Direction)));
            RunBrake.AddTransitionTo(Idle);

            // Ground Movement
            new[] { Idle, Walk, Run }
            .AddTransitions(CrouchStart, DirectionInput(Direction.Down))
            .AddTransitions(Fall, ctx => !ctx.IsGrounded);

            Idle.AddTransition(Walk, movementContext(i => i.Movement));
            Walk.AddTransition(Idle, DirectionInput(Direction.Neutral));

            // Crouching States
            CrouchStart.AddTransitionTo(Crouch);
            CrouchEnd.AddTransitionTo(Idle);
            new[] { CrouchStart, Crouch, CrouchEnd }.AddTransitions(Fall, ctx => !ctx.IsGrounded);
            Crouch.AddTransition(CrouchEnd, Input(i => i.Movement.Direction != Direction.Down));

            // Ledge States
            new[] { Idle, Fall, FallHelpless }.AddTransitions(LedgeGrab, ctx => ctx.State.IsGrabbingLedge);
            LedgeGrab.AddTransitionTo(LedgeIdle);
            LedgeIdle.AddTransition(LedgeRelease, ctx => !ctx.State.IsGrabbingLedge)
            .AddTransition(LedgeClimb, DirectionInput(Direction.Up))
            .AddTransition(LedgeJump, ctx => ctx.Input.Jump.WasPressed && ctx.CanJump)
            .AddTransition(LedgeAttack, Attack());
            LedgeJump.AddTransitionTo(Jump);
            new[] { LedgeRelease, LedgeClimb, LedgeEscape, LedgeAttack }
            .AddTransitions(Idle, ctx => ctx.NormalizedStateTime >= 1.0f && ctx.IsGrounded)
            .AddTransitions(Fall, ctx => ctx.NormalizedStateTime >= 1.0f && !ctx.IsGrounded);

            // Shielding
            Idle.AddTransition(Shield.On, Input(i => i.Shield.Current));
            Shield.On.AddTransition(Shield.Perfect, ctx => ctx.State.IsHit)
            .AddTransitionTo(Shield.Main);
            Shield.Main.AddTransition(Shield.Broken, ctx => ctx.State.ShieldDamage <= 0)
            .AddTransition(Shield.Off, Input(i => !i.Shield.Current));
            Shield.Off.AddTransitionTo(Idle);
            new[] { Shield.Broken, Shield.Stunned, Idle }.Chain();

            // Rolls/Sidesteps
            Shield.Main
            .AddTransition(EscapeForward, ctx => {
                if (ctx.Direction > 0f)
                {
                    return(DirectionalSmash(Direction.Right)(ctx));
                }
                else
                {
                    return(DirectionalSmash(Direction.Left)(ctx));
                }
            })
            .AddTransition(EscapeBackward, ctx => {
                if (ctx.Direction > 0f)
                {
                    return(DirectionalSmash(Direction.Left)(ctx));
                }
                else
                {
                    return(DirectionalSmash(Direction.Right)(ctx));
                }
            })
            .AddTransition(Escape, DirectionInput(Direction.Down));
            new[] { Escape, EscapeForward, EscapeBackward }.AddTransitionTo(Shield.Main);

            Builder.WithDefaultState(Idle);
            BuildCharacterController();
            return(Builder.Build());
        }
Example #36
0
    // Use this for initialization
    void Start()
    {
        walk = GetComponent<Walk>();

        walk.enabled = true;

        Events.Register<OnDeathEvent>(OnReset);
        Events.Register<OnPauseEvent>(OnPause);
    }
Example #37
0
 // Use this for initialization
 void Start()
 {
     hitSounds = GetComponents<AudioSource> ();
     walk = GetComponent<Walk> ();
 }
Example #38
0
 public Viking()
 {
     Position     = 0;
     MoveBehavior = new Walk();
 }
Example #39
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     prefab   = Resources.Load("PlayerPrefab") as GameObject;
 }
Example #40
0
    void Awake()
    {
        S = this;

        Reset();
        Toggle(false);

        r = GetComponent<Rigidbody2D>();
        walk = gameObject.GetComponent<Walk>();
        teleportAudio = GetComponent<AudioSource>();
        teleportAudio.volume = 0.6f;

        dashIndicator = GameObject.Find("Dash Indicator");
        poof = (GameObject)Resources.Load("Poof");

        dashIndicator.SetActive(false);

        Events.Register<OnResetEvent>(Reset);
        Events.Register<OnDeathEvent>(Reset);
        Events.Register<OnPauseEvent>(Pause);
    }
Example #41
0
 // Use this for initialization
 void Start()
 {
     player = FindObjectOfType <Walk>();
 }
Example #42
0
        public PacketHandlers()
        {
            setPacketSizes();
            PacketHandler temp;

            temp = new ActionButton();
            handlers.Add(PacketId.CLOSE, temp); //Close
            handlers.Add(PacketId.ACTIONBUTTON, temp); //Actionbutton #1
            handlers.Add(PacketId.ACTIONBUTTON2, temp); //Actionbutton #2
            handlers.Add(PacketId.ACTIONBUTTON3, temp); //Actionbutton #3

            temp = new ClientAction();
            handlers.Add(PacketId.IDLE, temp); //Idle
            handlers.Add(PacketId.MOVE_CAMERA, temp); //Move camera
            handlers.Add(PacketId.PING, temp); //Ping
            handlers.Add(PacketId.FOCUS, temp); //Window focus
            handlers.Add(PacketId.CLICK_MOUSE, temp); //Mouse
            handlers.Add(PacketId.WINDOW_TYPE, temp); //Window type
            handlers.Add(PacketId.SOUND_SETTINGS, temp); //Toggle sound (sounds)

            temp = new Command();
            handlers.Add(PacketId.COMMAND, temp); //Commands

            temp = new Communication();
            handlers.Add(PacketId.ADD_FRIEND, temp); //Add friend
            handlers.Add(PacketId.DELETE_FRIEND, temp); //Delete friend
            handlers.Add(PacketId.ADD_IGNORE, temp); //Add ignore
            handlers.Add(PacketId.DELETE_IGNORE, temp); //Delete ignore
            handlers.Add(PacketId.SEND_PM, temp); //Send PM
            handlers.Add(PacketId.CLAN_RANKS, temp); //Set clan ranks
            handlers.Add(PacketId.CLAN_CHAT, temp); //Join clan chat
            handlers.Add(PacketId.PUBLIC, temp); //Public chat
            handlers.Add(PacketId.CLAN_KICK, temp); //Clan chat kick
            handlers.Add(PacketId.PRIVACY_SETTINGS, temp); //public/private/trade chat settings

            temp = new Walk();
            handlers.Add(PacketId.WALK_1, temp); //Walk
            handlers.Add(PacketId.WALK_2, temp); //Walk
            handlers.Add(PacketId.WALK_3, temp); //Walk

            temp = new PlayerInteract();
            handlers.Add(PacketId.ATTACK_PLAYER, temp); //Attack
            handlers.Add(PacketId.FOLLOW, temp); //Follow
            handlers.Add(PacketId.TRADE, temp); //Trade
            handlers.Add(PacketId.MAGIC_ON_PLAYER, temp); //Magic on player

            temp = new NPCInteract();
            handlers.Add(PacketId.NPC_FIRST_CLICK, temp); //Attack
            handlers.Add(PacketId.NPC_SECOND_CLICK, temp); //Second click
            handlers.Add(PacketId.NPC_THIRD_CLICK, temp); //Third click
            handlers.Add(PacketId.NPC_FOURTH_CLICK, temp); //Fourth click
            handlers.Add(PacketId.NPC_FIFTH_CLICK, temp); //Fifth click
            handlers.Add(PacketId.NPC_EXAMINE, temp); //Examine Npc
            handlers.Add(PacketId.MAGIC_ON_NPC, temp); //Magic on NPC
            handlers.Add(PacketId.ITEM_ON_NPC, temp); //Item on NPC

            temp = new ObjectInteract();
            handlers.Add(PacketId.OBJECT_FIRST_CLICK, temp); //First click
            handlers.Add(PacketId.OBJECT_SECOND_CLICK, temp); //Second click
            handlers.Add(PacketId.OBJECT_THIRD_CLICK, temp); //Third click
            handlers.Add(PacketId.OBJECT_FOURTH_CLICK, temp); //Fourth click
            handlers.Add(PacketId.OBJECT_EXAMINE, temp); //object examine

            temp = new ItemInteract();
            handlers.Add(PacketId.EQUIP, temp); //Equip item
            handlers.Add(PacketId.ITEM_ON_ITEM, temp); //Item used on item
            handlers.Add(PacketId.INV_CLICK, temp); //Inventory click item
            handlers.Add(PacketId.ITEM_ON_OBJECT, temp); //Item used on object
            handlers.Add(PacketId.ITEM_ON_GROUND_ITEM, temp); //Item used on ground item.
            handlers.Add(PacketId.INV_OPERATE, temp); //Operate option
            handlers.Add(PacketId.INV_DROP, temp); //Drop item
            handlers.Add(PacketId.PICKUP, temp); //Pick up item
            handlers.Add(PacketId.INV_SWAP_SLOT, temp); //Swap item slot 1
            handlers.Add(PacketId.INV_SWAP_SLOT2, temp); //Swap item slot 2
            handlers.Add(PacketId.INV_RIGHT_CLICK_OPTION1, temp); //Right click option 1
            handlers.Add(PacketId.INV_RIGHT_CLICK_OPTION2, temp); //Right click option 2
            handlers.Add(PacketId.INV_EXAMINE_ITEM, temp); //Inventory item examine

            temp = new InterfaceOptions();
            handlers.Add(PacketId.ENTER_AMOUNT, temp); //Enter amount
            handlers.Add(PacketId.ENTER_TEXT, temp); // Enter text
            handlers.Add(PacketId.INTERFACE_CLICK_1, temp); //Option 1
            handlers.Add(PacketId.INTERFACE_CLICK_2, temp); //Option 2
            handlers.Add(PacketId.INTERFACE_CLICK_3, temp); //Option 3
            handlers.Add(PacketId.INTERFACE_CLICK_4, temp); //Option 4
            handlers.Add(PacketId.INTERFACE_CLICK_5, temp); //Option 5
            handlers.Add(PacketId.INTERFACE_CLICK_6, temp); //Option 6
            handlers.Add(PacketId.INTERFACE_CLICK_7, temp); //Option 7
            handlers.Add(PacketId.INTERFACE_CLICK_8, temp); //Option 8
            handlers.Add(PacketId.INTERFACE_CLICK_9, temp); //Option 9
            handlers.Add(PacketId.INTERFACE_CLICK_10, temp); //Option 9
            handlers.Add(PacketId.GE_SEARCH, temp); //Grand exchange search

            temp = new Unused();
            handlers.Add(PacketId.REIGON_LOADING, temp); //Region loading, varied size
            handlers.Add(PacketId.PACKET_COUNT, temp); //Sent after any click which increases 'count' in getPackets
            handlers.Add(PacketId.CLIENT_VARIABLE_30, temp); //Sent if a client variable is 30..unknown
            handlers.Add(PacketId.DODGY_PACKET, temp); //Caused by a dodgy packet

            Console.WriteLine("Binded packetHandlers");
        }
 private void Start()
 {
     this.health     = GetComponent <Health>();
     this.walk       = GetComponent <Walk>();
     this.controller = ReInput.players.GetPlayer(0);
 }
Example #44
0
 private void Awake()
 {
     anim = new Anim(animator);
     move = new Vector2();
     walk = new Walk(5);
 }
Example #45
0
 void righUpLegLiftedFront()
 {
     print("changing to RIGHT_STEP_MID_LEG...");
     state = Walk.RIGHT_STEP_MID_LEG;
 }
 public Viking()
 {
     MoveBehavior = new Walk();
 }
Example #47
0
 void rightMidLegOnPosition()
 {
     print("changing to RIGHT_LEG_DOWN...");
     state = Walk.RIGHT_LEG_DOWN;
 }