public override void Dispose() { if (!base.IsDisposed) { foreach (RaindropObj current in this.m_rainFG) { current.Dispose(); } this.m_rainFG.Clear(); this.m_rainFG = null; this.m_mountain1 = null; this.m_mountain2 = null; if (this.m_rainSFX != null) { this.m_rainSFX.Dispose(); } this.m_rainSFX = null; this.m_tree1 = null; this.m_tree2 = null; this.m_tree3 = null; this.m_fern1 = null; this.m_fern2 = null; this.m_fern3 = null; this.m_introText.Dispose(); this.m_introText = null; base.Dispose(); } }
public static ProjectileObj Fire(GameObj source) { var proj = Instance.Fire(source, null, null); proj.BlinkTime = proj.AltX / 1.5f; return proj; }
public override void Dispose() { if (!base.IsDisposed) { this.m_delayObj = null; base.Dispose(); } }
public ProjectileData(GameObj source) { if (source == null) { throw new Exception("Cannot create a projectile without a source"); } this.Source = source; }
protected override void Activated(GameObj player) { ShoutProjectile.Fire(player); Effects.FusRoDahTextEffect.Display(player); Magnitude = 0; Tween.To(this, 1f, new Easing(Tween.EaseNone), "Magnitude", "3"); }
public override void Dispose() { if (!base.IsDisposed) { this.m_fountain = null; this.m_speechBubble = null; base.Dispose(); } }
public static ProjectileObj Fire(GameObj source, int index, int total, int distance) { var proj = Instance.Fire(source, source, x => { x.AltX = 360f / total * index; x.AltY = distance; }); return proj; }
public static ProjectileObj Fire(GameObj source, bool randomize) { return Instance.Fire(source, null, x => { if (randomize) x.InitAngleOffset = CDGMath.RandomInt(-8, 8); x.TextureColor = Color.CadetBlue; }); }
public static ProjectileObj Fire(GameObj source, float angleOffset, Vector2 sourceAnchor) { var proj = Instance.Fire(source, null, x => { x.InitAngleOffset = angleOffset; x.InitSourceAnchor = sourceAnchor; }); return proj; }
public static ProjectileObj Fire(GameObj source, float angle, float distance) { var proj = Instance.Fire(source); proj.IgnoreBoundsCheck = true; proj.CollisionType = Game.CollisionType.Wall; proj.Orientation = MathHelper.ToRadians(angle); proj.Position = CDGMath.GetCirclePosition(angle, distance, source.Position); return proj; }
public static ProjectileObj Fire(GameObj source) { return Instance.Fire(source, null, x => { x.Opacity = 0; //x.X = source.CurrentRoom.X; x.Y = source.Y; //x.Scale = new Vector2(source.CurrentRoom.Width / source.Width, 0); x.IgnoreBoundsCheck = true; }); }
void ICmpInitializable.OnInit(InitContext context) { if (context == InitContext.Activate && DualityApp.ExecContext == DualityApp.ExecutionContext.Game) { DynamicPotentialFieldComponent.PotentialField.AddPotentialFunction(this, new QuadraticPotentialFunction(() => CurrentPosition, (float)AgentSize / 2 + 1.0f, 1.2f * AgentSize)); _rigidBody = GameObj.GetComponent <RigidBody>(); _collisionCategory = (PathfindaxCollisionCategory)_rigidBody.CollisionCategory; DualityApp.Mouse.ButtonDown += Mouse_ButtonDown; } }
public static ProjectileObj Fire(GameObj source) { var proj = Instance.Fire(source, null, null); proj.Opacity = 0; proj.Y -= 20f; Tween.By(proj, 0.1f, Tween.EaseNone, "Y", "20"); Tween.To(proj, 0.1f, Tween.EaseNone, "Opacity", "1"); return(proj); }
private void SetupListeners() { ClearListeners(); _keyListener = GameObj.GetComponent <KeyListener>(); if (!Warnings.NullOrDisposed(_keyListener)) { _keyListener.KeyUp += _keyListener_KeyUp; } }
void ICmpInitializable.OnActivate() { rb = GameObj.GetComponent <RigidBody>(); if (Scene != null) { if (Scene.FindComponent <PlayerMovement>() != null) { playerTransform = Scene.FindComponent <PlayerMovement>().GameObj.Transform; } } }
public virtual void OnActivate() { shot = GameObj.GetComponent <ShotBehavior>(); GameObj.EventParentChanged += GameObj_EventParentChanged; if (GameObj.Parent != null) { controller = GameObj.Parent.GetComponent <PlayerController>(); } }
public void OnInit(InitContext context) { if (context == InitContext.Activate) { if (GameSetup.Instance.WinningPlayer != null) { GameObj.GetChildByName("WinningDisplay").GetComponentsDeep <SpriteRenderer>().First().ColorTint = GameSetup.Instance.WinningPlayer.PlayerColor.Player; GameObj.GetChildByName("WinningDisplay").GetComponentsDeep <TextRenderer>().First().Text.SourceText = string.Format("Player {0} Wins!", GameSetup.Instance.WinningPlayer.AssignedGamepad); } } }
public static void Display(GameObj source, int numEffects = 15) { lock (_defaultCommands) for (int level = 0, factor = 0, range = 40; level < 3 && numEffects > 0; level++, factor += 50, numEffects /= 2, range = 180) { float xStep = (float)(source.Width - factor) / numEffects; float x = source.Bounds.Left + factor; for (int i = 0; i < numEffects; i++, x += xStep) Instance.Run(new Vector2(x, source.Y - (factor * 2)), s => InitializeTweens(s.TweenCommands, range)); } }
public static ProjectileObj Fire(GameObj source) { var proj = Instance.Fire(source, null, null); proj.Opacity = 0; proj.Y -= 20f; Tween.By(proj, 0.1f, Tween.EaseNone, "Y", "20"); Tween.To(proj, 0.1f, Tween.EaseNone, "Opacity", "1"); return proj; }
public void NewBuild(GameObj build, bool friend) { if (friend) { buildsFriend.Add(build); } else { buildsEnemy.Add(build); } }
public void NewUnit(GameObj unit, bool friend) { if (friend) { unitsFriend.Add(unit); } else { unitsEnemy.Add(unit); } }
void ICmpUpdatable.OnUpdate() { if (CurrentHealth > MaxHealth) { CurrentHealth = MaxHealth; } if (CurrentHealth <= 0) { GameObj.DisposeLater(); } }
public void OnInit(InitContext context) { if (context != InitContext.Loaded) { return; } //Setup initial state CurrentHealth = _startHealth; _healthText = GameObj.GetComponent <TextRenderer>(); _healthText.Text.SourceText = CurrentHealth.ToString(); }
private void ControlFtl() { if (DualityApp.Keyboard.KeyHit(FtlJump)) { var ftlCore = GameObj.GetComponent <Ships.FtlDrive>(); if (ftlCore == null) { return; } ftlCore.JumpToFtl(); } }
public static ProjectileObj Fire(GameObj source, bool alt = false) { return Instance.Fire(source, null, x => { if (alt) { x.InitAngleRange = new Vector2(-10f); x.InitSourceAnchor = new Vector2(50f, -30f); x.RotationSpeed = -20f; } }); }
public void OnInit(InitContext context) { if (context != InitContext.Activate) { return; } spriteRenderer = GameObj.GetComponent <SpriteRenderer>(); gravity = 2 * JumpHeight / TimeToJumpApex / TimeToJumpApex; jumpVelocity = MathF.Abs(gravity) * TimeToJumpApex; heldWeapon = GameObj.ParentScene.FindGameObject <HeldWeapon>(); }
public void SetupTilemap(MapGenerator.GenerationPrefs prefs) { TurnActionManager.PlayerMoved += UpdateTilemap; tilemap = GameObj.GetComponent <Tilemap> (); tilemap.Resize(prefs.Width, prefs.Height); var tileGrid = tilemap.BeginUpdateTiles(); tileGrid.Fill(new Tile(NotVisibleTileIndex), 0, 0, tileGrid.Width, tileGrid.Height); tilemap.EndUpdateTiles(); UpdateTilemap(); }
void ICmpUpdatable.OnUpdate() { var renderer = GameObj.GetComponent <SpriteRenderer>(); _batch = _batch ?? new BatchInfo(renderer.SharedMaterial.Res); renderer.CustomMaterial = _batch; var offset = Speed * (float)Time.GameTimer.TotalSeconds; offset.X %= 1; offset.Y %= 1; _batch.SetValue("texOffset", offset); }
public void OnInit(InitContext context) { if (context == InitContext.Activate) { _rigidbody = GameObj.GetComponent <RigidBody>(); previousPosition = GameObj.Transform.Pos; _log = new VisualLog("projectile raycasts"); _gameCamera = Scene.Current.FindComponent <Camera>(); } }
public static ProjectileObj Fire(GameObj source, bool alt = false) { return(Instance.Fire(source, null, x => { if (alt) { x.InitAngleRange = new Vector2(-10f); x.InitSourceAnchor = new Vector2(50f, -30f); x.RotationSpeed = -20f; } })); }
/// <summary> /// Info.TextureUrl에 있는 URL에서 이미지를 다운로드해서 GameObj의 텍스처로 적용하는 코루틴. /// </summary> private IEnumerator GetWebTexture() { UnityWebRequest textureWebRequest = UnityWebRequestTexture.GetTexture(Info.TextureUrl); yield return(textureWebRequest.SendWebRequest()); Texture texture = DownloadHandlerTexture.GetContent(textureWebRequest); yield return(new WaitUntil(() => GameObj != null)); GameObj.GetComponent <MeshRenderer>().material.mainTexture = texture; }
public override void OnTriggerExit(Collider c) { GameObj obj = c.GetComponent <GameObj>(); if (obj) { if (obj == highlightObj) { highlightObj = null; } obj.DeSelect(); } }
GameObj Swapn() { Object obj = _res.OriginObj; GameObject go = GameObject.Instantiate(obj) as GameObject; GameObj item = new GameObj(go, this); _usedList.AddLast(item); _usedCount++; _totalCount++; return(item); }
public void OnInit(InitContext context) { if (context == InitContext.Loaded) { groundBackground = GameObj.ChildByName("Ground"); mountainBackground = GameObj.ChildByName("Mountain"); skyBackground = GameObj.ChildByName("Sky"); groundAltBackground = GameObj.ChildByName("Ground-Alt"); mountainAltBackground = GameObj.ChildByName("Mountain-Alt"); skyAltBackground = GameObj.ChildByName("Sky-Alt"); } }
public void OnActivate() { index = 0; var renderer = GameObj.GetComponent <TextRenderer>(); if (Warnings.NullOrDisposed(renderer)) { return; } renderer.Text.ApplySource("Loading... "); }
public static void Display(GameObj source, int numEffects = 15) { lock (_defaultCommands) for (int level = 0, factor = 0, range = 40; level < 3 && numEffects > 0; level++, factor += 50, numEffects /= 2, range = 180) { float xStep = (float)(source.Width - factor) / numEffects; float x = source.Bounds.Left + factor; for (int i = 0; i < numEffects; i++, x += xStep) { Instance.Run(new Vector2(x, source.Y - (factor * 2)), s => InitializeTweens(s.TweenCommands, range)); } } }
private void HighlightClosest(GameObj obj) { if (highlightObj) { highlightObj = Vector3.Distance(obj.transform.position, handController.transform.position) < Vector3.Distance(highlightObj.transform.position, handController.transform.position) ? obj : highlightObj; } else { highlightObj = obj; } highlightObj.Select(); }
public void OnUpdate() { GameObj.Transform.MoveBy(Vector2.UnitY * 10 * Time.TimeMult); if (GameObj.Transform.Pos.Y > 550) { if (active) { Scene.Current.FindGameObject <MissText>(false).GetComponent <MissText>().Activate(); } GameObj.DisposeLater(); } }
// Use this for initialization public override void Start() { time = 0; gforce = 10; enable = true; speed = GameObj.GetComponent <DiskProperties>().speed; direction = GameObj.GetComponent <DiskProperties>().direction; rigidbody = GameObj.GetComponent <Rigidbody>(); if (rigidbody) { rigidbody.AddForce(Vector3.down * 9.8f); } }
public void OnUpdate() { RigidBody rigidBody = this.GameObj.RigidBody; Agent agent = GameObj.GetComponent <Agent>(); CircleShapeInfo shapeInfo = rigidBody.Shapes.OfType <CircleShapeInfo>().FirstOrDefault(); if (shapeInfo != null) { agent.Radius = shapeInfo.Radius; } rigidBody.AngularVelocity = 0.0f; rigidBody.LinearVelocity = agent.SuggestedVel; }
public void OnInit(InitContext context) { if (context == InitContext.Activate) { var asr = GameObj.GetComponent <AdvSpriteRenderer>(); if (asr != null) { var color = asr.Color; var fadeColor = color; fadeColor.A = 0; _fadeFunc = (float a) => asr.Color = ColorRgba.Lerp(color, fadeColor, a); } } }
void Start() { MaxHP = HP = 500; GoldCost = 500; Resistance = 4; thisGO = GetComponent <GameObj>(); GameObject GO = GameObject.FindGameObjectWithTag("GameController"); resources = GO.GetComponent <ResControl>(); StartCoroutine(Goldfarm()); }
public void DetachFromDrone() { DroneControl drone; if (_attachedDroneRef != null && _attachedDroneRef.TryGetTarget(out drone)) { drone.BeginFlyAway(); drone.DetachPackage(); } _attachedDroneRef = null; // give the package a slight downward push to make sure it doesn't get stuck in the air // and then gravity takes over, package falls. This works around a bug in the engine GameObj.GetComponent <RigidBody>().ApplyLocalForce(new Vector2(0, -0.01F)); }
void PickedUpByPlayer() { var gameManager = GameObj.ParentScene.FindComponent <GameManager> (); if (gameManager != null) { gameManager.PlayerPickup(Count, type); } else { Log.Game.WriteError("GameManager component is missing from scene!"); } GameObj.DisposeLater(); }
public override void Initialize() { this.m_speechBubble = new SpriteObj("UpArrowSquare_Sprite"); this.m_speechBubble.Flip = SpriteEffects.FlipHorizontally; base.GameObjList.Add(this.m_speechBubble); foreach (GameObj current in base.GameObjList) { if (current.Name == "fountain") { this.m_fountain = current; break; } } (this.m_fountain as SpriteObj).OutlineWidth = 2; this.m_speechBubble.X = this.m_fountain.X; base.Initialize(); }
public static void ParseGenericXML(XmlReader reader, GameObj obj) { CultureInfo cultureInfo = (CultureInfo)CultureInfo.CurrentCulture.Clone(); cultureInfo.NumberFormat.CurrencyDecimalSeparator = "."; obj.PopulateFromXMLReader(reader, cultureInfo); bool flag = false; if (reader.MoveToAttribute("BGLayer")) { flag = bool.Parse(reader.Value); } if (flag) { obj.Layer = -1f; } BreakableObj breakableObj = obj as BreakableObj; if (breakableObj != null) { breakableObj.IsCollidable = true; } }
public override void Dispose() { if (!base.IsDisposed) { Console.WriteLine("Disposing Game Over Screen"); this.m_player = null; this.m_dialoguePlate.Dispose(); this.m_dialoguePlate = null; this.m_continueText.Dispose(); this.m_continueText = null; this.m_playerGhost.Dispose(); this.m_playerGhost = null; this.m_spotlight.Dispose(); this.m_spotlight = null; this.m_playerFallSound.Dispose(); this.m_playerFallSound = null; this.m_playerSwordFallSound.Dispose(); this.m_playerSwordFallSound = null; this.m_playerSwordSpinSound.Dispose(); this.m_playerSwordSpinSound = null; this.m_objKilledPlayer = null; if (this.m_enemyList != null) { this.m_enemyList.Clear(); } this.m_enemyList = null; if (this.m_enemyStoredPositions != null) { this.m_enemyStoredPositions.Clear(); } this.m_enemyStoredPositions = null; this.m_playerFrame.Dispose(); this.m_playerFrame = null; base.Dispose(); } }
public static void Display(GameObj source) { Display(source.Position, source.Scale * 2); }
public static void Display(GameObj source) { var bounds = source.Bounds; Display(new Vector2(CDGMath.RandomInt(bounds.Left, bounds.Right), CDGMath.RandomInt(bounds.Top, bounds.Bottom))); }
public void SetObjectKilledPlayer(GameObj obj) { this.m_objKilledPlayer = obj; }
public static new ProjectileObj Fire(GameObj source) { return Instance.Fire(source, null, null); }
public void CentreAroundObj(GameObj obj) { this.CentreAroundPos(obj.Position, false); }
public override void Dispose() { if (!base.IsDisposed) { Console.WriteLine("Disposing Procedural Level Screen"); Tween.StopAll(false); this.m_currentRoom = null; this.DisposeRTs(); foreach (RoomObj current in this.m_roomList) { current.Dispose(); } this.m_roomList.Clear(); this.m_roomList = null; this.m_enemyStartPositions.Clear(); this.m_enemyStartPositions = null; this.m_tempEnemyStartPositions.Clear(); this.m_tempEnemyStartPositions = null; this.m_textManager.Dispose(); this.m_textManager = null; this.m_physicsManager = null; this.m_projectileManager.Dispose(); this.m_projectileManager = null; this.m_itemDropManager.Dispose(); this.m_itemDropManager = null; this.m_currentRoom = null; this.m_miniMapDisplay.Dispose(); this.m_miniMapDisplay = null; this.m_mapBG.Dispose(); this.m_mapBG = null; this.m_inputMap.Dispose(); this.m_inputMap = null; this.m_lastEnemyHit = null; this.m_playerHUD.Dispose(); this.m_playerHUD = null; this.m_player = null; this.m_enemyHUD.Dispose(); this.m_enemyHUD = null; this.m_impactEffectPool.Dispose(); this.m_impactEffectPool = null; this.m_blackBorder1.Dispose(); this.m_blackBorder1 = null; this.m_blackBorder2.Dispose(); this.m_blackBorder2 = null; this.m_chestList.Clear(); this.m_chestList = null; this.m_projectileIconPool.Dispose(); this.m_projectileIconPool = null; this.m_objKilledPlayer = null; this.m_dungeonLight.Dispose(); this.m_dungeonLight = null; this.m_traitAura.Dispose(); this.m_traitAura = null; this.m_killedEnemyObjList.Clear(); this.m_killedEnemyObjList = null; this.m_roomEnteringTitle.Dispose(); this.m_roomEnteringTitle = null; this.m_roomTitle.Dispose(); this.m_roomTitle = null; this.m_creditsText.Dispose(); this.m_creditsText = null; this.m_creditsTitleText.Dispose(); this.m_creditsTitleText = null; Array.Clear(this.m_creditsTextTitleList, 0, this.m_creditsTextTitleList.Length); Array.Clear(this.m_creditsTextList, 0, this.m_creditsTextList.Length); this.m_creditsTextTitleList = null; this.m_creditsTextList = null; this.m_filmGrain.Dispose(); this.m_filmGrain = null; this.m_objectivePlate.Dispose(); this.m_objectivePlate = null; this.m_objectivePlateTween = null; this.m_sky.Dispose(); this.m_sky = null; this.m_whiteBG.Dispose(); this.m_whiteBG = null; this.m_compassBG.Dispose(); this.m_compassBG = null; this.m_compass.Dispose(); this.m_compass = null; if (this.m_compassDoor != null) { this.m_compassDoor.Dispose(); } this.m_compassDoor = null; this.m_castleBorderTexture.Dispose(); this.m_gardenBorderTexture.Dispose(); this.m_towerBorderTexture.Dispose(); this.m_dungeonBorderTexture.Dispose(); this.m_neoBorderTexture.Dispose(); this.m_castleBorderTexture = null; this.m_gardenBorderTexture = null; this.m_towerBorderTexture = null; this.m_dungeonBorderTexture = null; this.DebugTextObj.Dispose(); this.DebugTextObj = null; base.Dispose(); } }
protected virtual void Activated(GameObj player) { }
public static void AddToPage(GameObj gobj) { if (_GameObjects.Contains(gobj)) throw new Exception("already added"); _Page._Canvas.Children.Add(gobj); _GameObjects.Add(gobj); }
public static void RemoveFromPage(GameObj obj) { _Page._Canvas.Children.Remove(obj); if (!_GameObjects.Contains(obj)) throw new Exception("object does not exsts"); _GameObjects.Remove(obj); }
protected internal void BeginActivate(GameObj player) { }
private void BuildObjects() { world = new GameObj(); world.SpriteName = "world"; bulletObj = new GameObj(); bulletObj.SpriteName = "bullet"; bulletObj.Visible = false; armyMan = new ArmyMan(); objectManager.AddGameObject(world); objectManager.AddGameObject(bulletObj); objectManager.AddGameObject(armyMan); }
public static void Display(GameObj source) { Display(new Vector2(source.X, source.Bounds.Top)); }
private void ReverseObjNames(GameObj obj) { if (obj.Name == "Left") { obj.Name = "Right"; return; } if (obj.Name == "Right") { obj.Name = "Left"; return; } if (obj.Name == "!Left") { obj.Name = "!Right"; return; } if (obj.Name == "!Right") { obj.Name = "!Left"; return; } if (obj.Name == "!RightTop") { obj.Name = "!LeftTop"; return; } if (obj.Name == "!RightBottom") { obj.Name = "!LeftBottom"; return; } if (obj.Name == "!LeftTop") { obj.Name = "!RightTop"; return; } if (obj.Name == "!LeftBottom") { obj.Name = "!RightBottom"; return; } if (obj.Name == "RightTop") { obj.Name = "LeftTop"; return; } if (obj.Name == "RightBottom") { obj.Name = "LeftBottom"; return; } if (obj.Name == "LeftTop") { obj.Name = "RightTop"; return; } if (obj.Name == "LeftBottom") { obj.Name = "RightBottom"; return; } if (obj.Name == "!BottomLeft") { obj.Name = "!BottomRight"; return; } if (obj.Name == "!BottomRight") { obj.Name = "!BottomLeft"; return; } if (obj.Name == "!TopLeft") { obj.Name = "!TopRight"; return; } if (obj.Name == "!TopRight") { obj.Name = "!TopLeft"; return; } if (obj.Name == "BottomLeft") { obj.Name = "BottomRight"; return; } if (obj.Name == "BottomRight") { obj.Name = "BottomLeft"; return; } if (obj.Name == "TopLeft") { obj.Name = "TopRight"; return; } if (obj.Name == "TopRight") { obj.Name = "TopLeft"; } }