Beispiel #1
0
        public void SetScale(Vector2 newScale)
        {
            sprite.scale = newScale;
            PhysicsManager.RemoveItem(RigidBody);

            RigidBody      = new RigidBody(Position, this);
            RigidBody.Type = (uint)PhysicsManager.ColliderType.Water;
            RigidBody.SetCollisionMask((uint)PhysicsManager.ColliderType.Player);
        }
        public BorderCrate(Crate crate) : base(Vector2.Zero, "borderCrate", DrawManager.Layer.Playground)
        {
            Crate = crate;

            clipTriggered   = AudioManager.GetAudioClip("crateTriggered");
            crateTriggered  = false;
            timeToTriggered = TIME_TO_TRIGGER_CRATE;

            PhysicsManager.RemoveItem(RigidBody);
            RigidBody = null;
        }
Beispiel #3
0
        public virtual void OnDestroy()
        {
            //togliamo tutti i riferimenti senno la garbage non li cancella
            UpdateManager.RemoveItem(this);
            DrawManager.RemoveItem(this);

            if (RigidBody != null)
            {
                PhysicsManager.RemoveItem(RigidBody);
                RigidBody.Destroy();
            }
        }
        public MobileLeaf(Vector2 spritePosition, float rangeXDist = 120, int xVel = 40, string spriteSheetName = "leafPlatform") : base(spritePosition, spriteSheetName, true, DrawManager.Layer.Background)
        {
            PhysicsManager.RemoveItem(RigidBody);

            sprite.scale = new Vector2(0.5f);

            Rect colliderRect = new Rect(new Vector2(0, 3f), null, Width, Height - 20);

            RigidBody      = new RigidBody(spritePosition, this, null, colliderRect);
            RigidBody.Type = (uint)PhysicsManager.ColliderType.Ground;

            rangePosition = new Tuple <float, float>(Position.X - rangeXDist, Position.X + rangeXDist);
            Velocity      = new Vector2(xVel, 0);
        }
        public CheckpointCrate(Vector2 spritePosition, string spriteSheetName = "checkpoint") : base(spritePosition, spriteSheetName)
        {
            animations[(int)AnimationType.OpenCrate].LoopAtFrame(14);
            Animation.IsActive = false;

            uint collisionMask = RigidBody.CollisionMask;

            PhysicsManager.RemoveItem(RigidBody);

            Rect collider = new Rect(new Vector2(0, 0), null, Width / 2.5f, Height / 2);

            RigidBody = new RigidBody(spritePosition, this, null, collider);
            RigidBody.SetCollisionMask(collisionMask);
            RigidBody.Type = (uint)PhysicsManager.ColliderType.Crate;

            clipHitted = AudioManager.GetAudioClip("checkpointHitted");
        }
        public StoneWhellTrap(Vector2 spritePosition, string spriteSheetName = "stoneWheel") : base(spritePosition, spriteSheetName, DrawManager.Layer.Foreground)
        {
            PhysicsManager.RemoveItem(RigidBody);

            Circle circle = new Circle(Vector2.Zero, null, Height / 1.8f);

            RigidBody = new RigidBody(spritePosition, this, circle);
            RigidBody.AddCollision((uint)PhysicsManager.ColliderType.Ground | (uint)PhysicsManager.ColliderType.Crate | (uint)PhysicsManager.ColliderType.Enemy | (uint)PhysicsManager.ColliderType.Player);
            RigidBody.Type = (uint)PhysicsManager.ColliderType.Trap;
            playerAnimDie  = Player.State.DeathMashed;

            CanWalkable = true;

            initialPos      = Position;
            initialRotation = sprite.EulerRotation;
            VelocityOffset  = 8f;
            clipRotation    = AudioManager.GetAudioClip("stoneWheelRotation");
            clipStopped     = AudioManager.GetAudioClip("stoneHit");
        }
Beispiel #7
0
        public Fire(Vector2 spritePosition, string spriteSheetName = "fire") : base(spritePosition, spriteSheetName, DrawManager.Layer.Foreground)
        {
            sprite.scale = new Vector2(1f, 0.65f);

            PhysicsManager.RemoveItem(RigidBody);

            Rect rect = new Rect(Vector2.Zero, null, Width / 1.8f, Height);

            RigidBody = new RigidBody(spritePosition, this, null, rect);
            RigidBody.SetCollisionMask((uint)PhysicsManager.ColliderType.Player);

            currAnim      = AnimationType.Start;
            timeLoop      = TIME_LOOP_FIRE;
            playerAnimDie = Player.State.DeathBurnt;
            IsActive      = false;

            audioSourceFire = new AudioSource3D(this);

            clipFireBurn = AudioManager.GetAudioClip("fireBurn");
            clipBurned   = AudioManager.GetAudioClip("clipBurn");
        }
        public BorderCrate(Vector2 position, CrateType type) : base(position, "borderCrate", DrawManager.Layer.Playground)
        {
            Crate c = null;

            switch (type)
            {
            case CrateType.Apple:
                c = new AppleCrate(position);
                break;

            case CrateType.Random:
                c = new RandomCrate(position);
                break;

            case CrateType.Life:
                c = new LifeCrate(position);
                break;

            case CrateType.Aku:
                c = new AkuAkuCrate(position);
                break;

            case CrateType.Bounce_Apple:
                c = new AppleBounceCrate(position);
                break;

            case CrateType.Bounce_Wooden:
                c = new WoodenBounceCrate(position);
                break;

            case CrateType.Bounce_Iron:
                c = new IronBounceCrate(position);
                break;

            case CrateType.Iron:
                c = new IronCrate(position);
                break;

            case CrateType.Trigger_Iron:
                c = new TriggerIronCrate(position);
                break;

            case CrateType.Tnt:
                c = new TntCrate(position);
                break;

            case CrateType.Nitro:
                c = new NitroCrate(position);
                break;

            default:
                c = new IronCrate(position);
                break;
            }

            Crate = c;

            clipTriggered   = AudioManager.GetAudioClip("crateTriggered");
            crateTriggered  = false;
            timeToTriggered = TIME_TO_TRIGGER_CRATE;

            PhysicsManager.RemoveItem(RigidBody);
            RigidBody = null;
        }