コード例 #1
0
        public override bool FireEvent(Event E)
        {
            //Debug.Log("Event: "+E.ID+".");

            if (E.ID == "StartFishing")
            {
                //Debug.Log("startfishevent.");
                //Popup.Show("You cast a line.");
                fishinHole = E.GetGameObjectParameter("Pool");
            }
            if (E.ID == "StopFishing")
            {
                //Debug.Log("stopfishevent.");

                if (fishinHole != null)
                {
                    IPart.AddPlayerMessage("You stop fishing.");
                }
                fishinHole = null;
            }
            if (E.ID == "UseEnergy")
            {
                //Debug.Log("use energy.");
                //Debug.Log(E.GetStringParameter("Type", string.Empty));

                if (E.GetStringParameter("Type", string.Empty) == "Pass" || E.GetStringParameter("Type", string.Empty) == string.Empty || E.GetStringParameter("Type", string.Empty) == "Fishing" || E.GetStringParameter("Type", string.Empty) == "None")
                {
                    //Debug.Log("passturn.");
                    if (fishinHole != null)
                    {
                        if (fishinHole.GetPart <acegiak_Fishable>().Epic != null)
                        {
                            IPart.AddPlayerMessage("The line goes slack.");
                        }
                        fishinHole.GetPart <acegiak_Fishable>().fromCell = null;
                        fishinHole.GetPart <acegiak_Fishable>().Epic     = null;
                        fishinHole.FireEvent(Event.New("InvCommandContinueFish", "Owner", ParentObject, "Count", ++turnCount));
                    }
                }
                else
                {
                    //Debug.Log("notfish.");

                    if (fishinHole != null)
                    {
                        //Debug.Log("stopfish.");

                        if (fishinHole.GetPart <acegiak_Fishable>() == null || fishinHole.GetPart <acegiak_Fishable>().Epic == null)
                        {
                            IPart.AddPlayerMessage("You stop fishing.");
                            fishinHole = null;
                        }
                        else
                        {
                            if (fishinHole.GetPart <acegiak_Fishable>().Epic.HasStat("Strength") && fishinHole.GetPart <acegiak_Fishable>().Epic.MakeSave("Strength", 1, ParentObject, "Strength"))
                            {
                                if (ParentObject.CurrentCell != fishinHole.GetPart <acegiak_Fishable>().fromCell)
                                {
                                    fishinHole.GetPart <acegiak_Fishable>().fromCell.AddObject(ParentObject);
                                    //ParentObject.CurrentCell = fishinHole.GetPart<acegiak_Fishable>().fromCell;
                                    IPart.AddPlayerMessage("You strain at the line!");
                                }
                            }
                            else
                            {
                                Popup.Show("You reel in " + fishinHole.GetPart <acegiak_Fishable>().Epic.the + fishinHole.GetPart <acegiak_Fishable>().Epic.DisplayNameOnly + ".");
                                fishinHole.GetPart <acegiak_Fishable>().Epic.AwardXPTo(ParentObject, "Catch");
                                fishinHole.GetPart <acegiak_Fishable>().fromCell.AddObject(fishinHole.GetPart <acegiak_Fishable>().Epic);
                                fishinHole.GetPart <acegiak_Fishable>().fromCell = null;
                                fishinHole.GetPart <acegiak_Fishable>().Epic     = null;
                                fishinHole = null;
                            }
                        }
                    }
                }
            }
            //Debug.Log("End event: "+E.ID+".");

            return(base.FireEvent(E));
        }