private void Load(Core.Transform _transform) { List <Rectangle> dead01 = new List <Rectangle>(); for (int i = 0; i < height; ++i) { dead01.Add(new Rectangle(i * size, size * 3, size, size)); } AddComponent(new Graphics.Sprite(this, "alien02", dead01)); AddComponent(new Graphics.StackAnimator(this)); //UMIERANIE List <Rectangle> dead02 = new List <Rectangle>(); for (int i = 0; i < height; ++i) { dead02.Add(new Rectangle(i * size, size * 8, size, size)); } List <Rectangle> dead03 = new List <Rectangle>(); for (int i = 0; i < height; ++i) { dead03.Add(new Rectangle(i * size, size * 9, size, size)); } List <Rectangle> dead04 = new List <Rectangle>(); for (int i = 0; i < height; ++i) { dead04.Add(new Rectangle(i * size, size * 10, size, size)); } List <Rectangle> dead05 = new List <Rectangle>(); for (int i = 0; i < height; ++i) { dead05.Add(new Rectangle(i * size, size * 11, size, size)); } List <Rectangle> dead06 = new List <Rectangle>(); for (int i = 0; i < height; ++i) { dead06.Add(new Rectangle(i * size, size * 12, size, size)); } GetComponent <Graphics.StackAnimator>().AddAnimation( new Graphics.StackAnimation("Dead", GetComponent <Graphics.Sprite>(), new List <List <Rectangle> > { dead01, dead02, dead03, dead04, dead05 }, 352, false)); GetComponent <Graphics.StackAnimator>().SetAnimation("Dead"); deadSFX = AddComponent(new Audio.AudioSource(this, Audio.SoundContainer.Instance.GetSoundEffect("Alien02Dead"))); deadSFX.Play(); }
private void Load(Core.Transform _transform) { transform = _transform; // Physics AddComponent(new CircleCollider(this, CollisionChanell.InteractPlayer, new Vector2(-4, 0), size)); computerSFX = AddComponent(new Audio.AudioSource(this, Audio.SoundContainer.Instance.GetSoundEffect("Computer"))); computerSFX.Pitch = 0.2f; //Ustawienie animacji włączonego i wyłączonego terminala List <Rectangle> onTerminal = new List <Rectangle>(); for (int i = 0; i < 32; ++i) { onTerminal.Add(new Rectangle(i * 32, 0, 32, 32)); } List <Rectangle> offTerminal = new List <Rectangle>(); for (int i = 0; i < 32; ++i) { offTerminal.Add(new Rectangle(i * 32, 32, 32, 32)); } AddComponent(new Graphics.StackAnimator(this)); GetComponent <Graphics.StackAnimator>().AddAnimation( new Graphics.StackAnimation("On", GetComponent <Graphics.Sprite>(), new List <List <Rectangle> > { onTerminal }, 266, false)); GetComponent <Graphics.StackAnimator>().AddAnimation( new Graphics.StackAnimation("Off", GetComponent <Graphics.Sprite>(), new List <List <Rectangle> > { offTerminal }, 266, false)); AddComponent(new Graphics.Sprite(this, "terminal", onTerminal)); GetComponent <Graphics.StackAnimator>().SetAnimation("On"); //Interakcja AddComponent(new Gameplay.DoorTerminal(this)); }
public Gun(GameObject parent) : base(parent) { currentClipIndex = 1; ShootSoundComponent = Parent.AddComponent(new Audio.AudioSource(Parent, Audio.SoundContainer.Instance.GetSoundEffect("GunShoot"))); }
private void Load(Transform _transform) { // Physics AddComponent(new Body(this)); AddComponent(new CircleCollider(this, CollisionChanell.Player, Vector2.Zero, size / 3)); //AddComponent(new CircleCollider(this, CollisionChanell.Hitbox, Vector2.Zero, size / 2)); walkSFX = AddComponent(new Audio.AudioSource(this, Audio.SoundContainer.Instance.GetSoundEffect("MonkeyWalk"))); walkSFX.Pitch = 0.2f; hitSFX = AddComponent(new Audio.AudioSource(this, Audio.SoundContainer.Instance.GetSoundEffect("MonkeyHit"))); hitSFX.Pitch = 0.2f; idleSFX = AddComponent(new Audio.AudioSource(this, Audio.SoundContainer.Instance.GetSoundEffect("MonkeyIdle"))); idleSFX.Pitch = 0.2f; gameoverSFX = AddComponent(new Audio.AudioSource(this, Audio.SoundContainer.Instance.GetSoundEffect("GameOver"))); // Movement movement = AddComponent(new Navigation.MovementComponent(this)); PlayerState? state = Core.GameManager.Instance.playerState; Console.WriteLine("loading player, state: " + state.HasValue); Gun gun = AddComponent(new Gun(this)); if(state == null) { gun.AddAmmoClip(Gun.pistolClip.Copy()); gun.AddAmmoClip(Gun.rifleClip.Copy()); gun.AddAmmoClip(Gun.shotgunClip.Copy()); gun.AddAmmoClip(Gun.launcherClip.Copy()); gun.ChangeAmmo(typeof(PistolBullet)); } else { foreach(ClipInfo clip in state.Value.ammo) gun.AddAmmoClip(clip.Copy()); gun.ChangeAmmo(state.Value.currentAmmoType); } inputComponent = AddComponent(new Input.InputComponent(this)); // Health healthComponent = AddComponent(new Health(this)); healthComponent.MaxHealth = 200; if(state.HasValue) healthComponent.CurrentValue = state.Value.health; healthComponent.OnDamageTaken += OnDamageTaken; healthComponent.OnDepleted += OnDeath; hud = Core.GameManager.SpawnObject(new UI.PlayerHUD(this)); List<Rectangle> idle01 = new List<Rectangle>(); for(int i = 0; i < height; ++i) idle01.Add(new Rectangle(i * size, 0, size, size)); AddComponent(new Graphics.Sprite(this, "monkey", idle01)); AddComponent(new Graphics.StackAnimator(this)); //STANIE List<Rectangle> idle02 = new List<Rectangle>(); for(int i = 0; i < height; ++i) idle02.Add(new Rectangle(i * size, size, size, size)); GetComponent<Graphics.StackAnimator>().AddAnimation( new Graphics.StackAnimation("Idle", GetComponent<Graphics.Sprite>(), new List<List<Rectangle>> { idle01, idle02 }, 266, true)); //CHODZENIE List<Rectangle> walk01 = new List<Rectangle>(); for(int i = 0; i < height; ++i) idle02.Add(new Rectangle(i * size, size * 2, size, size)); List<Rectangle> walk02 = new List<Rectangle>(); for(int i = 0; i < height; ++i) walk02.Add(new Rectangle(i * size, size * 3, size, size)); GetComponent<Graphics.StackAnimator>().AddAnimation( new Graphics.StackAnimation("Walk", GetComponent<Graphics.Sprite>(), new List<List<Rectangle>> { walk01, idle01, walk02, idle01}, 216, true)); //TRZYMANIE List<Rectangle> hold01 = new List<Rectangle>(); for(int i = 0; i < height; ++i) hold01.Add(new Rectangle(i * size, size * 4, size, size)); List<Rectangle> hold02 = new List<Rectangle>(); for(int i = 0; i < height; ++i) hold02.Add(new Rectangle(i * size, size * 5, size, size)); GetComponent<Graphics.StackAnimator>().AddAnimation( new Graphics.StackAnimation("Hold", GetComponent<Graphics.Sprite>(), new List<List<Rectangle>> { hold01, hold02 }, 266, true)); //TRZYMANIE I CHODZENIE List<Rectangle> holdwalk01 = new List<Rectangle>(); for(int i = 0; i < height; ++i) holdwalk01.Add(new Rectangle(i * size, size * 6, size, size)); List<Rectangle> holdwalk02 = new List<Rectangle>(); for(int i = 0; i < height; ++i) holdwalk02.Add(new Rectangle(i * size, size * 7, size, size)); GetComponent<Graphics.StackAnimator>().AddAnimation( new Graphics.StackAnimation("HoldWalk", GetComponent<Graphics.Sprite>(), new List<List<Rectangle>> { holdwalk01, hold01, holdwalk02, hold01}, 150, true)); //UMIERANIE List<Rectangle> dead01 = new List<Rectangle>(); for(int i = 0; i < height; ++i) dead01.Add(new Rectangle(i * size, size * 8, size, size)); List<Rectangle> dead02 = new List<Rectangle>(); for(int i = 0; i < height; ++i) dead02.Add(new Rectangle(i * size, size * 9, size, size)); GetComponent<Graphics.StackAnimator>().AddAnimation( new Graphics.StackAnimation("Dead", GetComponent<Graphics.Sprite>(), new List<List<Rectangle>> { idle01, dead01, dead02 }, 298, false)); //RZUCANIE List<Rectangle> throw01 = new List<Rectangle>(); for(int i = 0; i < height; ++i) throw01.Add(new Rectangle(i * size, size * 10, size, size)); List<Rectangle> throw02 = new List<Rectangle>(); for(int i = 0; i < height; ++i) throw02.Add(new Rectangle(i * size, size * 11, size, size)); List<Rectangle> throw03 = new List<Rectangle>(); for(int i = 0; i < height; ++i) throw03.Add(new Rectangle(i * size, size * 12, size, size)); GetComponent<Graphics.StackAnimator>().AddAnimation( new Graphics.StackAnimation("Throw", GetComponent<Graphics.Sprite>(), new List<List<Rectangle>> { throw01, throw01, throw02, throw03, hold01 }, 298, false)); GetComponent<Graphics.StackAnimator>().SetAnimation("Hold"); lightOff = Graphics.EffectContainer.Instance.GetEffect("LightOff"); Audio.AudioManager.Instance.PlayerTransform = transform; HealthFx = Graphics.EffectContainer.Instance.GetEffect("HealthFX"); Graphics.ViewManager.Instance.activeEffects.Add(HealthFx); Graphics.ViewManager.Instance.activeEffects.Add(Graphics.EffectContainer.Instance.GetEffect("BloodScreen")); }
public void Load() { AddComponent(new Input.InputUI(this)); clickSFX = AddComponent(new Audio.AudioSource(this, Audio.SoundContainer.Instance.GetSoundEffect("MenuClick"))); hoverSFX = AddComponent(new Audio.AudioSource(this, Audio.SoundContainer.Instance.GetSoundEffect("MenuHover"))); }