//lifetime void Awake() { //instance if (instance != null) { Destroy(gameObject); } instance = this; //data data = new Dictionary <int, Data>(); GroundData groundData = new GroundData(0, "Ground", Data.type.GROUND, false, 4.0f); data.Add(groundData.index, groundData); groundObject.GetComponent <GroundController>().setObject(groundData); LightData lightData = new LightData(1, "Light", Data.type.LIGHT, false, new Color(255, 255, 255), 1.0f); data.Add(lightData.index, lightData); LogSmokeDensityData logSmokeDensityData = new LogSmokeDensityData(2, "SmokeDensity", Data.type.LOGDENSITY, false, false, 1.0f); data.Add(logSmokeDensityData.index, logSmokeDensityData); number = 2; //UI objectPanel.GetComponent <ObjectPanelController>().addObject(groundData); objectPanel.GetComponent <ObjectPanelController>().addObject(lightData); objectPanel.GetComponent <ObjectPanelController>().addObject(logSmokeDensityData); currentIndex = 0; //configuration gameMode = GameMode.OPERATE; }
public override void EnterState() { GameObject ground = GameStart.GetInstance().ResModuel.LoadResources <GameObject>(EResourceType.Ground, "Ground"); ground = CommonFunc.Instantiate(ground); m_ground = CommonFunc.AddSingleComponent <Ground>(ground); GroundData groundData = new GroundData(); m_ground.InitGround(groundData); PlayerData playerData = new PlayerData(); m_palyer = new Player(1, playerData); m_palyer.InitPlayerAction(HitBallDelegate); GameObject go = new GameObject("Controller"); m_playerController = go.AddComponent <PlayerController>(); m_playerController.InitController(m_palyer); BallMechineData mechineData = new BallMechineData(); BallData ballData = new BallData(); m_ballMechine = new BallMechine(mechineData, ballData, m_ground.GetLeftPoint(), m_ground.GetRightPoint()); CoroutineTool.GetInstance().StartGameCoroutine(StartCoroutine()); }
static public void AddEmptyRoomElements(ref RoomData rd) { CameraBoundsData cameraBoundsData = new CameraBoundsData(); cameraBoundsData.size = new Vector2(52, 38); cameraBoundsData.pos = Vector2.zero; rd.cameraBoundsData = cameraBoundsData; rd.AddPropData(cameraBoundsData); PlayerStartData playerStartData = new PlayerStartData(); playerStartData.pos = new Vector2(0, 0); rd.AddPropData(playerStartData); Rect[] groundRects = { new Rect(0, 17.5f, 52, 3), // top new Rect(0, -16.5f, 52, 5), // bottom new Rect(-24, 0, 4, 38), // left new Rect(24, 0, 4, 38), // right }; foreach (Rect rect in groundRects) { GroundData newGroundData = new GroundData { pos = rect.position, size = rect.size, }; rd.AddPropData(newGroundData); } }
// Start is called before the first frame update void Start() { if (oldData == null) { oldData = new GroundData(0, "", Data.type.GROUND, false, 0.0f); } }
public void InitGround(GroundData ground) { m_groundData = ground; m_leftPoint = CommonFunc.GetChild(gameObject, "LeftPoint"); m_rightPoint = CommonFunc.GetChild(gameObject, "RightPoint"); m_effectAI = CommonFunc.GetChild(gameObject, "AIEffect"); m_effectPlayer = CommonFunc.GetChild(gameObject, "PlayerEffect"); GameObject leftLine = CommonFunc.GetChild(gameObject, "LLine"); m_leftLine = leftLine.GetComponent <Animator>(); GameObject rightLine = CommonFunc.GetChild(gameObject, "RLine"); m_rightLine = rightLine.GetComponent <Animator>(); m_leftLine.enabled = false; m_rightLine.enabled = false; int count = m_effectPlayer.transform.childCount; for (int i = 0; i < count; i++) { Transform trans = m_effectPlayer.transform.GetChild(i); trans.gameObject.AddComponent <DetectEffect>(); } HideEffect(); }
/// <summary> /// Loads the ground data. /// </summary> /// <param name="data"></param> public void Load(GroundData data) { _data = data; this.LoadGroundMesh(); this.LoadCells(); }
public void init(GroundData _groundData) { groundData = _groundData; sizeSetLine = transform.GetChild(0).gameObject; sizeSetLine.GetComponent <OneValueSetLineController>().init("size", groundData.size.ToString()); }
void Start() { unlocks = GlobalController.save.unlocks; rb2d = GetComponent<Rigidbody2D>(); anim = GetComponent<Animator>(); options = GlobalController.save.options; this.facingRight = false; cyanMaterial = Resources.Load<Material>("Shaders/CyanFlash"); spr = GetComponent<SpriteRenderer>(); defaultMaterial = GetComponent<SpriteRenderer>().material; gunEyes = transform.Find("GunEyes").transform; gun = GetComponentInChildren<Gun>(); interaction = GetComponentInChildren<InteractAppendage>(); lastSafeOffset = this.transform.position; speedLimiter = GetComponent<SpeedLimiter>(); spriteRenderers = new List<SpriteRenderer>(GetComponentsInChildren<SpriteRenderer>(includeInactive:true)); combatActives = GetComponentsInChildren<ActiveInCombat>(includeInactive:true); diamondShine = Resources.Load("Effects/DiamondShine") as GameObject; airAttackTracker = GetComponent<AirAttackTracker>(); RefreshAirMovement(); deathEvent = Resources.Load("ScriptableObjects/Events/Player Death") as GameEvent; groundCheck = GetComponent<PlayerGroundCheck>(); groundData = groundCheck.groundData; LoadFromSaveData(GlobalController.save); EnableTriggers(); }
public PrimitiveTask(string n, CompoundTask p) { name = n; arguments = new List <Term>(); arguments.Capacity = 3; preconditions = new List <Atom>(); effects = new List <Atom>(); cuncurrentTasks = new List <CuncurrentTask> (); cost = 1; loop = false; logicalOperator = LogicalOperator.AND; actionType = ActionTypes.MOVEMENT; groundData = new GroundData(); groundData.animationState = ""; groundData.name = ""; parent = p; }
private void OnTriggerStay(Collider other) { if (other.tag == "EarthZone") { groundData = other.GetComponent <GroundData>(); inEarthZone = true; } }
// ---------------------------------------------------------------- // Start // ---------------------------------------------------------------- public void Initialize(Room _myRoom, GroundData data) { base.BaseGroundInitialize(_myRoom, data); mayBounce = data.mayBounce; doRechargePlayer = data.doRechargePlayer; isBouncy = data.isBouncy; ApplyBodySpriteColor(); }
// ---------------------------------------------------------------- // Serializing // ---------------------------------------------------------------- override public PropData ToData() // NOTE: Just here to pacify errors. This class isn't used in the game yet. { GroundData data = new GroundData { pos = pos, size = Size(), travelMind = new TravelMindData(travelMind), }; return(data); }
private void AddPropSprites() { foreach (PropData propData in myRD.allPropDatas) { // -- Batteries -- if (propData.GetType() == typeof(BatteryData)) { BatteryData pd = propData as BatteryData; AddSpriteRenderer("Battery", rh.s_battery, go_props, pd.pos, BatteryIconSize, 10, Color.white); } // -- Grounds -- else if (propData.GetType() == typeof(GroundData)) { GroundData pd = propData as GroundData; groundDatas.Add(pd); // also add it to my ref list! srs_grounds.Add(AddSpriteRenderer("Ground", rh.s_ground, go_props, pd.pos, pd.size, 1, Color.white)); //WHY POSITION? why not center? } // -- DispGrounds -- else if (propData.GetType() == typeof(DispGroundData)) { DispGroundData pd = propData as DispGroundData; Color color = DispGround.GetBodyColor(pd); color = new Color(color.r, color.g, color.b, color.a * 0.6f); // alpha it out a bit, to taste. AddSpriteRenderer("DispGround", rh.s_ground, go_props, pd.pos, pd.size, 1, color); } // -- Gems -- else if (propData.GetType() == typeof(GemData)) { GemData pd = propData as GemData; Sprite sprite = rh.GetGemSprite(pd.type); AddSpriteRenderer("Gem", sprite, go_props, pd.pos, GemIconSize, 10, Color.white); } // -- Snacks -- else if (propData.GetType() == typeof(SnackData)) { SnackData pd = propData as SnackData; Color color = PlayerBody.GetBodyColorNeutral(PlayerTypeHelper.TypeFromString(pd.playerType)); AddSpriteRenderer("Snack", rh.s_snack, go_props, pd.pos, SnackIconSize, 10, color); } // -- Spikes -- else if (propData.GetType() == typeof(SpikesData)) { SpikesData spikesData = propData as SpikesData; Color color = Colors.Spikes(myRD.WorldIndex);// new Color(0.7f,0.1f,0f, 0.6f); SpriteRenderer newSprite = AddSpriteRenderer("Spikes", rh.s_spikes, go_props, spikesData.pos, Vector2.one, 0, color); newSprite.drawMode = SpriteDrawMode.Tiled; newSprite.size = spikesData.size; newSprite.transform.localEulerAngles = new Vector3(0, 0, spikesData.rotation); } } }
// ---------------------------------------------------------------- // Serializing // ---------------------------------------------------------------- override public PropData ToData() { GroundData data = new GroundData { pos = pos, size = Size(), mayPlayerEat = MayPlayerEatHere, isPlayerRespawn = IsPlayerRespawn, preventHappyHop = PreventHappyHop, isBouncy = isBouncy, mayBounce = mayBounce, doRechargePlayer = doRechargePlayer, travelMind = new TravelMindData(travelMind), }; return(data); }
void RefreshGroundData(GroundData groundData) { groundData.leftGround = false; groundData.hitGround = false; groundData.ledgeStep = false; }
private static void LoadGrounds(XmlDocument document) { XmlNodeList entities = document.GetElementsByTagName("ground"); foreach (XmlElement element in entities) { string name = element.GetAttribute("name"); string shortName = element.GetAttribute("shortname"); Debug.Log("Loading ground " + name); bool unique = VerifyShortName(shortName); if (!unique) { Debug.LogWarning("Shortname " + shortName + " already exists, aborting"); continue; } TextureReference tex2d = null; TextureReference tex3d = null; List <string[]> categories = new List <string[]>(); bool diagonal = false; foreach (XmlElement child in element) { switch (child.LocalName) { case "tex": string target = child.GetAttribute("target"); if (target == "editmode") { tex2d = TextureReference.GetTextureReference(child); } else if (target == "previewmode") { tex3d = TextureReference.GetTextureReference(child); } else { tex2d = TextureReference.GetTextureReference(child); tex3d = tex2d; } break; case "category": categories.Add(child.InnerText.Split('/')); break; case "diagonal": diagonal = true; break; } } if (tex2d == null || tex3d == null) { Debug.LogWarning("No textures loaded, aborting"); } GroundData data = ScriptableObject.CreateInstance <GroundData>(); data.Initialize(name, shortName, tex2d, tex3d, diagonal); Database.Grounds[shortName] = data; foreach (string[] category in categories) { IconUnityListElement iconListElement = (IconUnityListElement)GuiManager.Instance.GroundsTree.Add(data, category); iconListElement.TextureReference = tex2d; } Debug.Log("Ground data " + name + " loaded and ready to use!"); } }
// ---------------------------------------------------------------- // Serialize // ---------------------------------------------------------------- public GroundData SerializeAsData() { GroundData data = new GroundData(pos, Size); return(data); }
static public Color GetBodyColor(GroundData g, int worldIndex) { return(GetBodyColor(worldIndex, g.isBouncy, g.mayBounce, g.doRechargePlayer)); }
//methods public void setObject(GroundData data) { //该函数可能在start前被调用 if (oldData == null) { oldData = new GroundData(0, "", Data.type.GROUND, false, 0.0f); } float nowSize = data.size; float lastSize = oldData.size; // GameManager.instance.addLog(nowSize.ToString()); if (nowSize == lastSize) { return; } else if (nowSize > lastSize) { GameObject unit = null; Vector3 position = new Vector3(0.0f, 0.0f, 0.0f); //一圈一圈加 // // 1321 // 2003 // 3002 // 1231 // for (float i = lastSize; i < nowSize; i += 0.2f) { float temp = i / 2 + 0.05f; for (float k = 0; k < 2 * temp - 0.01f; k += 0.1f) { position = new Vector3(temp, 0, (-1) * temp + k); unit = Instantiate(planeUnit, position, Quaternion.identity); unit.transform.SetParent(transform); position = new Vector3(temp - k, 0, temp); unit = Instantiate(planeUnit, position, Quaternion.identity); unit.transform.SetParent(transform); position = new Vector3((-1) * temp, 0, temp - k); unit = Instantiate(planeUnit, position, Quaternion.identity); unit.transform.SetParent(transform); position = new Vector3((-1) * temp + k, 0, (-1) * temp); unit = Instantiate(planeUnit, position, Quaternion.identity); unit.transform.SetParent(transform); } } // Debug.Log(transform.childCount); lastSize = nowSize; oldData.size = nowSize; } else if (nowSize < lastSize) { int index = (int)((nowSize + 0.01f) / 0.1f) * (int)((nowSize + 0.01f) / 0.1f); //逆序遍历 for (int i = transform.childCount - 1; i >= index; i--) { Destroy(transform.GetChild(i).gameObject); } lastSize = nowSize; oldData.size = nowSize; } // transform.position = new Vector3(0.0f, 0.0f, 0.0f); }
// ---------------------------------------------------------------- // Initialize // ---------------------------------------------------------------- public void Initialize(Level myLevel, GroundData data) { BaseInitialize(myLevel, data); Size = data.size; }
public GroundDataChangeCommand(Ground ground, GroundData oldData, GroundData newData) { this.ground = ground; this.oldData = oldData; this.newData = newData; }
//file public void save(string path) { FileStream fs = new FileStream(path, FileMode.Create); StreamWriter sw = new StreamWriter(fs); string line = ""; //write configuration line = "configuration" + "-" + "number=" + number.ToString(); sw.Write(line); sw.Write("\n"); //write data foreach (var item in data) { line = "data" + "-"; line = line + "index=" + item.Key + "-"; line = line + "name=" + item.Value.name + "-"; line = line + "type=" + item.Value.dataTypeToString(item.Value.dataType) + "-"; line = line + "deletable=" + item.Value.deletable.ToString() + "-"; switch (item.Value.dataType) { case Data.type.GROUND: { GroundData groundData = ((GroundData)item.Value); line = line + "size=" + groundData.size; break; } case Data.type.LIGHT: { LightData lightData = ((LightData)item.Value); line = line + "intensity=" + lightData.intensity.ToString() + "-"; line = line + "color:R=" + lightData.color.r.ToString() + ":G=" + lightData.color.g.ToString() + ":B=" + lightData.color.b.ToString(); break; } case Data.type.LOGDENSITY: { LogSmokeDensityData logSmokeDensityData = ((LogSmokeDensityData)item.Value); line = line + "logFlag=" + logSmokeDensityData.logFlag.ToString() + "-"; line = line + "interval=" + logSmokeDensityData.interval.ToString(); break; } case Data.type.BARRIER: { BarrierData barrierData = ((BarrierData)item.Value); line = line + "geometryType=" + barrierData.geometryData.getGeometryTypeStringArray()[(int)barrierData.geometryData.geometryType] + "-"; line = line + "position=" + barrierData.geometryData.position.ToString() + "-"; switch (barrierData.geometryData.geometryType) { case GeometryData.GeometryType.CUBE: { line = line + "size=" + ((CubeGeometryData)barrierData.geometryData).size.ToString() + "-"; line = line + "direction=" + ((CubeGeometryData)barrierData.geometryData).direction.ToString(); break; } case GeometryData.GeometryType.SPHERE: { line = line + "r=" + ((SphereGeometryData)barrierData.geometryData).r.ToString(); break; } case GeometryData.GeometryType.CYLINDER: { line = line + "r=" + ((CylinderGeometryData)barrierData.geometryData).r.ToString() + "-"; line = line + "height=" + ((CylinderGeometryData)barrierData.geometryData).height.ToString() + "-"; line = line + "direction=" + ((CylinderGeometryData)barrierData.geometryData).direction.ToString(); break; } } break; } case Data.type.WIND: { WindData windData = ((WindData)item.Value); line = line + "intensity=" + windData.intensity.ToString() + "-"; line = line + "interference=" + windData.interference.ToString() + "-"; line = line + "geometryType=" + windData.geometryData.getGeometryTypeStringArray()[(int)windData.geometryData.geometryType] + "-"; line = line + "position=" + windData.geometryData.position.ToString() + "-"; switch (windData.geometryData.geometryType) { case GeometryData.GeometryType.CUBE: { line = line + "size=" + ((CubeGeometryData)windData.geometryData).size.ToString() + "-"; line = line + "direction=" + ((CubeGeometryData)windData.geometryData).direction.ToString(); break; } case GeometryData.GeometryType.SPHERE: { line = line + "r=" + ((SphereGeometryData)windData.geometryData).r.ToString(); break; } case GeometryData.GeometryType.CYLINDER: { line = line + "r=" + ((CylinderGeometryData)windData.geometryData).r.ToString() + "-"; line = line + "height=" + ((CylinderGeometryData)windData.geometryData).height.ToString(); break; } } break; } case Data.type.SMOKE: { SmokeData smokeData = ((SmokeData)item.Value); switch (smokeData.smokeType) { case SmokeData.SmokeType.SMOKE: { line = line + "smokeType=smoke-"; line = line + "duration=" + smokeData.physicalData.duration.ToString() + "-"; line = line + "maxNumber=" + smokeData.physicalData.maxNumber.ToString() + "-"; line = line + "particleSize=" + smokeData.physicalData.particleSize.ToString() + "-"; line = line + "speed=" + smokeData.physicalData.speed.ToString() + "-"; line = line + "color:R=" + smokeData.color.r.ToString() + ":G=" + smokeData.color.g.ToString() + ":B=" + smokeData.color.b.ToString() + "-"; line = line + "geometryType=" + smokeData.geometryData.getGeometryTypeStringArray()[(int)smokeData.geometryData.geometryType] + "-"; line = line + "position=" + smokeData.geometryData.position.ToString() + "-"; switch (smokeData.geometryData.geometryType) { case GeometryData.GeometryType.CYCLE: { line = line + "r=" + ((CycleGeometryData)smokeData.geometryData).r.ToString() + "-"; line = line + "direction=" + ((CycleGeometryData)smokeData.geometryData).direction.ToString(); break; } case GeometryData.GeometryType.CONE: { line = line + "r=" + ((ConeGeometryData)smokeData.geometryData).r.ToString() + "-"; line = line + "height=" + ((ConeGeometryData)smokeData.geometryData).height.ToString() + "-"; line = line + "direction=" + ((ConeGeometryData)smokeData.geometryData).direction.ToString(); break; } } break; } case SmokeData.SmokeType.FIRE: { line = line + "smokeType=fire-"; break; } case SmokeData.SmokeType.EXPLOSION: { line = line + "smokeType=explosion-"; break; } } break; } default: { break; } } sw.Write(line); sw.Write("\n"); } sw.Flush(); sw.Close(); fs.Close(); }
private void AddPropImages() { int snackIndex = 0; // for determining which Snacks we gots! foreach (PropData propData in myRD.allPropDatas) { // -- Spikes -- if (propData.GetType() == typeof(SpikesData)) { SpikesData spikesData = propData as SpikesData; Color color = Colors.Spikes(myRD.WorldIndex);// new Color(0.7f,0.1f,0f, 0.6f); Image newObj = AddImage("Spikes", rh.s_spikes, rt_props, spikesData.pos, spikesData.size, color); newObj.transform.localEulerAngles = new Vector3(0, 0, spikesData.rotation); newObj.type = Image.Type.Tiled; newObj.transform.localScale = Vector3.one / 100f; // kinda hacky-ish. newObj.rectTransform.sizeDelta *= 100f; newObj.transform.SetAsFirstSibling(); // put spikes BEHIND everything else. } // -- Grounds -- else if (propData.GetType() == typeof(GroundData)) { GroundData pd = propData as GroundData; Color color = new Color255(100, 130, 90).ToColor();//Ground.GetBodyColor(pd, myRD.WorldIndex); AddImage("Ground", rh.s_ground, rt_props, pd.pos, pd.size, color); } // -- DispGrounds -- else if (propData.GetType() == typeof(DispGroundData)) { DispGroundData pd = propData as DispGroundData; Color color = DispGround.GetBodyColor(pd); color = new Color(color.r, color.g, color.b, color.a * 0.6f); // alpha it out a bit, to taste. AddImage("DispGround", rh.s_ground, rt_props, pd.pos, pd.size, color); } // -- Batteries -- else if (propData.GetType() == typeof(BatteryData)) { BatteryData pd = propData as BatteryData; AddImage("Battery", rh.s_battery, rt_props, pd.pos, BatteryIconSize, Color.white); } // -- Gems -- else if (propData.GetType() == typeof(GemData)) { GemData pd = propData as GemData; Sprite sprite = rh.GetGemSprite(pd.type); AddImage("Gem", sprite, rt_props, pd.pos, GemIconSize, Color.white); } // -- Snacks -- else if (propData.GetType() == typeof(SnackData)) { SnackData pd = propData as SnackData; Color color; bool didEatSnack = SaveStorage.GetBool(SaveKeys.DidEatSnack(myRD, snackIndex)); if (didEatSnack) { color = new Color(0, 0, 0, 0.2f); } else { color = PlayerBody.GetBodyColorNeutral(PlayerTypeHelper.TypeFromString(pd.playerType)); } AddImage("Snack", rh.s_snack, rt_props, pd.pos, SnackIconSize, color); snackIndex++; } } }
static private List <string> GetPropPropertyNamesToSave(PropData propData) { List <string> ps = new List <string>(); // property names! // YES travelMind?? Add that! if (propData.travelMind.IsUsed) { ps.Add("travelMind"); } // NO TravelMind?? Add pos! else { ps.Add("pos"); } if (!Mathf.Approximately(propData.rotation, 0)) { ps.Add("rotation"); } // BaseGroundData? if (propData is BaseGroundData) { ps.Add("size"); BaseGroundData d = propData as BaseGroundData; if (!d.mayPlayerEat) { ps.Add("mayPlayerEat"); } if (d.isPlayerRespawn) { ps.Add("isPlayerRespawn"); } if (d.preventHappyHop) { ps.Add("preventHappyHop"); } } Type type = propData.GetType(); if (type == typeof(BatteryData)) { } else if (type == typeof(BuzzsawData)) { ps.Add("size"); } else if (type == typeof(CameraBoundsData)) { ps.Add("size"); } else if (type == typeof(CharBarrelData)) { ps.Add("otherCharName"); } else if (type == typeof(CharUnlockOrbData)) { ps.Add("myCharName"); } else if (type == typeof(CrateData)) { ps.Add("hitsUntilBreak"); ps.Add("numCoinsInMe"); } else if (type == typeof(GateData)) { ps.Add("channelID"); } else if (type == typeof(GateButtonData)) { ps.Add("channelID"); } else if (type == typeof(GemData)) { ps.Add("type"); } else if (type == typeof(InfoSignData)) { ps.Add("myText"); } else if (type == typeof(LiftData)) { ps.Add("size"); ps.Add("strength"); } else if (type == typeof(PlayerStartData)) { } else if (type == typeof(ProgressGateData)) { ps.Add("numSnacksReq"); } else if (type == typeof(RoomDoorData)) { ps.Add("myID"); ps.Add("worldToIndex"); ps.Add("roomToKey"); ps.Add("doorToID"); } else if (type == typeof(SnackData)) { ps.Add("playerType"); } else if (type == typeof(VeilData)) { ps.Add("size"); } // Enemies else if (type == typeof(DweebData)) { ps.Add("speed"); } // Props with optional params else if (type == typeof(TurretData)) { TurretData d = propData as TurretData; ps.Add("interval"); ps.Add("speed"); if (d.startOffset > 0) { ps.Add("startOffset"); } } else if (type == typeof(SpikesData)) { SpikesData d = propData as SpikesData; ps.Add("size"); if (d.onOffer.IsUsed) { ps.Add("onOffer"); } } else if (type == typeof(LaserData)) { LaserData d = propData as LaserData; if (d.onOffer.IsUsed) { ps.Add("onOffer"); } } else if (type == typeof(DispGroundData)) { DispGroundData d = propData as DispGroundData; ps.Add("doRegen"); if (d.regenTime != DispGround.RegenTimeDefault) { ps.Add("regenTime"); } if (d.dieFromBounce) { ps.Add("dieFromBounce"); } if (d.dieFromPlayerLeave) { ps.Add("dieFromPlayerLeave"); } if (d.dieFromVel) { ps.Add("dieFromVel"); } } else if (type == typeof(GroundData)) { GroundData d = propData as GroundData; if (d.isBouncy) { ps.Add("isBouncy"); } if (!d.mayBounce) { ps.Add("mayBounce"); } if (!d.doRechargePlayer) { ps.Add("doRechargePlayer"); } } else if (type == typeof(PlatformData)) { PlatformData d = propData as PlatformData; if (!d.canDropThru) { ps.Add("canDropThru"); } } else if (type == typeof(ToggleGroundData)) { ps.Add("startsOn"); ps.Add("togFromContact"); ps.Add("togFromAction"); } else { Debug.LogWarning("Prop in Room not recognized for serialization: " + type); } return(ps); }
public override void EnterState() { GameEventModuel eventModuel = GameStart.GetInstance().EventModuel; eventModuel.RegisterEventListener(GameEventID.TRIGGER_GAME_EVENT, OnTriggerEffectStart); eventModuel.RegisterEventListener(GameEventID.END_GAME_EVENT, OnTriggerEffectEnd); m_contestData = new GameContestData(); GameObject ground = GameStart.GetInstance().ResModuel.LoadResources <GameObject>(EResourceType.Ground, "Ground"); ground = CommonFunc.Instantiate(ground); m_ground = CommonFunc.AddSingleComponent <Ground>(ground); GroundData groundData = new GroundData(); m_ground.InitGround(groundData); PlayerData playerData = new PlayerData(); m_player = new Player(1, playerData); m_player.InitPlayerAction(HitBallDelegate); GameObject go = new GameObject("Controller"); m_playerController = go.AddComponent <PlayerController>(); m_playerController.InitController(m_player); BallData ballData = new BallData(); m_gameBall = new GameBall(ballData, m_ground.BounceLine); m_gameBall.SetOutofRangeAction(GameBallOutofRange); m_gameBall.SetPosition(groundData.GetFireBallPoint(ESide.Player)); AIPlayerData aiData = new AIPlayerData(); m_ai = new Player(2, aiData); m_ai.Transform.rotation = Quaternion.Euler(new Vector3(0f, 0f, 180f)); m_ai.InitPlayerAction(HitBallDelegate); m_aiController = go.AddComponent <AIController>(); m_aiController.SetGameBall(m_gameBall); m_aiController.InitController(m_ai); m_effect = new GameEffect(); m_contestUI = GameStart.GetInstance().UIModuel.LoadResUI <GameContestUI>("ContestPrefab"); CoroutineTool.GetInstance().StartCoroutine(SetUI()); GameAudioModuel audioModuel = GameStart.GetInstance().AudioModuel; List <string> list = new List <string> { "BGM_001", "BGM_002", "lerp", }; audioModuel.PreLoadAudio(list); audioModuel.StopAudio(); m_player.Target = m_gameBall.GetBallInstance().transform; m_ai.Target = m_gameBall.GetBallInstance().transform; m_change = false; }