public String showing = "Show Slingshot"; //tryb FollowCam
 void Start()
 {
     S        = this; //Zdefiniuj singleton
     level    = 0;
     levelMax = castles.Length;
     StartLevel();
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (aimingMode)
        {
            //Convert mouse to world coordinates
            Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z = 0f;
            //Find the difference from the launchPos to the mouse Position
            Vector3 diff = mousePos - launchPos;
            //Limit the diff to be within the radius of the slingshot collider
            float maxDiff = this.GetComponent <SphereCollider>().radius;
            if (diff.magnitude > maxDiff)
            {
                diff.Normalize();
                diff *= maxDiff;
            }

            //Move the projectile to this new position
            Vector3 projPos = launchPos + diff;
            projectile.transform.position = projPos;
            //What happens when the mouse is now released?
            if (Input.GetMouseButtonUp(0))
            {
                aimingMode = false;
                projectile.GetComponent <Rigidbody>().isKinematic = false;
                projectile.GetComponent <Rigidbody>().velocity    = -diff * velocityMult;
                FollowCam.S.poi = projectile;  //follow the projectile as it flies
                projectile      = null;
                MissionDemolition.ShotFired();
            }
        }
    }
Exemplo n.º 3
0
    public string showing = "Show Slingshot"; // Режим FollowCam

    // Start is called before the first frame update
    void Start()
    {
        S        = this; // Определить объект-одиночку
        level    = 0;
        levelMax = castles.Length;
        StartLevel();
    }
Exemplo n.º 4
0
 public string showing = "Show Slingshot"; //
 // Start is called before the first frame update
 void Start()
 {
     S        = this;
     level    = 0;
     levelMax = castles.Length;
     StartLevel();
 }
    void Update()
    {
        if (!aimingMode)
        {
            return;
        }
        Vector3 mousePos2D = Input.mousePosition;

        mousePos2D.z = -Camera.main.transform.position.z;
        Vector3 mousePos3D   = Camera.main.ScreenToWorldPoint(mousePos2D);
        Vector3 mouseDelta   = mousePos3D - launchPos;
        float   maxMagnitude = this.GetComponent <SphereCollider>().radius;

        if (mouseDelta.magnitude > maxMagnitude)
        {
            mouseDelta.Normalize();
            mouseDelta *= maxMagnitude;
        }

        Vector3 projPos = launchPos + mouseDelta;

        projectile.transform.position = projPos;

        if (Input.GetMouseButtonUp(0))
        {
            aimingMode = false;
            projectile.GetComponent <Rigidbody>().isKinematic = false;
            projectile.GetComponent <Rigidbody>().velocity    = -mouseDelta * velocityMult;
            FollowCam.POI = projectile;
            projectile    = null;
            MissionDemolition.ShotFired();
        }
    }
Exemplo n.º 6
0
    void Update()
    {
        if (!aimingMode)
        {
            return;
        }
        Vector3 mousePos2D = Input.mousePosition;

        mousePos2D.z = -Camera.main.transform.position.z;
        Vector3 mousePos3D = Camera.main.ScreenToWorldPoint(mousePos2D);
        Vector3 mouseDelta = mousePos3D - launchPos;

        if (mouseDelta.magnitude > maxMagnitude)
        {
            mouseDelta = mouseDelta.normalized * maxMagnitude;
        }
        Vector3 projPos = launchPos + mouseDelta;

        projectile.transform.position = projPos;

        if (Input.GetMouseButtonUp(0))
        {
            aimingMode = false;
            FollowCam.S.lockFire();
            MissionDemolition.ShotFired();
            projectile.GetComponent <Rigidbody>().isKinematic = false;
            projectile.GetComponent <Rigidbody>().velocity    = -mouseDelta * velocityMult;
            FollowCam.S.poi = projectile;
            autoReturn      = 500;
            projectile      = null;
        }
    }
Exemplo n.º 7
0
    void GetRequest()
    {
        // PositionCollider positionCollider = Network.GetData().Result;
        //if (!isFire)
        //{
        var pc = Network.GetData(firstName);

        if (pc != null)
        {
            projectile = Instantiate(prefabProjectile) as GameObject;

            // Зробити його кінематичним
            projectile.GetComponent <Rigidbody>().isKinematic = true;
            projectileRigidbody             = projectile.GetComponent <Rigidbody>();
            projectileRigidbody.isKinematic = true;

            Vector3 myPos = new Vector3(pc.pos.X, pc.pos.Y, pc.pos.Z);     //positionCollider.pos;//
            projectile.transform.position   = myPos;
            projectileRigidbody.isKinematic = false;

            Vector3 v = new Vector3(pc.velocity.X, pc.velocity.Y, pc.velocity.Z);    //positionCollider.velocity;
            projectileRigidbody.velocity = v;

            FollowCam.POI = projectile;
            projectile    = null;

            MissionDemolition.ShotFired();     // a
            ProjectileLine.S.poi = projectile;
            isFire = true;
        }
        //}
        Invoke("GetRequest", server_fps);
    }
Exemplo n.º 8
0
 public string showing = "Show Slingshot"; // Режим FollowCam
 // Start is called before the first frame update
 void Start()
 {
     S        = this; // Визначити об’єкт-одиночку
     level    = 0;
     levelMax = castles.Length;
     StartLevel();
 }
Exemplo n.º 9
0
    public string showing = "Slingshot"; // FollowCam mode



    // Use this for initialization
    void Start()
    {
        S        = this; // Define the Singleton
        level    = 0;
        levelMax = castles.Length;
        StartLevel();
    }
Exemplo n.º 10
0
 // Start is called before the first frame update
 void Start()
 {
     S        = this;
     level    = 0;
     levelMax = castles.Length;
     score    = new int[levelMax];
     StartLevel();
 }
    public string showing = "Slingshot"; // FollowCam mode

    void Start()
    {
        S = this; // Define the Singleton

        level = 0;
        levelMax = castles.Length;
        StartLevel();
    }
    private void Start()
    {
        S = this;

        Level    = 0;
        LevelMax = _castles.Length;
        StartLevel();
    }
Exemplo n.º 13
0
    private string showing = "Slingshot"; //FollowCam mode

	
    /*************************************************************************************************
    *** Start
    *************************************************************************************************/
    void Start ()
    {
	   S = this;
	   curLevel = 0;
	   maxLevel = castles.Length;
	   StartLevel();
    
    }//void Start
Exemplo n.º 14
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Projectile")
     {
         Destroy(this.gameObject);
         MissionDemolition.RemoveShotFired();
     }
 }
Exemplo n.º 15
0
 void Start()
 {
     S        = this; // Define the Singleton
     level    = 0;
     levelMax = castles.Length;
     rb       = projectyle.GetComponent <Rigidbody>();
     StartLevel();
 }
Exemplo n.º 16
0
    // Start is called before the first frame update
    void Start()
    {
        S = this;

        level    = 0;
        levelMax = appleTrees.Length;
        StartLevel();
    }
Exemplo n.º 17
0
    private void Update()
    {
        if (!aimingMode)
        {
            return;
        }

        Vector3 mousePos2D = Input.mousePosition;

        mousePos2D.z = -Camera.main.transform.position.z;

        Vector3 mousePos3D = Camera.main.ScreenToWorldPoint(mousePos2D);

        Vector3 mouseDelta = mousePos3D - launchPos;

        // Limit mouse delta to the radius of hte slingshot sphere collider

        float maxMagnitude = this.GetComponent <SphereCollider>().radius;

        if (mouseDelta.magnitude > maxMagnitude)
        {
            mouseDelta.Normalize();

            mouseDelta *= maxMagnitude;
        }

        // Move Projectile to the New Position

        Vector3 projPos = launchPos + mouseDelta;

        projectile.transform.position = projPos;

        if (projectile != null)
        {
            Vector3[] linePositions = new Vector3[] { leftArm.position, projPos, RightArm.position };
            lineRendy.SetPositions(linePositions);
        }

        if (Input.GetMouseButtonUp(0))
        {
            aimingMode = false;

            projectileRigidbody.isKinematic = false;

            projectileRigidbody.velocity = -mouseDelta * velocityMult;

            FollowCam.POI = projectile;

            projectile = null;

            MissionDemolition.ShotFired();

            ProjectileLine.S.poi = projectile;

            lineRendy.enabled = false;
        }
    }
Exemplo n.º 18
0
 void Start()
 {
     S            = this; //Define the Singleton
     currentLevel = "0";
     lowestEver   = -1;
     level        = 0;
     levelMax     = castles.Length;
     StartLevel();
 }
    // Use this for initialization
    void Start()
    {
        S = this;         //Define the singleton
        uiRestartButton.onClick.AddListener(RestartGame);
        loseButton.onClick.AddListener(RestartGame);

        level = Convert.ToInt16(SceneManager.GetActiveScene().name.Substring(7));
        StartLevel();
    }
    void Update()
    {
        //If Slingshot is not in aimingMode, don't run this code

        if (!aimingMode)
        {
            return;
        }

        //Get the current mouse position in 2D screen coordinates

        Vector3 mousePos2D = Input.mousePosition;

        mousePos2D.z = -Camera.main.transform.position.z;

        Vector3 mousePos3D = Camera.main.ScreenToWorldPoint(mousePos2D);

        //Find the delta from the launchPos to mousePos3D

        Vector3 mouseDelta = mousePos3D - launchPos;

        //Limit mouseDelta to the radius of the Slingshot SphereCollider

        float maxMagnitude = this.GetComponent <SphereCollider>().radius;

        if (mouseDelta.magnitude > maxMagnitude)
        {
            mouseDelta.Normalize();

            mouseDelta *= maxMagnitude;
        }

        //Move the projectile to this new position

        Vector3 projPos = launchPos + mouseDelta;

        projectile.transform.position = projPos;

        if (Input.GetMouseButtonUp(0))
        {
            //The Mouse has been released

            aimingMode = false;

            projectileRigidbody.isKinematic = false;

            projectileRigidbody.velocity = -mouseDelta * velocityMult;

            FollowCam.POI = projectile;

            projectile = null;

            MissionDemolition.ShotsFired();

            ProjectileLine.S.poi = projectile;
        }
    }
    private void Start()
    {
        Instance = this;

        Level    = 0;
        LevelMax = Castles.Count;

        StartLevel();
    }
    public string Showing = "Slingshot"; // Follow camera mode

    // Use this for initialization
    void Start()
    {
        // Define the singleton
        S        = this;
        Level    = 0;
        LevelMax = Castles.Length;

        StartLevel();
    }
Exemplo n.º 23
0
    void Start()
    {
        S = this; //Definite Singleton

        level     = 0;
        levelMax  = castles.Length;
        timeCount = lvl1Time;
        StartLevel();
    }
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.collider.CompareTag("Projectile") || collision.collider.CompareTag("Goomba") || collision.collider.CompareTag("CanHurtEnemy") && hit == false)
     {
         hit = true;
         MissionDemolition.PointsGained(1);
         Invoke("Deactivate", 2f);
     }
 }
    void Update()
    {
        if (projectile != null)
        {
            band.SetPosition(1, projectile.transform.position);
        }
        else
        {
            band.SetPosition(1, launchPoint.transform.position);
        }

        if (!aimingMode)
        {
            return;
        }

        Vector3 mousePos2D = Input.mousePosition;                                  // c

        mousePos2D.z = -Camera.main.transform.position.z;
        Vector3 mousePos3D = Camera.main.ScreenToWorldPoint(mousePos2D);

        // Find the delta from the launchPos to the mousePos3D
        Vector3 mouseDelta = mousePos3D - launchPos;
        // Limit mouseDelta to the radius of the Slingshot SphereCollider          // d
        float maxMagnitude = this.GetComponent <SphereCollider>().radius;

        if (mouseDelta.magnitude > maxMagnitude)
        {
            mouseDelta.Normalize();
            mouseDelta *= maxMagnitude;
        }

        // Move the projectile to this new position
        Vector3 projPos = launchPos + mouseDelta;

        projectile.transform.position = projPos;

        if (Input.GetMouseButtonUp(0))                                             // e
        // The mouse has been released

        {
            print("Band Released");


            aimingMode = false;
            projectileRigidbody.isKinematic = false;
            projectileRigidbody.velocity    = -mouseDelta * velocityMult;

            FollowCam.POI = projectile;

            projectile = null;

            MissionDemolition.ShotFired();
            ProjectileLine.S.poi = projectile;
        }
    }
Exemplo n.º 26
0
 void OnCollisionEnter(Collision dataFromCollision)
 {
     if (dataFromCollision.gameObject.name == "Trap")
     {
         MissionDemolition.ShotFired();
         AudioSource trapSound = GameObject.Find("TrapSound").GetComponent <AudioSource>();
         trapSound.Play(0);
         Object.Destroy(this.gameObject);
     }
 }
Exemplo n.º 27
0
 public void bowserDeath()
 {
     GameObject.Find("Icons").GetComponent <UI_IconDisplay>().UpdateIconDisplay();
     MissionDemolition.PointsGained(10);
     Invoke("RemoveBowser", 1.5f);
     if (isGameOver())
     {
         Goal.goalMet = true;
     }
 }
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.collider.name != "CastleGround" &&
         collision.collider.name != "Mario" && collision.collider.tag != "Dummy Projectile" &&
         collision.collider.tag != "Projectile")
     {
         this.collisionHasHappened = true;
         MissionDemolition.PlaySound(1);
     }
 }
    private void Update()
    {
        //If Slingshot is not in aimingMody, don't run
        if (!aimingMode)
        {
            return;
        }

        //Get current mouse pos in 2D screen coordinate
        Vector3 mousePos2D = Input.mousePosition;

        mousePos2D.z = -Camera.main.transform.position.z;
        Vector3 mousePos3D = Camera.main.ScreenToWorldPoint(mousePos2D);

        //Find the delta from the LaunchPos to the mousePos3D
        Vector3 mouseDelta = mousePos3D - launchPos;

        //Limit mouseDelta to the radius of the Slingshot SphereCollider
        float maxMagnitude = this.GetComponent <SphereCollider>().radius;

        if (mouseDelta.magnitude > maxMagnitude)
        {
            mouseDelta.Normalize();
            mouseDelta *= maxMagnitude;
        }
        Vector3 projPos = launchPos + mouseDelta;

        projectile.transform.position = projPos;

        if (Input.GetMouseButtonUp(0))
        {
            //mouse has been released
            aimingMode = false;

            FollowCam.POI = projectile;
            projectile    = null;
            MissionDemolition.shotsFired();
            ProjectileLine.S.poi = projectile;

            /*setting projectile to kinematic gives projectile physics properties,
             * allowing it to move with respect to velocity and gravity*/
            projectileRigidbody.isKinematic = false;

            //rigidbody of projectile given velocity proportional to distance from launchPos
            projectileRigidbody.velocity = -mouseDelta * velocityMult;

            /* sets static public field FollowCam.POI to be newly fired projectile*/
            FollowCam.POI = projectile;

            /*sets to null to allow for another instance of projectile to be created
             * once the slingshot is fired, allowing another shot*/
            projectile = null;
        }
    }
Exemplo n.º 30
0
    // Start is called before the first frame update
    void Start()
    {
        S = this;

        uibPrevious.onClick.AddListener(PreviousLevel);
        uibNext.onClick.AddListener(NextLevel);

        level    = 0;
        levelMax = castles.Length;
        StartLevel();
    }
Exemplo n.º 31
0
    void OnTriggerEnter(Collider other)
    {
        Debug.Log("hit coin");
        if (other.gameObject.tag == "Projectile")
        {
            Material mat = GetComponent <Renderer>().material;
            Debug.Log("hi");
            Destroy(gameObject);

            MissionDemolition.CoinGotten();
        }
    }
 void Start()
 {
     S = this;
     levelMax = castles.Length;
     StartLevel();
 }
    // Use this for initialization
    void Start()
    {
        S = this; // Define the singleton

        level = 0;
        levelMax = castles.Length;
        StartLevel();
    }
    void Start()
    {
        S = this;

        switchViewButtonText = switchViewButton.GetComponentInChildren<Text>();

        level = 0;
        numOfLevels = castles.Length;
        StartLevel();
    }
    void Start()
    {
        S = this;

        level = 0;
        maxLevel = castles.Length;
        StartLevel ();
    }