Projects / Unity / Game prototype

Mission Demolition

A slingshot physics prototype with projectile control and destructible structures.

Unity 6000.0.44f1Game prototype8 coursework scripts

Overview

A Unity coursework prototype exploring mouse input, rigid-body projectiles, castle structures, and camera tracking. The source separates launching, goal detection, level management, and projectile-line drawing into small components.

Implementation highlights

Inside the code

Assets/Scripts/Slingshot.cs

        float maxMagnitude = this.GetComponent<SphereCollider>().radius;
        if (mouseDelta.magnitude > maxMagnitude)
        {
            mouseDelta.Normalize();
            mouseDelta *= maxMagnitude;
        }
        Vector3 projPos = lauchPos + mouseDelta;
        projectile.transform.position = projPos;
        if (Input.GetMouseButtonUp(0))
        {
            aimingMode = false;
            projectile.GetComponent<Rigidbody>().isKinematic = false;
            projectile.GetComponent<Rigidbody>().linearVelocity = -mouseDelta * velocityMult;

            FollowCam.POI = projectile;
            projectile = null;

            MissionDemolition.ShotFired();
Browse all C# files

← Back to Unity Game Development