void OnEnable()
    {
        SerializedObject   serializedObject = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/InputManager.asset")[0]);
        SerializedProperty axesProperty     = serializedObject.FindProperty("m_Axes");

        inputs = new string[axesProperty.arraySize];
        SerializedProperty axisProperty;

        for (int i = 0; i < axesProperty.arraySize; i++)
        {
            axisProperty = axesProperty.GetArrayElementAtIndex(i);
            inputs[i]    = GetChildProperty(axisProperty, "m_Name").stringValue;
        }

        myTarget = (AdvancedController)target;
        for (int i = 0; i < inputs.Length; i++)
        {
            if (inputs[i].Equals(myTarget.HorizontalMoveInput))
            {
                SelectedHorizontalMoveInput = i;
            }
            if (inputs[i].Equals(myTarget.VerticalMoveInput))
            {
                SelectedVerticalMoveInput = i;
            }
            if (inputs[i].Equals(myTarget.JumpInput))
            {
                SelectedJumpInput = i;
            }
            if (inputs[i].Equals(myTarget.FightInput))
            {
                SelectedFightInput = i;
            }
        }
    }
Example #2
0
        public AdvancedControllerTests()
        {
            _apiRegistrationRepositoryMock = new Mock <IApiRegistrationRepository>();
            _cellularExtensionMock         = new Mock <ICellularExtensions>();
            _deviceLogicMock = new Mock <IDeviceLogic>();

            _advancedController = new AdvancedController(
                _deviceLogicMock.Object,
                _apiRegistrationRepositoryMock.Object,
                _cellularExtensionMock.Object);

            _fixture = new Fixture();
        }
Example #3
0
        private void OnTriggerEnter(Collider other)
        {
            if (!isBeingTeleportedTo)
            {
                AdvancedController cc = other.GetComponent <AdvancedController>();
                if (cc)
                {
                    cc.Motor.SetPositionAndRotation(TeleportTo.transform.position, TeleportTo.transform.rotation);

                    if (OnCharacterTeleport != null)
                    {
                        OnCharacterTeleport(cc);
                    }
                    TeleportTo.isBeingTeleportedTo = true;
                }
            }

            isBeingTeleportedTo = false;
        }
        public override void OnException(ExceptionContext filterContext)
        {
            HttpRequestBase richiesta = filterContext.RequestContext.HttpContext.Request;

            if (typeof(System.Data.SqlClient.SqlException).IsAssignableFrom(filterContext.GetType()) ||
                typeof(System.Data.DataException).IsAssignableFrom(filterContext.GetType()))
            {
                // errore di connessione al database, scrivo il log sul file
                Elmah.ErrorSignal.FromCurrentContext().Raise(filterContext.Exception);
            }
            else
            {
                using (DatabaseContext db = new DatabaseContext())
                {
                    db.Database.Connection.Open();
                    LOG_ERRORE logErrore = new LOG_ERRORE();
                    logErrore.ACTION      = filterContext.RouteData.Values["action"].ToString();
                    logErrore.CONTROLLER  = filterContext.RouteData.Values["controller"].ToString();
                    logErrore.PARAMETRI   = System.Web.Helpers.Json.Encode(filterContext.HttpContext.Request.QueryString);
                    logErrore.IP          = richiesta.UserHostAddress;
                    logErrore.MAC_ADDRESS = "";
                    logErrore.SESSIONE    = filterContext.RequestContext.HttpContext.Session.SessionID;
                    logErrore.RICHIESTA   = richiesta.ToString();
                    logErrore.RISPOSTA    = filterContext.HttpContext.Response.ToString();
                    logErrore.ALIAS       = richiesta.UserHostName;
                    if (richiesta.IsAuthenticated)
                    {
                        AdvancedController controller = new AdvancedController();
                        PersonaModel       utente     = filterContext.RequestContext.HttpContext.Session["utente"] as PersonaModel;
                        int  bonus   = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["bonusMessaggioErrore"]);
                        Guid portale = Guid.Parse(System.Configuration.ConfigurationManager.AppSettings["portaleweb"]);
                        logErrore.ID_PERSONA = utente.Persona.ID;
                        controller.AddBonus(db, filterContext.Controller.ControllerContext, utente.Persona, portale, bonus, TipoTransazione.BonusSegnalazioneErrore, App_GlobalResources.Bonus.MessageError);
                    }
                    db.LOG_ERRORE.Add(logErrore);
                    db.SaveChanges();
                }
            }
            base.OnException(filterContext);
        }
 void UnControlGravity(AdvancedController cc)
 {
     cc.Gravity = _savedGravity;
     _characterControllersOnPlanet.Remove(cc);
 }
 void ControlGravity(AdvancedController cc)
 {
     _savedGravity = cc.Gravity;
     _characterControllersOnPlanet.Add(cc);
 }