Example #1
0
 /// ステータスをOpenにする.
 public void Open(ANode parent, int cost)
 {
     //Debug.Log (string.Format("Open: ({0},{1})", X, Y));
     _status = eStatus.Open;
     _cost   = cost;
     _parent = parent;
 }
        // mode 2
        internal static void AllLicensePlateMode()
        {
            eStatus       sortBy              = eStatus.None;
            StringBuilder licenseNumbersStr   = new StringBuilder();
            string        getLicensePlatesMsg = @"
please pick a status mode to sort the license plate numbers by:
{0}";
            string        successMsg          = @"
The license numbers requested are:
{0}";
            string        failMsg             = @"
No license numbers found";

            getLicensePlatesMsg = string.Format(getLicensePlatesMsg, buildMenuFromEnum(typeof(eStatus)));
            Console.WriteLine(getLicensePlatesMsg);
            sortBy = GetInput.GetVehicleStatus(false);
            List <string> licenseNumbersList = s_Garage.GetAllLicensePlates(sortBy);

            foreach (string licenseNumber in licenseNumbersList)
            {
                licenseNumbersStr.Append(licenseNumber);
                licenseNumbersStr.Append(Environment.NewLine);
            }

            successMsg = string.Format(successMsg, licenseNumbersStr);
            Console.WriteLine(licenseNumbersStr.Length > 0 ? successMsg : failMsg);
        }
Example #3
0
        /// <summary>
        /// gets the line params from ui and calls the add line in server using http
        /// </summary>
        /// <returns>if succeeded return the line, if not throws exception</returns>
        public Line AddLine(int clientId, string number, eStatus status)
        {
            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(url);
                    var    line   = new Line(clientId, number, status);
                    string json   = JsonConvert.SerializeObject(line);
                    var    result = client.PostAsync("api/crm/line", new StringContent(json, System.Text.Encoding.UTF8, "application/json")).Result;

                    if (result.IsSuccessStatusCode)
                    {
                        string response = result.Content.ReadAsStringAsync().Result;
                        return(JsonConvert.DeserializeObject <Line>(response));
                    }
                    else
                    {
                        throw new Exception(result.Content.ReadAsStringAsync().Result);
                    }
                }
            }
            catch (Exception e)
            {
                log.LogWrite("Add line error: " + e.Message);
                throw new Exception(e.Message);
            }
        }
Example #4
0
        /// <summary>
        /// update line status fields - gets status from ui and calls the server using http
        /// </summary>
        /// <returns>if succeeded return the line, if not throws exception</returns>
        public Line UpdateLineStatus(int lineId, eStatus status)
        {
            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(url);
                    var    line   = lineId;
                    string json   = JsonConvert.SerializeObject(line);
                    var    result = client.PutAsync("api/crm/line/" + status, new StringContent(json, System.Text.Encoding.UTF8, "application/json")).Result;

                    if (result.IsSuccessStatusCode)
                    {
                        string response = result.Content.ReadAsStringAsync().Result;
                        return(JsonConvert.DeserializeObject <Line>(response));
                    }
                    else
                    {
                        throw new Exception("update line status not successs");
                    }
                }
            }
            catch (Exception e)
            {
                log.LogWrite("Update line bl error: " + e.Message);
                throw new Exception("Update line exception: " + e.Message);
            }
        }
Example #5
0
 public GarageCard(string i_OwnersName, string i_PhoneNumber, Vehicle i_CarToFix)
 {
     r_OwnersName     = i_OwnersName;
     r_PhoneNumber    = i_PhoneNumber;
     m_VehicleToFix   = i_CarToFix;
     m_StatusInGarage = eStatus.InRepair;
 }
Example #6
0
 public void ResetAgentStatus(eStatus status)
 {
     if (status == eStatus.FailedToStart)
     {
         IsFailedToStart = false;
     }
 }
Example #7
0
 public Vehicle(string i_ModelName, string i_LicenseNumber)
 {
     m_LicenseNumber = i_LicenseNumber;
     m_ModelName     = i_ModelName;
     m_TireDetails   = new List <Tire>();
     m_Status        = eStatus.InRepair;
 }
Example #8
0
 public void SetAllStatus(eStatus status)
 {
     for (int i = 0; i < this.Status.Length; i++)
     {
         this.Status[i] = status;
     }
 }
Example #9
0
        public static void Write(eStatus status, string json, HttpResponse Response)
        {
            var sResp = new ServiceResponse();

            sResp._Status = status;
            switch (sResp._Status)
            {
            case eStatus.eResponseOK:
                sResp._StatusDesc = "Ok";
                break;

            case eStatus.eErrorUnknow:
                sResp._StatusDesc = "Error desconocido.";
                break;

            case eStatus.eErrorParams:
                sResp._StatusDesc = "Error al procesar los parametros enviados.";
                break;

            case eStatus.eErrorAuthentication:
                sResp._StatusDesc = "Error al autenticar las credenciales del usuario.";
                break;

            case eStatus.eErrorProcess:
                sResp._StatusDesc = "Error al procesar la solicitud.";
                break;
            }
            CCryptorEngine cryp = new CCryptorEngine();

            sResp._Json = cryp.Encriptar(json);
            Response.Write(JsonConvert.SerializeObject(sResp));
        }
 public GarageCustomer(Vehicle vehicle, string ownerName, string phoneNumber, eStatus status)
 {
     this.vehicle     = vehicle;
     this.ownerName   = ownerName;
     this.phoneNumber = phoneNumber;
     this.status      = status;
 }
Example #11
0
        private eStatus getFilterBy()
        {
            eStatus    filterBy          = eStatus.None;
            const bool v_IgnoreCase      = true;
            bool       parsedSuccesfully = false;

            Console.WriteLine();
            Console.Write("Filter by: ");

            while (!parsedSuccesfully)
            {
                string filterByStr = Console.ReadLine();

                if (string.IsNullOrEmpty(filterByStr))
                {
                    Console.WriteLine("Please enter a non-empty string. Try again");
                }
                else
                {
                    try
                    {
                        filterBy          = (eStatus)Enum.Parse(typeof(eStatus), filterByStr, v_IgnoreCase);
                        parsedSuccesfully = true;
                    }
                    catch (ArgumentException)
                    {
                        Console.WriteLine("Invalid input! Try again");
                    }
                }
            }

            return(filterBy);
        }
Example #12
0
        private void printList(Dictionary <string, string> i_Dict)
        {
            try
            {
                string          filter;
                bool            doFilter = i_Dict.TryGetValue("-filter", out filter);
                List <string[]> results  = null;
                if (doFilter)
                {
                    eStatus status = parseToStatus(filter);
                    results = manager.list(status);
                }
                else
                {
                    results = manager.list();
                }

                StringBuilder sb = new StringBuilder();
                sb.Append(string.Format("{0,0}, {1,6} {2}", "Id", "Status", m_NL));
                foreach (string[] entry in results)
                {
                    sb.Append(string.Format("{0,0}, {1,6}", entry[0], entry[1]));
                    sb.Append(m_NL);
                }

                wl(sb.ToString());
            }
            catch (Exception e)
            {
                wl(e.Message);
            }
        }
Example #13
0
        public eStatus Retrieve()
        {
            eStatus status = eStatus.UnknownError;

            try
            {
                string sMobileNumber = "";
                string sPagerNumber  = "";

                bool bSuccess = GetAlternateNumbersFromDB(out sMobileNumber, out sPagerNumber);

                if (!bSuccess)
                {
                    status = eStatus.DBError;
                }
                else
                {
                    m_sMobileNumber = sMobileNumber;
                    m_sPagerNumber  = sPagerNumber;
                    status          = eStatus.Success;
                }
            }
            catch (Exception exc)
            {
                Console.Error.WriteLine(DateTime.Now.ToString() + " AlternateNumbers.Retrieve exception: " + exc.ToString());
            }

            return(status);
        }
Example #14
0
 public VehicleCard(string i_OwnerName, string i_OwnerPhone, Vehicle i_Vehicle)
 {
     m_VehicleStatus = eStatus.InRepair;
     r_OwnerName     = i_OwnerName;
     r_OwnerPhone    = i_OwnerPhone;
     m_Vehicle       = i_Vehicle;
 }
Example #15
0
 public Treatment(Vehicle i_NewVehcile, string i_OwnerName, string i_OwnerPhone)
 {
     m_OwnerName  = i_OwnerName;
     m_OwnerPhone = i_OwnerPhone;
     m_Vehicle    = i_NewVehcile;
     m_Status     = eStatus.InTreatment;
 }
Example #16
0
        public void LoadUcGame(string folderPath)
        {
            eColor  tmpec = new eColor();
            eStatus tmpes = new eStatus();

            List <ccCard> curCards = new List <ccCard> {
            };
            //InitializNamesAttrib();
            // מתוך הנחה שמדובר במקסימום 2 שחקנים אז התור הקודם הוא או 1 או 0
            int beforeTurn = turn == 0 ? 1 : 0;

            //XDocument doc = XDocument.Load(path + "\\" + folderPath + "\\lastGame.xml");// לא בטוח טוב
            XDocument doc  = XDocument.Load(folderPath + ".xml");
            var       prop = doc.Element("properties");

            // שליפת התור הנוכחי
            turn = (int)prop.Attribute("turn");

            // שליפת אבני הקופה
            box.Clear();  //ריקון אבני הקופה כדי לאתחלה לפי המשחק השמור
            foreach (XElement crd in prop.Element("box").Elements())
            {
                int    curNum   = (int)crd.Attribute("number");
                string curColor = (string)crd.Attribute("color");
                string stt      = (string)crd.Attribute("status");
                tmpec = ToEColor(curColor);
                tmpes = ToEStatus(stt);
                box.Add(new ccCard((byte)curNum, tmpec, tmpes));
            }

            // שליפת לוח המשחק
            if (mainBoard.Count > 0)
            {
                mainBoard.Clear(); //ריקון לוח המשחק כדי לאתחלה לפי המשחק השמור
            }
            else
            {
                mainBoard = new List <List <ccCard> > {
                }
            };
            foreach (XElement seria in prop.Element("mainBoard").Elements())
            {
                List <ccCard> tmp = new List <ccCard> {
                };
                int i             = 0;

                foreach (XElement crd in seria.Elements())
                {
                    int    curNum   = (int)crd.Attribute("number");
                    string curColor = (string)crd.Attribute("color");
                    string stt      = (string)crd.Attribute("status");
                    tmpec = ToEColor(curColor);
                    tmpes = ToEStatus(stt);
                    tmp.Add(new ccCard((byte)curNum, tmpec, tmpes));
                }
                mainBoard.Add(tmp);
                i++;
            }
            //Show_Cards();
        }
Example #17
0
    // Update is called once per frame
    void Update()
    {
        switch (m_Status)
        {
        case eStatus.eTutorial:
            UpdateTutorial();
            break;

        case eStatus.ePlay:
            UpdatePlay();
            break;

        case eStatus.eGameOver:
            UpdateGameover();
            break;

        case eStatus.eStageClear:
            UpdateStageClear();
            break;

        case eStatus.eRanking:
            UpdateRanking();
            break;

        case eStatus.eNextStage:
            m_Status = eStatus.ePlay;
            break;

        case eStatus.eNameInput:
            UpdateNameInput();
            break;
        }
    }
 public VehicleInGarage(string i_OwnerName, string i_PhoneNumber, Vehicle i_Vehicle)
 {
     this.r_OwnerName   = i_OwnerName;
     this.r_PhoneNumber = i_PhoneNumber;
     this.r_Vehicle     = i_Vehicle;
     this.m_Status      = eStatus.InRepair;
 }
Example #19
0
        private void button_Click(object sender, EventArgs e)
        {
            if (!r_Game.GameOver)
            {
                ListenerButton buttonClicked = sender as ListenerButton;
                buttonClicked.Click -= new System.EventHandler(button_Click);
                buttonClicked.Click += new System.EventHandler(button_SecondClick);
                if (!m_IsFromButtonClicked)
                {
                    buttonClicked.BackColor = Color.LightBlue;
                    m_From                = buttonClicked.Position;
                    fromButton            = buttonClicked;
                    m_IsFromButtonClicked = true;
                }
                else
                {
                    m_To   = buttonClicked.Position;
                    m_Step = new Step(m_From, m_To);
                    m_IsFromButtonClicked = false;
                    buttonClicked.PerformClick();
                    fromButton.PerformClick();

                    m_Status = r_Game.TakeAction(m_Step);
                    checkStatus();
                    checkValidSteps();
                }
            }
            else
            {
                checkValidSteps();
            }
        }
 void updateConnectStatus(eStatus iState)
 {
     Application.SynchronizationContext.Post(_ => {
         /* invoked on UI thread */
         MainActivity.onConnectStatusChanged(iState);
     }, null);
 }
Example #21
0
 public VehicleTreatmentStatus(Vehicle i_Vehcile, string i_OwnerName, string i_OwnerPhone)
 {
     m_Vehicle    = i_Vehcile;
     m_Status     = eStatus.InTreatment;
     m_OwnerName  = i_OwnerName;
     m_OwnerPhone = i_OwnerPhone;
 }
    void CallEndStatus(InputStatusMonitor inputStatusMonitor, eStatus NewStatus)
    {
        eStatus OldStatus = inputStatusMonitor.Status;

        inputStatusMonitor.Status = NewStatus;
        switch (OldStatus)
        {
        case eStatus.free:
        {
            PointerDown(inputStatusMonitor);
            break;
        }

        case eStatus.holding:
        {
            PointerHoldEnd(inputStatusMonitor);
            break;
        }

        case eStatus.swiping:
        {
            PointerSwipeEnd(inputStatusMonitor);
            break;
        }
        }

        return;
    }
Example #23
0
        public void CheckWhoWin()
        {
            switch (m_Players[0].Status)
            {
            case Player.ePlayerStatus.QUIT:
                m_Status = eStatus.PLAYER_2_WIN;
                break;

            case Player.ePlayerStatus.CAN_NOT_MOVE:
                if (m_Players[1].Status == Player.ePlayerStatus.CAN_NOT_MOVE)
                {
                    m_Status = eStatus.TIE;
                }
                else
                {
                    m_Status = eStatus.PLAYER_2_WIN;
                }

                break;

            case Player.ePlayerStatus.ACTIVE:
                m_Status = eStatus.PLAYER_1_WIN;
                break;
            }

            OnStatusChanged();
        }
        /// <summary>
        /// Player receives this item (added to players inventory)
        /// </summary>
        /// <param name="player"></param>
        public override void OnReceive(GamePlayer player)
        {
            // for guild banners we don't actually add it to inventory but instead register
            // if it is rescued by a friendly player or taken by the enemy

            player.Inventory.RemoveItem(this);

            int    trophyModel = 0;
            eRealm realm       = eRealm.None;

            switch (Model)
            {
            case 3223:
                trophyModel = 3359;
                realm       = eRealm.Albion;
                break;

            case 3224:
                trophyModel = 3361;
                realm       = eRealm.Midgard;
                break;

            case 3225:
                trophyModel = 3360;
                realm       = eRealm.Hibernia;
                break;
            }

            // if picked up by an enemy then turn this into a trophy
            if (realm != player.Realm)
            {
                ItemUnique template = new ItemUnique(Template);
                template.ClassType        = "";
                template.Model            = trophyModel;
                template.IsDropable       = true;
                template.IsIndestructible = false;

                GameServer.Database.AddObject(template);
                GameInventoryItem trophy = new GameInventoryItem(template);
                player.Inventory.AddItem(eInventorySlot.FirstEmptyBackpack, trophy);
                OwnerGuild.SendMessageToGuildMembers(player.Name + " of " + GlobalConstants.RealmToName(player.Realm) + " has captured your guild banner!", eChatType.CT_Guild, eChatLoc.CL_SystemWindow);
                OwnerGuild.GuildBannerLostTime = DateTime.Now;
            }
            else
            {
                m_status = eStatus.Recovered;

                // A friendly player has picked up the banner.
                if (OwnerGuild != null)
                {
                    OwnerGuild.SendMessageToGuildMembers(player.Name + " has recovered your guild banner!", eChatType.CT_Guild, eChatLoc.CL_SystemWindow);
                }

                if (SummonPlayer != null)
                {
                    SummonPlayer.GuildBanner = null;
                }
            }
        }
Example #25
0
        public eStatus Save()
        {
            eStatus status = eStatus.UnknownError;

            try
            {
                // Only bother to try and save the numbers if at least one of them is valid.

                if (m_bValidMobileNumber || m_bValidPagerNumber)
                {
                    string sMobileNumberInDB = "";
                    string sPagerNumberInDB  = "";

                    bool bSuccess = GetAlternateNumbersFromDB(out sMobileNumberInDB, out sPagerNumberInDB);

                    if (!bSuccess)
                    {
                        status = eStatus.DBError;
                    }
                    else
                    {
                        status = eStatus.Success;

                        if (m_bValidMobileNumber)
                        {
                            bSuccess &= ProcessNumber(m_csMobileParamName, m_sMobileNumber, sMobileNumberInDB);
                        }
                        else
                        {
                            status = eStatus.InvalidMobile;
                        }

                        if (m_bValidPagerNumber)
                        {
                            bSuccess &= ProcessNumber(m_csPagerParamName, m_sPagerNumber, sPagerNumberInDB);
                        }
                        else
                        {
                            status = eStatus.InvalidPager;
                        }
                    }

                    if (!bSuccess)
                    {
                        status = eStatus.DBError;
                    }
                }
                else
                {
                    status = eStatus.InvalidMobile | eStatus.InvalidPager;
                }
            }
            catch (Exception exc)
            {
                Console.Error.WriteLine(DateTime.Now.ToString() + " AlternateNumbers.Save exception: " + exc.ToString());
            }

            return(status);
        }
Example #26
0
 public void Resume()
 {
     mStatus = mPreStatus;
     if (mTask != null)
     {
         mTask.Resume();
     }
 }
Example #27
0
 private void ManageCallHistoryStatus(eStatus Status)
 {
     new CallHistory()
     {
         CallHistoryId = lblCallHistoryId.zToInt(),
         eStatus       = (int)Status
     }.Update();
 }
Example #28
0
 public SensorAlarm(SerializationInfo info, StreamingContext ctxt)
 {
     m_Status     = (eStatus)AuxiliaryLibrary.Tools.IO.GetSerializationValue <eStatus>(ref info, "m_Status");
     m_PrevStatus = (eStatus)AuxiliaryLibrary.Tools.IO.GetSerializationValue <eStatus>(ref info, "m_PrevStatus");
     Enabled      = (bool)AuxiliaryLibrary.Tools.IO.GetSerializationValue <bool>(ref info, "Enabled");
     LowAlarm     = (double)AuxiliaryLibrary.Tools.IO.GetSerializationValue <double>(ref info, "LowAlarm");
     HighAlarm    = (double)AuxiliaryLibrary.Tools.IO.GetSerializationValue <double>(ref info, "HighAlarm");
 }
Example #29
0
 private void Initialize(GenericSensor i_Parent)
 {
     this.m_Parent = i_Parent;
     LowAlarm      = double.MinValue;
     HighAlarm     = double.MaxValue;
     Status        = default(eStatus);
     m_DelayTimer  = new Timer(new TimerCallback(notifyStatusChange));
 }
 private void ManageOrganizationStatus(eStatus Status)
 {
     new Organization()
     {
         OrganizationId = lblOrganizationId.zToInt(),
         eStatus        = (int)Status
     }.Update();
 }
Example #31
0
 // Use this for initialization
 void Start()
 {
     status = eStatus.Free;
     player = GameObject.Find( "Player" );
     if (player)
         charscript = player.GetComponent<CharMover>();
     jar = GameObject.Find( "Jar" );
     if (jar)
         jarscript = jar.GetComponent<JarScript>();
 }
Example #32
0
 public void Read(NetIncomingMessage msg)
 {
     Status = (eStatus)msg.ReadByte();
     PositionX = msg.ReadFloat();
     PositionY = msg.ReadFloat();
     Rotation = msg.ReadFloat();
     LocalVelocityX = msg.ReadFloat();
     LocalVelocityY = msg.ReadFloat();
     InputTurn = msg.ReadFloat();
     InputForward = msg.ReadFloat();
     InputBackward = msg.ReadFloat();
 }
Example #33
0
File: GJK.cs Project: himapo/ccm
 private void Constructor()
 {
     m_ray = new btVector3(0, 0, 0);
     m_nfree = 0;
     m_status = eStatus.Failed;
     m_current = 0;
     m_distance = 0;
     for (int i = 0; i < m_simplices.Length; i++)
         m_simplices[i].Constructor();
     for (int i = 0; i < m_store.Length; i++)
         m_store[i].Constructor();
 }
        public override void Show_EventMsg(string Msg, eStatus Status)
        {
            switch (Status)
            {
                case eStatus.Event_Info:
                    this.Img_Event.ImageUrl = "~/Images/cp_Msgbox_Info.gif";
                    break;
                case eStatus.Event_Error:
                    this.Img_Event.ImageUrl = "~/Images/cp_error01.gif";
                    break;
            }

            this.Lbl_EventMsg.Text = Msg;
            this.Panel_Event.Visible = true;
        }
Example #35
0
		public void Initialize()
		{
			m_status = eStatus.Failed;
			m_normal = Vector3.Zero;
			m_depth = 0;
			m_nextsv = 0;
			m_result = new sSimplex();

			for (int i = 0; i < m_sv_store.Length; ++i)
			{
				m_sv_store[i] = new sSV();
			}

			for (int i = 0; i < m_fc_store.Length; ++i)
			{
				m_fc_store[i] = new sFace();
			}

			for (int i = 0; i < GjkEpaSolver2.EPA_MAX_FACES; ++i)
			{
				Append(m_stock, m_fc_store[GjkEpaSolver2.EPA_MAX_FACES - i - 1]);
			}
		}
Example #36
0
        public override eStatus Close(eStatus reason)
        {
            LabDB dbService = new LabDB();
            LabViewInterface lvi = null;
            try
            {
                if (data != null)
                {
                    XmlQueryDoc taskDoc = new XmlQueryDoc(data);
                    string viName = taskDoc.Query("task/application");
                    string statusVI = taskDoc.Query("task/status");
                    string server = taskDoc.Query("task/server");
                    string portStr = taskDoc.Query("task/serverPort");
#if LabVIEW_WS
                     lvi = new LabViewInterface();
#else
                    if ((portStr != null) && (portStr.Length > 0) && (portStr.CompareTo("0") != 0) )
                    {
                        lvi = new LabViewRemote(server, Convert.ToInt32(portStr));
                    }
                    else
                    {
                        lvi = new LabViewInterface();
                    }
#endif

                    // Status VI not used 
                    if ((statusVI != null) && statusVI.Length != 0)
                    {
                        try
                        {
                            if(reason == eStatus.Expired)
                                lvi.DisplayStatus(statusVI, "You are out of time!", "0:00");
                            else
                                lvi.DisplayStatus(statusVI, "Your experiment has been cancelled", "0:00");
                        }
                        catch (Exception ce)
                        {
                           Logger.WriteLine("Trying StatusVI: " + ce.Message);
                        }
                    }


                    //Get the VI and send version specfic call to get control of the VI
                   //VirtualInstrument vi = lvi.GetVI(viName);
                    // LV 8.2.1
                    //Server takes control of RemotePanel, connection not brokenS
                    lvi.ReleaseVI(viName);
                }
               Logger.WriteLine("TaskID = " + taskID + " has expired");
                dbService.SetTaskStatus(taskID, (int)reason);
                status = eStatus.Closed;
               
                    DataSourceManager dsManager = TaskProcessor.Instance.GetDataManager(taskID);
                    if (dsManager != null)
                    {
                        dsManager.CloseDataSources();
                        TaskProcessor.Instance.RemoveDataManager(taskID);
                    }
                
                dbService.SetTaskStatus(taskID, (int)status);
                if (couponID > 0)
                { // this task was created with a valid ticket, i.e. not a test.
                    Coupon expCoupon = dbService.GetCoupon(couponID, issuerGUID);

                    // Only use the domain ServiceBroker, do we need a test
                    // Should only be one
                    ProcessAgentInfo[] sbs = dbService.GetProcessAgentInfos(ProcessAgentType.SERVICE_BROKER);

                    if ((sbs == null) || (sbs.Length < 1))
                    {
                       Logger.WriteLine("Can not retrieve ServiceBroker!");
                        throw new Exception("Can not retrieve ServiceBroker!");
                    }
                    ProcessAgentInfo domainSB = null;
                    foreach (ProcessAgentInfo dsb in sbs)
                    {
                        if (!dsb.retired)
                        {
                            domainSB = dsb;
                            break;
                        }
                    }
                    if (domainSB == null)
                    {
                       Logger.WriteLine("Can not retrieve ServiceBroker!");
                        throw new Exception("Can not retrieve ServiceBroker!");
                    }
                    InteractiveSBProxy iuProxy = new InteractiveSBProxy();
                    iuProxy.AgentAuthHeaderValue = new AgentAuthHeader();
                    iuProxy.AgentAuthHeaderValue.coupon = sbs[0].identOut;
                    iuProxy.AgentAuthHeaderValue.agentGuid = ProcessAgentDB.ServiceGuid;
                    iuProxy.Url = sbs[0].webServiceUrl;
                    StorageStatus storageStatus = iuProxy.AgentCloseExperiment(expCoupon, experimentID);
                   Logger.WriteLine("AgentCloseExperiment status: " + storageStatus.status + " records: " + storageStatus.recordCount);


                    // currently RequestTicketCancellation always returns false
                    // Create ticketing service interface connection to TicketService
                    TicketIssuerProxy ticketingInterface = new TicketIssuerProxy();
                    ticketingInterface.AgentAuthHeaderValue = new AgentAuthHeader();
                    ticketingInterface.Url = sbs[0].webServiceUrl;
                    ticketingInterface.AgentAuthHeaderValue.coupon = sbs[0].identOut;
                    ticketingInterface.AgentAuthHeaderValue.agentGuid = ProcessAgentDB.ServiceGuid;
                    if (ticketingInterface.RequestTicketCancellation(expCoupon, TicketTypes.EXECUTE_EXPERIMENT, ProcessAgentDB.ServiceGuid))
                    {
                        dbService.CancelTicket(expCoupon, TicketTypes.EXECUTE_EXPERIMENT, ProcessAgentDB.ServiceGuid);
                       Logger.WriteLine("Canceled ticket: " + expCoupon.couponId);
                    }
                    else
                    {
                       Logger.WriteLine("Unable to cancel ticket: " + expCoupon.couponId);
                    }
                }
            }
            catch (Exception e1)
            {
               Logger.WriteLine("ProcessTasks Cancelled: exception:" + e1.Message + e1.StackTrace);
            }
            finally
            {
                lvi = null;
            }
            return base.Close();
        }
Example #37
0
    //enemy damage is passed back and forth between the soldier and the ragdoll, it issues flame damage if on fire.
    public override void FlameDamage(float dmg)
    {
        base.FlameDamage(dmg);
        if (died) {
            switchToRagdoll ();//only death that hasnt already switched to ragdoll mode;
            rdCS.Death();
            //Death();
        }else{
            CancelInvoke("switchSnipeWalk");
            if(status == eStatus.SHOOTING){
                status = eStatus.WALKING;

            }
            enemyA.SetBool ("onFire",true);
            if(status != eStatus.PARACHUTING){
                moveSpeed  = 13;
            }
        }
    }
Example #38
0
 /// コンストラクタ.
 public ANode(int x, int y)
 {
     _x = x;
     _y = y;
     _status = eStatus.None;
 }
Example #39
0
		public eStatus Evaluate(GJK gjk,ref Vector3 guess)
		{
			sSimplex simplex=gjk.m_simplex;
			if((simplex.rank>1)&&gjk.EncloseOrigin())
			{
				/* Clean up				*/ 
				while(m_hull.Count > 0)
				{
					sFace	f = m_hull[0];
					Remove(m_hull,f);
					Append(m_stock,f);
				}

				m_status = eStatus.Valid;
				m_nextsv = 0;
				/* Orient simplex		*/ 
				if(GJK.Det(	simplex.c[0].w-simplex.c[3].w,
				           	simplex.c[1].w-simplex.c[3].w,
				           	simplex.c[2].w-simplex.c[3].w)<0)
				{
					SwapSv(simplex.c,0,1);
					SwapFloat(simplex.p,0,1);
				}
				/* Build initial hull	*/ 
				sFace[]	tetra ={NewFace(simplex.c[0],simplex.c[1],simplex.c[2],true),
				       	        NewFace(simplex.c[1],simplex.c[0],simplex.c[3],true),
				       	        NewFace(simplex.c[2],simplex.c[1],simplex.c[3],true),
				       	        NewFace(simplex.c[0],simplex.c[2],simplex.c[3],true)};
				if(m_hull.Count==4)
				{
					sFace best=FindBest();
					sFace outer = best;
					uint pass=0;
					uint iterations=0;
					Bind(tetra[0],0,tetra[1],0);
					Bind(tetra[0],1,tetra[2],0);
					Bind(tetra[0],2,tetra[3],0);
					Bind(tetra[1],1,tetra[3],2);
					Bind(tetra[1],2,tetra[2],1);
					Bind(tetra[2],2,tetra[3],1);
					m_status=eStatus.Valid;
					for (; iterations < GjkEpaSolver2.EPA_MAX_ITERATIONS; ++iterations)
					{
						if (m_nextsv < GjkEpaSolver2.EPA_MAX_VERTICES)
						{
							sHorizon horizon = new sHorizon() ;
							sSV	w = m_sv_store[m_nextsv++];
							bool valid = true;					
							best.pass =	(uint)(++pass);
							gjk.GetSupport(ref best.n,ref w);
							float wdist=Vector3.Dot(best.n,w.w)-best.d;
							if (wdist > GjkEpaSolver2.EPA_ACCURACY)
							{
								for(int j=0;(j<3)&&valid;++j)
								{
									valid&=Expand(	pass,w,
									              	best.f[j],best.e[j],
									              	horizon);
								}
								if(valid&&(horizon.nf>=3))
								{
									Bind(horizon.cf,1,horizon.ff,2);
									Remove(m_hull,best);
									Append(m_stock,best);
									best=FindBest();
									if (best.p >= outer.p)
									{
										outer = best;
									}
								} 
								else 
								{ 
									m_status=eStatus.InvalidHull;
									break; 
								}
							} 
							else 
							{ 
								m_status=eStatus.AccuraryReached;
								break; 
							}
						} 
						else 
						{ 
							m_status=eStatus.OutOfVertices;
							break; 
						}
					}
					Vector3	projection=outer.n*outer.d;
					m_normal	=	outer.n;
					m_depth		=	outer.d;
					m_result.rank	=	3;
					m_result.c[0]	=	outer.c[0];
					m_result.c[1]	=	outer.c[1];
					m_result.c[2]	=	outer.c[2];
					m_result.p[0]	=	Vector3.Cross(	outer.c[1].w-projection,
					             	 	              	outer.c[2].w-projection).Length();
					m_result.p[1] = Vector3.Cross(outer.c[2].w - projection,
					                              outer.c[0].w-projection).Length();
					m_result.p[2] = Vector3.Cross(outer.c[0].w - projection,
					                              outer.c[1].w-projection).Length();
					float sum=m_result.p[0]+m_result.p[1]+m_result.p[2];
					m_result.p[0]	/=	sum;
					m_result.p[1]	/=	sum;
					m_result.p[2]	/=	sum;
					return(m_status);
				}
			}
			/* Fallback		*/ 
			m_status	=	eStatus.FallBack;
			m_normal	=	-guess;
			float nl=m_normal.LengthSquared();
			if(nl>0)
			{
				m_normal.Normalize();
			}
			else
			{
				m_normal = new Vector3(1,0,0);
			}

			m_depth	=	0;
			m_result.rank=1;
			m_result.c[0]=simplex.c[0];
			m_result.p[0]=1;	
			return(m_status);
		}
Example #40
0
 IEnumerator StopHurtPlayer()
 {
     yield return new WaitForSeconds(.5f);
     headA.transform.rotation = Quaternion.identity;
     headA.GetComponent<SpriteRenderer>().sprite = Soldier_Sprites.S.getHead(0);
     print ("WTF"+status+"  "+lastStatus);
     status = lastStatus;
     print ("WTF MOVESPEED HURT PLAYER "+status+"  "+lastStatus);
 }
Example #41
0
		public sFace NewFace(sSV a,sSV b,sSV c,bool forced)
		{
			if(m_stock.Count > 0)
			{
				sFace face=m_stock[0];
				Remove(m_stock,face);
				Append(m_hull,face);
				face.pass	=	0;
				face.c[0]	=	a;
				face.c[1]	=	b;
				face.c[2]	=	c;
				face.n		=	Vector3.Cross(b.w-a.w,c.w-a.w);
				float l=face.n.Length();
				bool v = l > GjkEpaSolver2.EPA_ACCURACY;
				face.p = System.Math.Min(System.Math.Min(
					Vector3.Dot(a.w,Vector3.Cross(face.n,a.w-b.w)),
					Vector3.Dot(b.w,Vector3.Cross(face.n,b.w-c.w))),
				                         Vector3.Dot(c.w,Vector3.Cross(face.n,c.w-a.w)))	/
				         (v?l:1);
				face.p = face.p >= -GjkEpaSolver2.EPA_INSIDE_EPS ? 0 : face.p;
				if(v)
				{
					face.d = Vector3.Dot(a.w,face.n)/l;
					face.n /= l;
					if (forced || (face.d >= -GjkEpaSolver2.EPA_PLANE_EPS))
					{
						return(face);
					} 
					else 
					{
						m_status=eStatus.NonConvex;
					}
				} 
				else 
				{
					m_status=eStatus.Degenerated;
				}
				Remove(m_hull,face);
				Append(m_stock,face);
				return null;
			}
			m_status=m_stock.Count > 0?eStatus.OutOfVertices:eStatus.OutOfFaces;
			return null;
		}
Example #42
0
		/// <summary>
		/// Player receives this item (added to players inventory)
		/// </summary>
		/// <param name="player"></param>
		public override void OnReceive(GamePlayer player)
		{
			// for guild banners we don't actually add it to inventory but instead register
			// if it is rescued by a friendly player or taken by the enemy

			player.Inventory.RemoveItem(this);

			int trophyModel = 0;
			eRealm realm = eRealm.None;

			switch (Model)
			{
				case 3223:
					trophyModel = 3359;
					realm = eRealm.Albion;
					break;
				case 3224:
					trophyModel = 3361;
					realm = eRealm.Midgard;
					break;
				case 3225:
					trophyModel = 3360;
					realm = eRealm.Hibernia;
					break;
			}

			// if picked up by an enemy then turn this into a trophy
			if (realm != player.Realm)
			{
				ItemUnique template = new ItemUnique(Template);
				template.ClassType = "";
				template.Model = trophyModel;
				template.IsDropable = true;
				template.IsIndestructible = false;

				GameServer.Database.AddObject(template);
				GameInventoryItem trophy = new GameInventoryItem(template);
                player.Inventory.AddItem(eInventorySlot.FirstEmptyBackpack, trophy);
				OwnerGuild.SendMessageToGuildMembers(player.Name + " of " + GlobalConstants.RealmToName(player.Realm) + " has captured your guild banner!", eChatType.CT_Guild, eChatLoc.CL_SystemWindow);
				OwnerGuild.GuildBannerLostTime = DateTime.Now;
			}
			else
			{
				m_status = eStatus.Recovered;

				// A friendly player has picked up the banner.
				if (OwnerGuild != null)
				{
					OwnerGuild.SendMessageToGuildMembers(player.Name + " has recovered your guild banner!", eChatType.CT_Guild, eChatLoc.CL_SystemWindow);
				}

				if (SummonPlayer != null)
				{
					SummonPlayer.GuildBanner = null;
				}
			}
		}
Example #43
0
        public virtual eStatus Expire()
        {
            Logger.WriteLine("Task expired: " + taskID);

            Close(eStatus.Expired);
            status |= eStatus.Expired;
            return status;
        }
Example #44
0
 /// ステータスをClosedにする.
 public void Close()
 {
     Debug.Log (string.Format ("Closed: ({0},{1})", X, Y));
     _status = eStatus.Closed;
 }
Example #45
0
 private void btnOpen_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         pStatus = eStatus.OK;
         pSkinName = listView1.SelectedItems[0].Text;
         this.Close();
     }
     else
         btnCancel_Click(sender, e);
     
 }
Example #46
0
    /*void FixedUpdate()

    {
        if(!dead){
            print (parachuting);
        }
    }*/
    void testGrounded()
    {
        //print ("TEST GROUND "+Time.deltaTime);
        if(Physics2D.Linecast (transform.position, groundCheck.position, layerMsk)){
            //print ("HIT GROUND "+defaultSpeed);
            moveSpeed = defaultSpeed;
            if(equipped == Equipped.SNIPER){
                status = eStatus.SHOOTING;
                InvokeRepeating("switchSnipeWalk",1,2);
                enemyA.Play("enemySnipe");
            }else{
                status = eStatus.WALKING;
                enemyA.Play ("enemyWalk");
            }

            closeChute();
            //StartCoroutine("delayAnim");
        }
    }
Example #47
0
    //IEnumerator delayAnim()
    //{
    //yield return new WaitForSeconds(0.01f);
    //enemyA.Play ("enemyWalk");
    //}
    void testFalling()
    {
        if(rb2D.velocity.y < -5f){
            bool grounded =Physics2D.Linecast (transform.position, groundCheck.position, layerMsk);
            //print ("paracuting "+grounded);
            if(!grounded){
                var vel = rb2D.velocity;
                status = eStatus.FALLING;
                //startFalling();
                switchToRagdoll();
                rdCS.aliveSwitch = float.MaxValue;

                //print (vel);
                rdTorsoRB.velocity = vel;//,ForceMode2D.Impulse);
                rdCS.AddTorqueAll (-15,15);
            }
        }
    }
Example #48
0
    void switchSnipeWalk()
    {
        if(status == eStatus.PARACHUTING){return;}
        if(status == eStatus.WALKING){
            FlipTowardsPlayer();
            status = eStatus.SHOOTING;
            snipeCS.StartSniping();
            enemyA.Play ("enemySnipe");
        }else{

            snipeCS.StopSniping();
            enemyA.Play ("enemyWalk");
            status = eStatus.WALKING;
        }
        //print ("SWIIIIIIIIIIIITCH  "+status);
    }
Example #49
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     pStatus = eStatus.CANCEL;
     this.Close();
 }
Example #50
0
    //,Enemy_Damage eDmg)//<<----edamage ref the same still? not neccessary????
    public void SwitchProperties(float hp)
    {
        eDamage.scoreDeath = false;
        HP = hp;
        headA.SetBool("ragDollTongue",false);
        headA.GetComponent<SpriteRenderer>().sprite = Soldier_Sprites.S.getHead(0);
        if (chute) {
            harnessJoint.connectedBody = rb2D;
            harnessJoint.connectedAnchor = new Vector2(0,3.2f);
            chute.transform.Find ("parachute").GetComponent<Parachute>().enemyCS = this;
        }
        if(parachuting){//still with open parachute
            enemyA.Play("enemyParachute");
        }else{

            //if(status == eStatus.PARACHUTING){//chute closed but switching?
                //print (defaultSpeed);
                moveSpeed = defaultSpeed;

            //}//else{
                FlipTowardsPlayer();
            //}
            enemyA.Play("GetUpAgain");
            status = eStatus.WALKING;
        }
        if (eDamage.onFire) {

                moveSpeed = defaultSpeed = 13;
                enemyA.SetBool ("onFire", true);
        } else {
            if (equipped == Equipped.SNIPER && !parachuting) {
                        //enemyA.Play ("enemySnipe");
                        //if(status != eStatus.PARACHUTING){
                        //status = eStatus.SHOOTING;
                        //moveSpeed = 0;

                        //}
                if(snipeWalk){
                    InvokeRepeating("switchSnipeWalk",1,2);
                }else{
                    snipeCS.StartSniping();
                    status = eStatus.SHOOTING;
                    enemyA.Play ("enemySnipe");
                }
            }
        }
        eDamage.enemyCS = this;
    }
Example #51
0
        public virtual eStatus Close(eStatus reason)
        {
            LabDB dbService = new LabDB();

            try
            {
                if (data != null)
                {
                    XmlQueryDoc taskDoc = new XmlQueryDoc(data);
                    string app = taskDoc.Query("task/application");
                    string statusName = taskDoc.Query("task/status");
                    string server = taskDoc.Query("task/server");
                    string portStr = taskDoc.Query("task/serverPort");

                    // Status not used
                    if ((statusName != null) && statusName.Length != 0)
                    {
                        try
                        {
                            if (reason == eStatus.Expired)
                                DisplayStatus(statusName, "You are out of time!", "0:00");
                            else
                                DisplayStatus(statusName, "Your experiment has been cancelled", "0:00");
                        }
                        catch (Exception ce)
                        {
                            Logger.WriteLine("Trying StatusName: " + ce.Message);
                        }
                    }

                   //Stop the application & close ESS sessions

                }
                Logger.WriteLine("TaskID = " + taskID + " is being closed");
                dbService.SetTaskStatus(taskID, (int)reason);
                status = eStatus.Closed;

                DataSourceManager dsManager = TaskProcessor.Instance.GetDataManager(taskID);
                if (dsManager != null)
                {
                    dsManager.CloseDataSources();
                    TaskProcessor.Instance.RemoveDataManager(taskID);
                }

                dbService.SetTaskStatus(taskID, (int)status);
                if (couponID > 0)
                { // this task was created with a valid ticket, i.e. not a test.
                    Coupon expCoupon = dbService.GetCoupon(couponID, issuerGUID);

                    // Only use the domain ServiceBroker, do we need a test
                    // Should only be one
                    ProcessAgentInfo[] sbs = dbService.GetProcessAgentInfos(ProcessAgentType.SERVICE_BROKER);

                    if ((sbs == null) || (sbs.Length < 1))
                    {
                        Logger.WriteLine("Can not retrieve ServiceBroker!");
                        throw new Exception("Can not retrieve ServiceBroker!");
                    }
                    ProcessAgentInfo domainSB = null;
                    foreach (ProcessAgentInfo dsb in sbs)
                    {
                        if (!dsb.retired)
                        {
                            domainSB = dsb;
                            break;
                        }
                    }
                    if (domainSB == null)
                    {
                        Logger.WriteLine("Can not retrieve ServiceBroker!");
                        throw new Exception("Can not retrieve ServiceBroker!");
                    }
                    InteractiveSBProxy iuProxy = new InteractiveSBProxy();
                    iuProxy.AgentAuthHeaderValue = new AgentAuthHeader();
                    iuProxy.AgentAuthHeaderValue.coupon = sbs[0].identOut;
                    iuProxy.AgentAuthHeaderValue.agentGuid = ProcessAgentDB.ServiceGuid;
                    iuProxy.Url = sbs[0].webServiceUrl;
                    StorageStatus storageStatus = iuProxy.AgentCloseExperiment(expCoupon, experimentID);
                    Logger.WriteLine("AgentCloseExperiment status: " + storageStatus.status + " records: " + storageStatus.recordCount);

                    // currently RequestTicketCancellation always returns false
                    // Create ticketing service interface connection to TicketService
                    TicketIssuerProxy ticketingInterface = new TicketIssuerProxy();
                    ticketingInterface.AgentAuthHeaderValue = new AgentAuthHeader();
                    ticketingInterface.Url = sbs[0].webServiceUrl;
                    ticketingInterface.AgentAuthHeaderValue.coupon = sbs[0].identOut;
                    ticketingInterface.AgentAuthHeaderValue.agentGuid = ProcessAgentDB.ServiceGuid;
                    if (ticketingInterface.RequestTicketCancellation(expCoupon, TicketTypes.EXECUTE_EXPERIMENT, ProcessAgentDB.ServiceGuid))
                    {
                        dbService.CancelTicket(expCoupon, TicketTypes.EXECUTE_EXPERIMENT, ProcessAgentDB.ServiceGuid);
                        Logger.WriteLine("Canceled ticket: " + expCoupon.couponId);
                    }
                    else
                    {
                        Logger.WriteLine("Unable to cancel ticket: " + expCoupon.couponId);
                    }
                }
            }
            catch (Exception e1)
            {
                Logger.WriteLine("ProcessTasks Cancelled: exception:" + e1.Message + e1.StackTrace);
            }

            return status;
        }
Example #52
0
    protected override void Start()
    {
        base.Start ();
        rb2D = GetComponent<Rigidbody2D>();
        //defaultSpeed = moveSpeed;

        rdGO = Instantiate(ragdollRef, Vector3.zero, Quaternion.identity) as GameObject;

        rdCS = rdGO.GetComponent<Enemy_Ragdoll>();
        rdTorsoRB = rdGO.transform.Find ("enemy1_deadBody_body").GetComponent<Rigidbody2D>();
        rdCS.soldier = gameObject;//eSoldier;

        //rdHeadRB = rdGO.transform.Find ("head Transform").rigidbody2D;

        enemyA = GetComponent<Animator> ();

        headA= transform.Find ("head Transform").Find ("head").GetComponent<Animator>();
        snipeCS = transform.Find ("enemy1_deadBody_body").Find ("enemy1_deadBody_armL").Find("enemy1_deadBody_handL").Find ("sniperHand").GetComponent<SniperSight>();//headA.transform.Find ("sniperEye").Find("eyeBeam").GetComponent<SniperSight>();
        //dickMouth = headA.transform.Find ("dickMouth").gameObject;

        GameObject eDamageGO = (GameObject)Instantiate(eDamageGOref,transform.position , Quaternion.identity);//separate object needed so enemy_damage script coroutines keep working when going back and forth between enemy and ragdoll
        eDamage = eDamageGO.GetComponent<Enemy_Damage> ();
        eDamage.enemyCS = this;

        eDamageT = transform.Find ("enemy1_deadBody_body").Find ("damage");
        eDamage.AwakeAfter(eDamageT);

        rdCS.eDamage = eDamage;//ragdoll CS references to eDamage
        rdCS.eDamageT = eDamageT;
        rdCS.LateAwake();

        SortSprites();
        rdGO.SetActive(false);

        //slightly random z depth
        Vector3 pos = transform.position;
        pos.z = Random.Range (2f, 0f);
        transform.position = pos;

        //StartCoroutine("SortSprites");

        if(equipped == Equipped.C4){
            transform.Find ("enemy1_deadBody_body").Find ("c4").gameObject.SetActive(true);
            defaultSpeed = 13;
            if(!paratrooperMode){
                moveSpeed = defaultSpeed;
            }
        }else if(equipped == Equipped.SHIELD){
            transform.Find ("enemy1_deadBody_body").Find ("shield").gameObject.SetActive(true);
        }else if(equipped == Equipped.SNIPER){
            //print ("YAYAYA");
            snipeCS.gameObject.SetActive(true);
            //if(!paratrooperMode){
                //status = eStatus.SHOOTING;
            if(!paratrooperMode){
                enemyA.Play("enemySnipe");
                snipeCS.StartSniping();
            }
                    //
                if(snipeWalk){
                    InvokeRepeating("switchSnipeWalk",1,5);

                }
            //}
            rdGO.transform.Find("enemy1_deadBody_handL").Find ("sniperHand").gameObject.SetActive(true);
        }

        if(!facingRight && transform.localScale.x > 0){//enemy placed in level, supposed to be facing left??
            Flip();
            facingRight = false;
        }

        Level.enemyCount++;//for max spawn of whole level;

        frontCheck = transform.Find("frontCheck");
        frontCheck2 = transform.Find ("frontCheck2");

        int layerMsk2 = 1 << LayerMask.NameToLayer("Props");
        int layerMsk1 = 1 << LayerMask.NameToLayer("Ground");
        int layerMsk3 = 1 << LayerMask.NameToLayer("OneWayGround");
        int layerMsk4 = 1 << LayerMask.NameToLayer("GroundMotion");
        //int layerMsk5 = 1 << LayerMask.NameToLayer("Pickups");
        layerMsk = layerMsk1 | layerMsk2 | layerMsk3 | layerMsk4;
        //shootLayerMsk = layerMsk1 | layerMsk2 |  layerMsk3 | layerMsk4;
        groundCheck = transform.Find ("groundCheck");
        //InvokeRepeating("TestShoot", 0f, 4f);

        //parachute shit
        if(paratrooperMode){
            makeChute();
            parachuting = true;
            status = eStatus.PARACHUTING;
            rdGO.SetActive(true);

            switchToRagdoll();

            //rdGO.transform.Rotate (Vector3.forward * 90);
            //rdCS.makeNormalHeavy();
            rdCS.StartCoroutine("openChute");
            rdCS.aliveSwitch = 5f;
            rdCS.AddTorqueAll(-10,10);

        }
        if (status == eStatus.IDLE) {
            enemyA.Play("enemyIdle");
        }
        //print (facingRight+"     "+moveSpeed);
    }
Example #53
0
File: GJK.cs Project: himapo/ccm
 public eStatus Evaluate(tShape shapearg, btVector3 guess)
 {
     U iterations = 0;
     float sqdist = 0;
     float alpha = 0;
     //btVector3	*lastw=stackalloc btVector3[4];
     //btVector3[] lastw = new btVector3[4];
     StackPtr<btVector3> lastw = StackPtr<btVector3>.Allocate(4);
     try
     {
         U clastw = 0;
         /* Initialize solver		*/
         m_free[0] = m_store[0];
         m_free[1] = m_store[1];
         m_free[2] = m_store[2];
         m_free[3] = m_store[3];
         m_nfree = 4;
         m_current = 0;
         m_status = eStatus.Valid;
         m_shape = shapearg;
         m_distance = 0;
         /* Initialize simplex		*/
         m_simplices[0].rank = 0;
         m_ray = guess;
         float sqrl = m_ray.Length2;
         appendvertice(m_simplices[0], sqrl > 0 ? -m_ray : new btVector3(1, 0, 0));
         m_simplices[0].p[0] = 1;
         m_ray = m_simplices[0].c[0].w;
         sqdist = sqrl;
         lastw[0] =
             lastw[1] =
             lastw[2] =
             lastw[3] = m_ray;
         /* Loop						*/
         do
         {
             U next = 1 - m_current;
             sSimplex cs = m_simplices[m_current];
             sSimplex ns = m_simplices[next];
             /* Check zero							*/
             float rl = m_ray.Length;
             if (rl < GJK_MIN_DISTANCE)
             {/* Touching or inside				*/
                 m_status = eStatus.Inside;
                 break;
             }
             /* Append new vertice in -'v' direction	*/
             appendvertice(cs, -m_ray);
             btVector3 w = cs.c[cs.rank - 1].w;
             bool found = false;
             for (U i = 0; i < 4; ++i)
             {
                 if ((w - lastw[i]).Length2 < GJK_DUPLICATED_EPS)
                 { found = true; break; }
             }
             if (found)
             {/* Return old simplex				*/
                 removevertice(m_simplices[m_current]);
                 break;
             }
             else
             {/* Update lastw					*/
                 lastw[clastw = (clastw + 1) & 3] = w;
             }
             /* Check for termination				*/
             float omega = btVector3.dot(m_ray, w) / rl;
             alpha = (float)Math.Max(omega, alpha);
             if (((rl - alpha) - (GJK_ACCURARY * rl)) <= 0)
             {/* Return old simplex				*/
                 removevertice(m_simplices[m_current]);
                 break;
             }
             /* Reduce simplex						*/
             //float* weights = stackalloc float[4];
             StackPtr<float> weights = StackPtr<float>.Allocate(4);
             try
             {
                 U mask = 0;
                 switch (cs.rank)
                 {
                     case 2: sqdist = projectorigin(cs.c[0].w,
                                 cs.c[1].w,
                                 weights, ref mask); break;
                     case 3: sqdist = projectorigin(cs.c[0].w,
                                 cs.c[1].w,
                                 cs.c[2].w,
                                 weights, ref mask); break;
                     case 4: sqdist = projectorigin(cs.c[0].w,
                                 cs.c[1].w,
                                 cs.c[2].w,
                                 cs.c[3].w,
                                 weights, ref mask); break;
                 }
                 if (sqdist >= 0)
                 {/* Valid	*/
                     ns.rank = 0;
                     m_ray = new btVector3(0, 0, 0);
                     m_current = next;
                     for (U i = 0, ni = cs.rank; i < ni; ++i)
                     {
                         if ((mask & (1 << (int)i)) != 0)
                         {
                             ns.c[ns.rank] = cs.c[i];
                             ns.p[ns.rank++] = weights[i];
                             #region m_ray += cs.c[i].w * weights[i];
                             {
                                 btVector3 temp;
                                 btVector3.Multiply(ref cs.c[i].w, weights[i], out temp);
                                 m_ray.Add(ref temp);
                             }
                             #endregion
                         }
                         else
                         {
                             m_free[m_nfree++] = cs.c[i];
                         }
                     }
                     if (mask == 15) m_status = eStatus.Inside;
                 }
                 else
                 {/* Return old simplex				*/
                     removevertice(m_simplices[m_current]);
                     break;
                 }
                 m_status = ((++iterations) < GJK_MAX_ITERATIONS) ? m_status : eStatus.Failed;
             }
             finally
             {
                 weights.Dispose();
             }
         } while (m_status == eStatus.Valid);
         m_simplex = m_simplices[m_current];
         switch (m_status)
         {
             case eStatus.Valid: m_distance = m_ray.Length; break;
             case eStatus.Inside: m_distance = 0; break;
             default:
                 {
                     break;
                 }
         }
         return (m_status);
     }
     finally
     {
         lastw.Dispose();
     }
 }
Example #54
0
    public override void HurtPlayer(Vector3 pos)
    {
        print ("H Player  " + status);
        if(status == eStatus.ATTACK){return;}

        FlipTowardsPlayer();
        pos.y += 2f;
        Vector3 charPos = headA.transform.position;

        float diffX = pos.x - charPos.x;
        float diffY = pos.y - charPos.y;

        float angle2 = Mathf.Atan2(diffY, diffX) * Mathf.Rad2Deg;
        //print (angle2);
        if(angle2 < -40f){
            angle2 = -40f;
        }
        Quaternion angle3 = Quaternion.Euler(new Vector3(0, 0, angle2));
        if(!facingRight){
            angle2 = Mathf.Atan2(diffY, diffX * -1) * Mathf.Rad2Deg;
            angle3 = Quaternion.Euler(new Vector3(0, 0, angle2));
            if(angle2 < -90f){
                angle2 = -90f;
            }
        }
        headA.transform.rotation = angle3;
        if(equipped == Equipped.C4 && !jihadding){

                StartCoroutine("Jihad");

        }else if(equipped != Equipped.NIL){//jihadding, ignore
            //Destroy(enemyA);
            headA.SetTrigger("DickMouth");
            headA.GetComponent<SpriteRenderer>().sprite = Soldier_Sprites.S.getHead(3);
            StartCoroutine("StopHurtPlayer");
            lastStatus = status;
            status = eStatus.ATTACK;
            AudioSource.PlayClipAtPoint(growlFX[UnityEngine.Random.Range (0, growlFX.Length)], transform.position);
        }
        //return true;
    }
Example #55
0
 /// ステータスをOpenにする.
 public void Open(ANode parent, int cost)
 {
     Debug.Log (string.Format("Open: ({0},{1})", X, Y));
     _status = eStatus.Open;
     _cost   = cost;
     _parent = parent;
 }
Example #56
0
    // Update is called once per frame
    void Update()
    {
        switch (status)
        {
        case Firefly.eStatus.Free:
            {
                //
                // Check distance to player
                //
                if (!charscript.IsHurt())
                {
                    Vector3 dist = player.transform.position - transform.position;
                    if (dist.sqrMagnitude < Mathf.Pow( 1.5f, 2 ))
                    {
                        //Debug.Log("HELD!");
                        status = Firefly.eStatus.Held;
                    }
                }

                //
                // Move towards target
                //
                if (target)
                {
                    pos.x = Mathf.MoveTowards( transform.position.x, target.position.x, fireflySpeed );
                    pos.y = Mathf.MoveTowards( transform.position.y, target.position.y+1.5f, fireflySpeed );
                    transform.position = pos;
                }
            }
            break;

        case Firefly.eStatus.Held:
            {
                //
                // Move towards player
                //
                if (player)
                {
                    charscript.SetHolding();
                    Vector3 grippos = player.transform.position + player.transform.forward * 1.5f;
                    pos.x = Mathf.MoveTowards( transform.position.x, grippos.x, fireflySpeed*3.0f );
                    pos.y = Mathf.MoveTowards( transform.position.y, grippos.y, fireflySpeed*3.0f );
                    transform.position = pos;

                    if (charscript.IsHurt())
                        status = Firefly.eStatus.Free;
                }

                //
                // Check distance to jar
                //
                if (jar && jarscript)
                {
                    Vector3 dist = transform.position - jar.transform.position;
                    //Debug.Log("Dist="+dist.magnitude);
                    if (dist.sqrMagnitude < Mathf.Pow( 3.0f, 2 ))
                    {
                        //Debug.Log("TRAPPED!");
                        jarscript.AddFirefly();
                        status = Firefly.eStatus.Trapped;
                    }
                }
            }
            break;

        case Firefly.eStatus.Trapped:
            {
                //
                // Move towards target
                //
                if (jar)
                {
                    pos.x = Mathf.MoveTowards( transform.position.x, jar.transform.position.x, fireflySpeed );
                    pos.y = Mathf.MoveTowards( transform.position.y, jar.transform.position.y, fireflySpeed );
                    transform.position = pos;
                }
            }
            break;
        }
    }
 public abstract void Show_EventMsg(string Msg, eStatus Status);
Example #58
0
		/// <summary>
		/// Player has dropped, traded, or otherwise lost this item
		/// </summary>
		/// <param name="player"></param>
		public override void OnLose(GamePlayer player)
		{
			if (player.GuildBanner != null)
			{
				player.GuildBanner.Stop();
				m_status = eStatus.Dropped;
			}
		}