예제 #1
0
    //for moving object based on gaze coordinates from tracker
    //based on resolution of window
    //receives object, renderer, bounds script, and data script
    //returns vector3 position in world coordinates
    public Vector3 positionObjectWithRendererBoundsData(GameObject theObject, Renderer theRenderer, BoundsCheck theBounds, EyeXGazePoint theData)
    {
        //check bounds
        //use the object with the outermost bounds and a renderer to make the check
        Vector3 boundsVector = theBounds.checkBoundsForRenderer(theRenderer, theData.Viewport);

        //convert viewport vector to world position vector
        Vector3 worldPos = Camera.main.ViewportToWorldPoint(boundsVector);
        worldPos.z = theObject.transform.position.z; //maintain z position for object

        //return new world position
        return worldPos;
    }
예제 #2
0
    private void Awake()
    {
        cube     = transform.Find("Cube").gameObject;
        letter   = GetComponent <TextMesh>();
        rigid    = GetComponent <Rigidbody>();
        bndCheck = GetComponent <BoundsCheck>();
        cubeRend = GetComponent <Renderer>();

        Vector3 vel = Random.onUnitSphere; // get random XYZ velocity

        vel.z = 0;                         // flatten the vel to the XY plane
        vel.Normalize();                   // Normalizing a Vector3 makes it length 1m
        vel           *= Random.Range(driftMinMax.x, driftMinMax.y);
        rigid.velocity = vel;

        transform.rotation = Quaternion.identity;    // set the rotation to [0,0,0] or no rotation

        //set up the rotPerSecond for the Cube child using rotMinMax x & y
        rotPerSecond = new Vector3(Random.Range(rotMinMax.x, rotMinMax.y),
                                   Random.Range(rotMinMax.x, rotMinMax.y),
                                   Random.Range(rotMinMax.x, rotMinMax.y));

        birthTime = Time.time;
    }
예제 #3
0
    private void Awake()
    {
        S         = this;
        _bndCheck = GetComponent <BoundsCheck>();
        Invoke("SpawnEnemy", 1f / enemySpawnPeriod);

        //A generic dictionary with WeaponType as the key
        WEAP_DICT = new Dictionary <WeaponType, WeaponDefinition>();
        foreach (WeaponDefinition def in weaponDefinitions)
        {
            WEAP_DICT[def.type] = def; //In the dictionary we are attaching the specifications (value) of each weapon to the weapon name(key)
        }

        GameObject.Find("Score").GetComponent <UnityEngine.UI.Text>().text = "Score: " + score;
        // Check for a high score in PlayerPrefs
        if (PlayerPrefs.HasKey("highScore"))
        {
            GameObject.Find("HighScore").GetComponent <UnityEngine.UI.Text>().text = "High Score: " + PlayerPrefs.GetInt("highScore");
        }
        else
        {
            PlayerPrefs.SetInt("highScore", 0);
        }
    }
    private void Awake()
    {
        cube = transform.Find("Cube").gameObject;

        letter    = GetComponent <TextMesh>();
        _rigid    = GetComponent <Rigidbody>();
        _bndCheck = GetComponent <BoundsCheck>();
        _cubeRend = cube.GetComponent <Renderer>();

        Vector3 vel = Random.onUnitSphere;

        vel.z = 0;
        vel.Normalize();
        vel            *= Random.Range(driftMinMax.x, driftMinMax.y);
        _rigid.velocity = vel;

        transform.rotation = Quaternion.identity;

        rotPerSecond = new Vector3(Random.Range(rotMinMax.x, rotMinMax.y),
                                   Random.Range(rotMinMax.x, rotMinMax.y),
                                   Random.Range(rotMinMax.x, rotMinMax.y));

        birthTime = Time.time;
    }
예제 #5
0
 private void Awake()
 {
     S         = this;
     _bndCheck = GetComponent <BoundsCheck>();
     Invoke("SpawnEnemy", 1f / enemySpawnPeriod);
 }
예제 #6
0
    private void Awake()
    {
        S = this;
        // Set bndCheck to reference the BoundsCheck component on this GameObject
        _bndCheck = GetComponent <BoundsCheck>();
        // Invoke SpawnEnemy() once (in 2 seconds, based on default values)
        Invoke(nameof(SpawnEnemy), 1f / enemySpawnPerSecond);

        WEAP_DICT = new Dictionary <WeaponType, WeaponDefinition>();
        foreach (var def in weaponDefinitions)
        {
            WEAP_DICT[def.type] = def;
        }
        pausePanel.SetActive(false);
        if (PlayerPrefs.GetInt("bronzeLevelRound") == 1)
        {
            PlayerPrefs.SetInt("enemy4fireshow", 0);
        }
        // Debug.Log("GAME MODE IS: " + PlayerPrefs.GetInt("gameMode") + "BRONZE LEVEL: " + PlayerPrefs.GetInt("bronzeLevelRound"));
        if (PlayerPrefs.GetInt("bronzeLevelRound") == 2)
        {
            PlayerPrefs.SetInt("enemy4fireshow", 1);
            if (PlayerPrefs.GetInt("enemy0show") == 0)
            {
                PlayerPrefs.SetInt("enemy0show", 1);
            }
            else
            {
                Debug.Log("passing1");
                if (PlayerPrefs.GetInt("enemy1show") == 0)
                {
                    PlayerPrefs.SetInt("enemy0show", 1);
                    PlayerPrefs.SetInt("enemy1show", 1);
                    PlayerPrefs.SetString("enemy1color", "enemy1grey");
                }
                else
                {
                    Debug.Log("passing2");
                    if (PlayerPrefs.GetInt("enemy2show") == 0)
                    {
                        PlayerPrefs.SetInt("enemy0show", 1);
                        PlayerPrefs.SetInt("enemy1show", 1);
                        PlayerPrefs.SetInt("enemy2show", 1);
                        PlayerPrefs.SetString("enemy2color", "enemy2grey");
                    }
                    else
                    {
                        Debug.Log("passing3");
                        if (PlayerPrefs.GetInt("enemy3show") == 0)
                        {
                            PlayerPrefs.SetInt("enemy0show", 1);
                            PlayerPrefs.SetInt("enemy1show", 1);
                            PlayerPrefs.SetInt("enemy2show", 1);
                            PlayerPrefs.SetInt("enemy3show", 1);
                            PlayerPrefs.SetString("enemy3color", "enemy3grey");
                        }
                        else
                        {
                            Debug.Log("passing4");
                            if (PlayerPrefs.GetInt("enemy4show") == 0)
                            {
                                PlayerPrefs.SetInt("enemy0show", 1);
                                PlayerPrefs.SetInt("enemy1show", 1);
                                PlayerPrefs.SetInt("enemy2show", 1);
                                PlayerPrefs.SetInt("enemy3show", 1);
                                PlayerPrefs.SetInt("enemy4show", 1);
                                PlayerPrefs.SetString("enemy4color", "enemy4grey");
                            }
                        }
                    }
                }
            }
        }
        if (PlayerPrefs.GetInt("bronzeLevelRound") == 3)
        {
            PlayerPrefs.SetInt("enemy4fireshow", 1);
            if (PlayerPrefs.GetInt("enemy0show") == 0)
            {
                PlayerPrefs.SetInt("enemy0show", 1);
            }
            else
            {
                if (PlayerPrefs.GetInt("enemy1show") == 0)
                {
                    PlayerPrefs.SetInt("enemy0show", 1);
                    PlayerPrefs.SetInt("enemy1show", 1);
                    PlayerPrefs.SetString("enemy1color", "enemy1grey");
                }
                else
                {
                    if (PlayerPrefs.GetInt("enemy2show") == 0)
                    {
                        PlayerPrefs.SetInt("enemy0show", 1);
                        PlayerPrefs.SetInt("enemy1show", 1);
                        PlayerPrefs.SetInt("enemy2show", 1);
                        PlayerPrefs.SetString("enemy2color", "enemy2grey");
                    }
                    else
                    {
                        if (PlayerPrefs.GetInt("enemy3show") == 0)
                        {
                            PlayerPrefs.SetInt("enemy0show", 1);
                            PlayerPrefs.SetInt("enemy1show", 1);
                            PlayerPrefs.SetInt("enemy2show", 1);
                            PlayerPrefs.SetInt("enemy3show", 1);
                            PlayerPrefs.SetString("enemy3color", "enemy3grey");
                        }
                        else
                        {
                            if (PlayerPrefs.GetInt("enemy4show") == 0)
                            {
                                PlayerPrefs.SetInt("enemy0show", 1);
                                PlayerPrefs.SetInt("enemy1show", 1);
                                PlayerPrefs.SetInt("enemy2show", 1);
                                PlayerPrefs.SetInt("enemy3show", 1);
                                PlayerPrefs.SetInt("enemy4show", 1);
                                PlayerPrefs.SetString("enemy4color", "enemy4grey");
                            }
                        }
                    }
                }
            }
        }

        var weaponFireSound = Resources.Load <AudioClip>("weapon_player");

        fireSound.clip = weaponFireSound;
        changeBackground();
        winScoreText.text = PlayerPrefs.GetInt("winScore").ToString();
        PlayerPrefs.SetInt("currentScore", 0);
        displayHighScore.GetComponent <Text>().text = (PlayerPrefs.GetInt("currentScore")).ToString();

        if (PlayerPrefs.GetInt("enemy0show") != 0)
        {
            prefabEnemies[0] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy0color")) as GameObject);
            prefabEnemies[1] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy0color")) as GameObject);
            prefabEnemies[2] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy0color")) as GameObject);
            prefabEnemies[3] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy0color")) as GameObject);
            prefabEnemies[4] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy0color")) as GameObject);
            prefabEnemies[5] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy0color")) as GameObject);
        }
        if (PlayerPrefs.GetInt("enemy1show") != 0)
        {
            prefabEnemies2[0] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy1color")) as GameObject);
            prefabEnemies2[1] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy1color")) as GameObject);
            prefabEnemies2[2] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy1color")) as GameObject);
            prefabEnemies2[3] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy1color")) as GameObject);
            prefabEnemies2[4] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy1color")) as GameObject);
            prefabEnemies2[5] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy1color")) as GameObject);
        }
        if (PlayerPrefs.GetInt("enemy2show") != 0)
        {
            prefabEnemies3[0] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy2color")) as GameObject);
            prefabEnemies3[1] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy2color")) as GameObject);
            prefabEnemies3[2] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy2color")) as GameObject);
            prefabEnemies3[3] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy2color")) as GameObject);
            prefabEnemies3[4] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy2color")) as GameObject);
            prefabEnemies3[5] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy2color")) as GameObject);
        }
        if (PlayerPrefs.GetInt("enemy3show") != 0)
        {
            prefabEnemies4[0] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy3color")) as GameObject);
            prefabEnemies4[1] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy3color")) as GameObject);
            prefabEnemies4[2] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy3color")) as GameObject);
            prefabEnemies4[3] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy3color")) as GameObject);
            prefabEnemies4[4] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy3color")) as GameObject);
            prefabEnemies4[5] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy3color")) as GameObject);
        }
        if (PlayerPrefs.GetInt("enemy4show") != 0)
        {
            prefabEnemies6[0] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy4color")) as GameObject);
            prefabEnemies6[1] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy4color")) as GameObject);
            prefabEnemies6[2] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy4color")) as GameObject);
            prefabEnemies6[3] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy4color")) as GameObject);
            prefabEnemies6[4] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy4color")) as GameObject);
            prefabEnemies6[5] = (Resources.Load("_Prefabs/" + PlayerPrefs.GetString("enemy4color")) as GameObject);
        }
        if (PlayerPrefs.GetInt("enemy4fireshow") != 0)
        {
            prefabEnemies5[0] = (Resources.Load("_Prefabs/" + "enemy4redFire") as GameObject);
            prefabEnemies5[1] = (Resources.Load("_Prefabs/" + "enemy4redFire") as GameObject);
            prefabEnemies5[2] = (Resources.Load("_Prefabs/" + "enemy4redFire") as GameObject);
            prefabEnemies5[3] = (Resources.Load("_Prefabs/" + "enemy4redFire") as GameObject);
            prefabEnemies5[4] = (Resources.Load("_Prefabs/" + "enemy4redFire") as GameObject);
            prefabEnemies5[5] = (Resources.Load("_Prefabs/" + "enemy4redFire") as GameObject);
        }
    }
예제 #7
0
 void Awake()
 {
     bndCheck = GetComponent <BoundsCheck>();
 }
예제 #8
0
 void Awake()
 {
     S        = this;
     bndCheck = GetComponent <BoundsCheck>();
     Invoke("SpawnEnemy", 1f / enemySpawnPerSecond);
 }
예제 #9
0
 protected void Awake()
 {
     boundsCheck = GetComponent <BoundsCheck>();
     //boundsCheck.keepOnScreen = false;
 }
예제 #10
0
 void Awake()
 {
     bndCheck = GetComponent <BoundsCheck>(); //checks to see if BoundsCheck script is attached, if not bndCheck set to NULL
 }
예제 #11
0
파일: Enemy.cs 프로젝트: BenRenaud/Bentendo
    void Awake()
    {
        bndCheck      = GetComponent <BoundsCheck>();
        materials     = Utils.GetAllMaterials(gameObject);
        orginalColors = new Color[materials.Length];
        for (int i = 0; i < materials.Length; i++)
        {
            if (gameObject.name.Equals("Enemy_0(Clone)"))
            {
                if (Main.E0color.Equals("blue"))
                {
                    orginalColors[i] = Color.blue;
                }

                else if (Main.E0color.Equals("yellow"))
                {
                    orginalColors[i] = Color.yellow;
                }

                else if (Main.E0color.Equals("green"))
                {
                    orginalColors[i] = Color.green;
                }

                else
                {
                    orginalColors[i] = Color.white;
                }
            }

            else if (gameObject.name.Equals("Enemy_1(Clone)"))
            {
                if (Main.E1color.Equals("blue"))
                {
                    orginalColors[i] = Color.blue;
                }

                else if (Main.E1color.Equals("yellow"))
                {
                    orginalColors[i] = Color.yellow;
                }

                else if (Main.E1color.Equals("green"))
                {
                    orginalColors[i] = Color.green;
                }

                else
                {
                    orginalColors[i] = Color.white;
                }
            }

            else if (gameObject.name.Equals("Enemy_2(Clone)"))
            {
                if (Main.E2color.Equals("blue"))
                {
                    orginalColors[i] = Color.blue;
                }

                else if (Main.E2color.Equals("yellow"))
                {
                    orginalColors[i] = Color.yellow;
                }

                else if (Main.E2color.Equals("green"))
                {
                    orginalColors[i] = Color.green;
                }

                else
                {
                    orginalColors[i] = Color.white;
                }
            }

            else if (gameObject.name.Equals("Enemy_3(Clone)"))
            {
                if (Main.E3color.Equals("blue"))
                {
                    orginalColors[i] = Color.blue;
                }

                else if (Main.E3color.Equals("yellow"))
                {
                    orginalColors[i] = Color.yellow;
                }

                else if (Main.E3color.Equals("green"))
                {
                    orginalColors[i] = Color.green;
                }

                else
                {
                    orginalColors[i] = Color.white;
                }
            }

            else
            {
                if (Main.E4color.Equals("blue"))
                {
                    orginalColors[i] = Color.blue;
                }

                else if (Main.E4color.Equals("yellow"))
                {
                    orginalColors[i] = Color.yellow;
                }

                else if (Main.E4color.Equals("green"))
                {
                    orginalColors[i] = Color.green;
                }

                else
                {
                    orginalColors[i] = Color.white;
                }
            }
        }
    }
예제 #12
0
 void Awake()
 {
     bndCheck = GetComponent <BoundsCheck>(); // set boundscheck components
 }
예제 #13
0
파일: Site.cs 프로젝트: Slazanger/SMT
        private void Connect(ref List <Vector2f> points, int j, Rectf bounds, bool closingUp = false)
        {
            Vector2f rightPoint     = points[points.Count - 1];
            Edge     newEdge        = edges[j];
            LR       newOrientation = edgeOrientations[j];

            // The point that must be conected to rightPoint:
            Vector2f newPoint = newEdge.ClippedEnds[newOrientation];

            if (!CloseEnough(rightPoint, newPoint))
            {
                // The points do not coincide, so they must have been clipped at the bounds;
                // see if they are on the same border of the bounds:
                if (rightPoint.x != newPoint.x && rightPoint.y != newPoint.y)
                {
                    // They are on different borders of the bounds;
                    // insert one or two corners of bounds as needed to hook them up:
                    // (NOTE this will not be correct if the region should take up more than
                    // half of the bounds rect, for then we will have gone the wrong way
                    // around the bounds and included the smaller part rather than the larger)
                    int   rightCheck = BoundsCheck.Check(rightPoint, bounds);
                    int   newCheck = BoundsCheck.Check(newPoint, bounds);
                    float px, py;
                    if ((rightCheck & BoundsCheck.RIGHT) != 0)
                    {
                        px = bounds.right;

                        if ((newCheck & BoundsCheck.BOTTOM) != 0)
                        {
                            py = bounds.bottom;
                            points.Add(new Vector2f(px, py));
                        }
                        else if ((newCheck & BoundsCheck.TOP) != 0)
                        {
                            py = bounds.top;
                            points.Add(new Vector2f(px, py));
                        }
                        else if ((newCheck & BoundsCheck.LEFT) != 0)
                        {
                            if (rightPoint.y - bounds.y + newPoint.y - bounds.y < bounds.height)
                            {
                                py = bounds.top;
                            }
                            else
                            {
                                py = bounds.bottom;
                            }
                            points.Add(new Vector2f(px, py));
                            points.Add(new Vector2f(bounds.left, py));
                        }
                    }
                    else if ((rightCheck & BoundsCheck.LEFT) != 0)
                    {
                        px = bounds.left;

                        if ((newCheck & BoundsCheck.BOTTOM) != 0)
                        {
                            py = bounds.bottom;
                            points.Add(new Vector2f(px, py));
                        }
                        else if ((newCheck & BoundsCheck.TOP) != 0)
                        {
                            py = bounds.top;
                            points.Add(new Vector2f(px, py));
                        }
                        else if ((newCheck & BoundsCheck.RIGHT) != 0)
                        {
                            if (rightPoint.y - bounds.y + newPoint.y - bounds.y < bounds.height)
                            {
                                py = bounds.top;
                            }
                            else
                            {
                                py = bounds.bottom;
                            }
                            points.Add(new Vector2f(px, py));
                            points.Add(new Vector2f(bounds.right, py));
                        }
                    }
                    else if ((rightCheck & BoundsCheck.TOP) != 0)
                    {
                        py = bounds.top;

                        if ((newCheck & BoundsCheck.RIGHT) != 0)
                        {
                            px = bounds.right;
                            points.Add(new Vector2f(px, py));
                        }
                        else if ((newCheck & BoundsCheck.LEFT) != 0)
                        {
                            px = bounds.left;
                            points.Add(new Vector2f(px, py));
                        }
                        else if ((newCheck & BoundsCheck.BOTTOM) != 0)
                        {
                            if (rightPoint.x - bounds.x + newPoint.x - bounds.x < bounds.width)
                            {
                                px = bounds.left;
                            }
                            else
                            {
                                px = bounds.right;
                            }
                            points.Add(new Vector2f(px, py));
                            points.Add(new Vector2f(px, bounds.bottom));
                        }
                    }
                    else if ((rightCheck & BoundsCheck.BOTTOM) != 0)
                    {
                        py = bounds.bottom;

                        if ((newCheck & BoundsCheck.RIGHT) != 0)
                        {
                            px = bounds.right;
                            points.Add(new Vector2f(px, py));
                        }
                        else if ((newCheck & BoundsCheck.LEFT) != 0)
                        {
                            px = bounds.left;
                            points.Add(new Vector2f(px, py));
                        }
                        else if ((newCheck & BoundsCheck.TOP) != 0)
                        {
                            if (rightPoint.x - bounds.x + newPoint.x - bounds.x < bounds.width)
                            {
                                px = bounds.left;
                            }
                            else
                            {
                                px = bounds.right;
                            }
                            points.Add(new Vector2f(px, py));
                            points.Add(new Vector2f(px, bounds.top));
                        }
                    }
                }
                if (closingUp)
                {
                    // newEdge's ends have already been added
                    return;
                }
                points.Add(newPoint);
            }
            Vector2f newRightPoint = newEdge.ClippedEnds[LR.Other(newOrientation)];

            if (!CloseEnough(points[0], newRightPoint))
            {
                points.Add(newRightPoint);
            }
        }
예제 #14
0
    //init
    void Start()
    {
        //properties
        currentLevel = 0; //initial level
        isGameOver = false; //initial flag

        //objects
        theCam = Camera.main; //main camera in scene
        theGame = GameObject.FindWithTag(TAG_GAME); //game manager object in scene
        theDimView = GameObject.FindWithTag(TAG_DIMVIEW); //dim view game object in scene
        theVisor = GameObject.FindWithTag(TAG_VISOR); //visor object in scene
        theVisorFrameView = GameObject.FindWithTag(TAG_VISOR_FRAMEVIEW); //visor frame view object in scene
        theTargets = GameObject.FindWithTag(TAG_TARGETS); //targets game object container in scene
        theTutorial = GameObject.FindWithTag(TAG_TUTORIAL); //tutorial game object container in scene

        //scripts
        theBounds = theGame.AddComponent<BoundsCheck>(); //add new bounds script
        theWave = theGame.AddComponent<Wave>(); //add new wave script
        theVisorRechargeScript = theVisor.GetComponent<Recharge>(); //visor recharge script
        theVisorGazeMoveScript = theVisor.GetComponent<GazeMove>(); //visor gazemove script

        //init tutorial wave
        //a single target that must be destroyed to advance
        theWave = theWave.waveWithPrefabParentLimits(target_00, theTargets, 1, 1, 0);

        //update score
        ScoreManager.Instance.resetScore();

        UnityEngine.Debug.Log("[GameManager] Starting the game!");

        //transition into scene via state manager
        if (StateManager.Instance != null) {
            TransitionFade theTransition = StateManager.Instance.gameObject.GetComponent<TransitionFade>();
            theTransition.toggleFade();
        }

        //audio
        if (AudioManager.Instance != null) {
            AudioManager.Instance.toggleFade();
        }

        //Debug
        debugOn = false;

        //listen for gaze data
        EyeXGazePointProvider.GetInstance().StartStreaming(EyeXGazePointType.GazeUnfiltered);
    }
예제 #15
0
 void Awake()
 {
     rend       = GetComponent <Renderer>();
     rigid      = GetComponent <Rigidbody>();
     _bndsCheck = gameObject.GetComponent <BoundsCheck>();
 }
예제 #16
0
 void Start()
 {
     bndcheck       = GetComponent <BoundsCheck>();
     rigid.velocity = Vector3.down * speed;
 }
예제 #17
0
 void Awake() //this method takes place before any other method so it can get the BoundsCheck class
 {
     bndCheck = GetComponent <BoundsCheck>();
 }
예제 #18
0
 void Start()
 {
     bndCheck = GetComponent <BoundsCheck>();
 }
 void Start()
 {
     _bndsCheck = GetComponent <BoundsCheck>(); //Bounds Check
     _bndsCheck.keepOnScreen = false;
 }
예제 #20
0
 private void Awake()
 {
     bndCheck = GetComponent <BoundsCheck>(); // on awake, check object against code in boundsCheck
 }
예제 #21
0
 private void Awake()
 {
     S        = this;
     bndCheck = GetComponent <BoundsCheck>();
     Invoke("SpawnEnemy", 1f / enemiesSpwnedPerSecond);
 }
예제 #22
0
 void Awake()
 {
     // calls on BoundsCheck script
     _bndCheck = GetComponent <BoundsCheck>();
 }
예제 #23
0
 void Awake()
 { //initialize components
     _bndCheck = GetComponent <BoundsCheck>();
     _rend     = GetComponent <Renderer>();
     rigidBody = GetComponent <Rigidbody>();
 }
예제 #24
0
 //Initialize boundsCheck object
 void Start()
 {
     boundsCheck = gameObject.GetComponent <BoundsCheck>();
 }
예제 #25
0
 // Use this for initialization
 void Start()
 {
     bc = GetComponent <BoundsCheck>();
     GetComponent <Collider>().enabled = false;
 }
예제 #26
0
 void Awake()
 {
     _bndCheck = GetComponent <BoundsCheck>();//when an enemy is instantiated, a BoundsCheck component is created and we can access variables from it
 }
예제 #27
0
 //Initialize BoundsCheck and Rigidbody fields
 private void Awake()
 {
     boundsCheck = GetComponent <BoundsCheck>();
     rb          = GetComponent <Rigidbody>();
 }
예제 #28
0
        private void Connect(List <Point> points, int j, Rectangle bounds, bool Closing)
        {
            Point       rightPoint = points[points.Count - 1];
            Edge        nEdge      = edges[j];
            Orientation nOrient    = edgeOrientations[j];
            Point       nPoint     = nEdge.GetClippedEnds()[nOrient];

            if (CloseEnough(rightPoint, nPoint))
            {
                if ((rightPoint.x != nPoint.x) && (rightPoint.y != nPoint.y))
                {
                    int rightCheck = BoundsCheck.Check(rightPoint, bounds);
                    int nCheck     = BoundsCheck.Check(nPoint, bounds);

                    double pX;
                    double pY;

                    if ((rightCheck & BoundsCheck.RIGHT) != 0)
                    {
                        pX = bounds.right;
                        if ((nCheck & BoundsCheck.BOTTOM) != 0)
                        {
                            pY = bounds.bottom;
                            points.Add(new Point(pX, pY));
                        }
                        else if ((nCheck & BoundsCheck.TOP) != 0)
                        {
                            pY = bounds.top;
                            points.Add(new Point(pX, pY));
                        }
                        else if ((nCheck & BoundsCheck.LEFT) != 0)
                        {
                            if (((rightPoint.y - bounds.y + nPoint.y) - bounds.y) < bounds.height)
                            {
                                pY = bounds.top;
                            }
                            else
                            {
                                pY = bounds.bottom;
                            }

                            points.Add(new Point(pX, pY));
                            points.Add(new Point(bounds.left, pY));
                        }
                    }
                    else if ((rightCheck & BoundsCheck.LEFT) != 0)
                    {
                        pX = bounds.left;

                        if ((nCheck & BoundsCheck.BOTTOM) != 0)
                        {
                            pY = bounds.bottom;
                            points.Add(new Point(pX, pY));
                        }
                        else if ((nCheck & BoundsCheck.TOP) != 0)
                        {
                            pY = bounds.top;
                            points.Add(new Point(pX, pY));
                        }
                        else if ((nCheck & BoundsCheck.RIGHT) != 0)
                        {
                            if (((rightPoint.y - bounds.y + nPoint.y) - bounds.y) < bounds.height)
                            {
                                pY = bounds.top;
                            }
                            else
                            {
                                pY = bounds.bottom;
                            }

                            points.Add(new Point(pX, pY));
                            points.Add(new Point(bounds.right, pY));
                        }
                    }
                    else if ((rightCheck & BoundsCheck.TOP) != 0)
                    {
                        pY = bounds.top;

                        if ((nCheck & BoundsCheck.RIGHT) != 0)
                        {
                            pX = bounds.right;
                            points.Add(new Point(pX, pY));
                        }
                        else if ((nCheck & BoundsCheck.LEFT) != 0)
                        {
                            pX = bounds.left;
                            points.Add(new Point(pX, pY));
                        }
                        else if ((nCheck & BoundsCheck.BOTTOM) != 0)
                        {
                            if (((rightPoint.x - bounds.x + nPoint.x) - bounds.x) < bounds.width)
                            {
                                pX = bounds.left;
                            }
                            else
                            {
                                pX = bounds.right;
                            }

                            points.Add(new Point(pX, pY));
                            points.Add(new Point(pX, bounds.bottom));
                        }
                    }
                    else if ((rightCheck & BoundsCheck.BOTTOM) != 0)
                    {
                        pY = bounds.bottom;

                        if ((nCheck & BoundsCheck.RIGHT) != 0)
                        {
                            pX = bounds.right;
                            points.Add(new Point(pX, pY));
                        }
                        else if ((nCheck & BoundsCheck.LEFT) != 0)
                        {
                            pX = bounds.left;
                            points.Add(new Point(pX, pY));
                        }
                        else if ((nCheck & BoundsCheck.TOP) != 0)
                        {
                            if (((rightPoint.x - bounds.x + nPoint.x) - bounds.x) < bounds.width)
                            {
                                pX = bounds.left;
                            }
                            else
                            {
                                pX = bounds.right;
                            }

                            points.Add(new Point(pX, pY));
                            points.Add(new Point(pX, bounds.top));
                        }
                    }
                }

                if (Closing)
                {
                    return;
                }

                points.Add(nPoint);
            }

            Point nRightPoint = nEdge.GetClippedEnds()[Orientation.Other(nOrient)];

            if (!CloseEnough(points[0], nRightPoint))
            {
                points.Add(nRightPoint);
            }
        }
예제 #29
0
 // Use this for initialization
 void Awake()
 {
     bndCheck = GetComponent <BoundsCheck>();
     rend     = GetComponent <Renderer>();
     rigid    = GetComponent <Rigidbody>();
 }
예제 #30
0
 // Start is called before the first frame update
 void Start()
 {
     bndCheck = GetComponent <BoundsCheck>(); // get bound check
 }
예제 #31
0
 void Awake()
 {
     //get BoundsCheck
     boundCheck = GetComponent <BoundsCheck> ();
 }
예제 #32
0
 void Awake()
 {
     _bndCheck = GetComponent <BoundsCheck>();//getting the correct components when awoken
     _rend     = GetComponent <Renderer>();
     rigid     = GetComponent <Rigidbody>();
 }