コード例 #1
0
 void Start()
 {
     gameController = GameObject.FindGameObjectWithTag("Grid").GetComponent<GameControllerBehaviour>();
     playerSquadTotal = 10;
     computerSquadTotal = 10;
     StartingHonor();
 }
コード例 #2
0
 void Start()
 {
     gameController     = GameObject.FindGameObjectWithTag("Grid").GetComponent <GameControllerBehaviour>();
     playerSquadTotal   = 10;
     computerSquadTotal = 10;
     StartingHonor();
 }
コード例 #3
0
    // Start is called before the first frame update
    void Start()
    {
        StartCoroutine(DelayQuit());
        GameControllerBehaviour controller = GameObject.Find("GameController")
                                             .GetComponent <GameControllerBehaviour>();

        controller.CancelInvoke(); // Stops the coroutine spawnRock.
    }
コード例 #4
0
	/// <summary>
	/// Start this instance.
	/// </summary>
	//protected override void Start()
	void Start()
	{
		//base.Start();
		isEnabled = false;
		// Commented out until we have art assests
		//ToggleMenuGroup();
		gameController = GameObject.FindGameObjectWithTag("Grid").GetComponent<GameControllerBehaviour>();
		//menuGroup = GameObject.Find("Menu Group HUD").gameObject;
	}
コード例 #5
0
ファイル: HUDController.cs プロジェクト: vincent2421/Game
 /// <summary>
 /// Start this instance.
 /// </summary>
 //protected override void Start()
 void Start()
 {
     //base.Start();
     isEnabled = false;
     // Commented out until we have art assests
     //ToggleMenuGroup();
     gameController = GameObject.FindGameObjectWithTag("Grid").GetComponent <GameControllerBehaviour>();
     //menuGroup = GameObject.Find("Menu Group HUD").gameObject;
 }
コード例 #6
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0))
     {
         GameControllerBehaviour controller = GetComponent <GameControllerBehaviour>();
         controller.InvokeRepeating("spawnRock", 1.5f, 1);
         player.GetComponent <Rigidbody2D>().isKinematic = false;
         Destroy(this);
     }
 }
コード例 #7
0
	/// <summary>
	/// Captures an instance of the game controller behavior from the game object.
	/// </summary>
	/// <remarks>
	/// Because GameControllerBehavior is a required component (see class attributes),
	/// this will never be null.
	/// </remarks>
	public void Start()
	{
		gameController = GetComponent<GameControllerBehaviour>();
		grid = GetComponent<GridBehavior>();

		// Locate a CameraBehavior if one is set.
		GameObject cameraObject = GameObject.FindGameObjectWithTag(CAMERA_TAG);
		if(cameraObject)
			camera = cameraObject.GetComponent<CameraBehavior>();
	}
コード例 #8
0
    /// <summary>
    /// Captures an instance of the game controller behavior from the game object.
    /// </summary>
    /// <remarks>
    /// Because GameControllerBehavior is a required component (see class attributes),
    /// this will never be null.
    /// </remarks>
    public void Start()
    {
        gameController = GetComponent <GameControllerBehaviour>();
        grid           = GetComponent <GridBehavior>();

        // Locate a CameraBehavior if one is set.
        GameObject cameraObject = GameObject.FindGameObjectWithTag(CAMERA_TAG);

        if (cameraObject)
        {
            camera = cameraObject.GetComponent <CameraBehavior>();
        }
    }
コード例 #9
0
    /// <summary>
    /// Captures a reference to the Grid and Game Controller components on the object.
    /// </summary>
    public void Start()
    {
        controller = GetComponent <GameControllerBehaviour>();
        if (controller == null)
        {
            Debug.LogError("GridControlBehavior is applied to an object that does not have the GameControllerBehavior!");
        }

        grid = GetComponent <GridBehavior>();
        if (grid == null)
        {
            Debug.LogError("GridBehavior is applied to an object that does not have the GridBehavior!");
        }
    }
コード例 #10
0
    /// <summary>
    /// Completes the combat,
    /// </summary>
    /// <param name="losingSquad">
    /// Reference to the squad that lost the combat.
    /// </param>
    private void endCombat(CombatSquadBehavior losingSquad)
    {
        MonoBehaviour[] objects = GetComponentsInChildren <MonoBehaviour>();
        for (int _i = (objects.Count() - 1); _i >= 0; _i--)
        {
            if (objects[_i].name == "__UNITBASE__")
            {
                DestroyImmediate(objects[_i].gameObject);
            }
        }

        if (losingSquad != null)
        {
            ActorBehavior actor = losingSquad.GetComponent <ActorBehavior>();
            if (actor != null && grid.ignoreList.Contains(actor.currentMovePoint))
            {
                grid.ignoreList.Remove(actor.currentMovePoint);
            }

            // Retrieve the game controller to determine which side the losing team was on.
            GameControllerBehaviour gameController = grid.GetComponent <GameControllerBehaviour>();
            if (actor.theSide == GameControllerBehaviour.UnitSide.player)
            {
                gameController.playerTeamTotal--;
            }
            else
            {
                gameController.enemyTeamTotal--;
            }

            Destroy(losingSquad.gameObject);
        }

        foreach (NodeSkeletonBehavior node in unitPrefabs)
        {
            DestroyImmediate(node.gameObject);
        }

        this.offensiveSquad = null;
        this.defensiveSquad = null;

        GridBehavior.preCombat       = false;
        HonorSystemBehavior.inCombat = true;
        GridBehavior.inCombat        = false;
        AudioBehavior.inCombat       = false;
    }
コード例 #11
0
	/// <summary>
	/// Captures a reference to the Grid and Game Controller components on the object.
	/// </summary>
	public void Start()
	{
		controller = GetComponent<GameControllerBehaviour>();
		if(controller == null)
			Debug.LogError ("GridControlBehavior is applied to an object that does not have the GameControllerBehavior!");

		grid = GetComponent<GridBehavior>();
		if(grid == null)
			Debug.LogError ("GridBehavior is applied to an object that does not have the GridBehavior!");
	}
コード例 #12
0
ファイル: GridBehavior.cs プロジェクト: vincent2421/Game
    /// <summary>
    /// This to setup neighbor lists for each node in the grid.
    ///
    /// Alex Reiss
    /// </summary>
    void Start()
    {
        int currentIndex = 0;

        gameController = GetComponent <GameControllerBehaviour>();

        for (int index = 0; index < gameController.enemyTeam.Count; index++)
        {
            ignoreList.Add(gameController.enemyTeam[index].currentMovePoint);
        }
        for (int index = 0; index < gameController.playerTeam.Count; index++)
        {
            ignoreList.Add(gameController.playerTeam[index].currentMovePoint);
        }
        for (int index = 0; index < gameController.nuetrals.Count; index++)
        {
            ignoreList.Add(gameController.nuetrals[index].currentMovePoint);
        }

        for (int length = 0; length < theMapLength; length++)
        {
            for (int width = 0; width < theMapWidth; width++)
            {
                if (theMap[width + (length * theMapWidth)])
                {
                    theMap[width + (length * theMapWidth)].index = currentIndex;
                }


                if (length < theMapLength - 1)
                {
                    if (isFenced)
                    {
                        if (theMap[width + (length * theMapWidth)] && theMap[width + ((length + 1) * theMapWidth)] && theVerticalFence[width + (length * theMapWidth)])
                        {
                            theMap[width + (length * theMapWidth)].neighborList[0]       = theMap[width + ((length + 1) * theMapWidth)];
                            theMap[width + ((length + 1) * theMapWidth)].neighborList[2] = theMap[width + (length * theMapWidth)];
                        }
                    }
                    else
                    {
                        if (theMap[width + (length * theMapWidth)] && theMap[width + ((length + 1) * theMapWidth)])
                        {
                            theMap[width + (length * theMapWidth)].neighborList[0]       = theMap[width + ((length + 1) * theMapWidth)];
                            theMap[width + ((length + 1) * theMapWidth)].neighborList[2] = theMap[width + (length * theMapWidth)];
                        }
                    }
                }

                if (width < theMapWidth - 1)
                {
                    if (isFenced)
                    {
                        if (theMap[width + (length * theMapWidth)] && theMap[width + 1 + (length * theMapWidth)] && theHorizontalFence[width + (length * theMapWidth)])
                        {
                            theMap[width + (length * theMapWidth)].neighborList[1]     = theMap[width + 1 + (length * theMapWidth)];
                            theMap[width + 1 + (length * theMapWidth)].neighborList[3] = theMap[width + (length * theMapWidth)];
                        }
                    }
                    else
                    {
                        if (theMap[width + (length * theMapWidth)] && theMap[width + 1 + (length * theMapWidth)])
                        {
                            theMap[width + (length * theMapWidth)].neighborList[1]     = theMap[width + 1 + (length * theMapWidth)];
                            theMap[width + 1 + (length * theMapWidth)].neighborList[3] = theMap[width + (length * theMapWidth)];
                        }
                    }
                }

                currentIndex++;
            }
        }
    }
コード例 #13
0
 void Init()
 {
     instance         = this;
     timeToDeathConst = timeToDeath;
     CreateTree();
 }
コード例 #14
0
 /// <summary>
 /// Sets the reference to the game controller
 /// </summary>
 private void Awake()
 {
     gc = GameObject.FindWithTag("GameController").GetComponent <GameControllerBehaviour>();
 }
コード例 #15
0
    void Start()
    {
        theMiniMap = new MiniMapPointBehaviour[theGrid.theMapLength * theGrid.theMapWidth];
        gameController = GameObject.FindGameObjectWithTag("Grid").GetComponent<GameControllerBehaviour>();

        miniMapWidth = theGrid.theMapWidth;
        miniMapLength = theGrid.theMapLength;

        float xPositionOffset = -(miniMapWidth / 2.0f);
        float yPositionOffset = -(miniMapLength / 2.0f);
        float currentXPosition = 0.0f;
        float currentYPosition = 0.0f;

        for (int x = 0; x < miniMapLength; x++)
        {
            currentXPosition = xPositionOffset * 0.1f + 0.05f;
            currentYPosition = (yPositionOffset + x + 0.5f) * 0.1f;

            for (int z = 0; z < miniMapWidth; z++)
            {
                MiniMapPointBehaviour newMiniMapPoint = null;
                newMiniMapPoint = (MiniMapPointBehaviour)Instantiate(miniPointPrefab, new Vector3(currentXPosition, 0.0f, currentYPosition), Quaternion.identity);
                newMiniMapPoint.transform.parent = transform;
                newMiniMapPoint.name = abc[z].ToString() + x.ToString();
                newMiniMapPoint.transform.localPosition = new Vector3(currentXPosition, currentYPosition, -0.01f);
                currentXPosition = (xPositionOffset + z + 1) * 0.1f + 0.05f;
                theMiniMap[z + (x * miniMapWidth)] = newMiniMapPoint;
            }
        }

        for (int x = 0; x < miniMapLength; x++)
        {
            for (int z = 0; z < miniMapWidth; z++)
            {
                if (!theGrid.theMap[z + (x * miniMapWidth)])
                {
                    Destroy(theMiniMap[z + (x * miniMapWidth)].gameObject);
                }
            }
        }

        for (int i = 0; i < gameController.playerTeam.Count; i++)
        {
            MiniMapActorBehavior newMiniMapPlayer = null;
            newMiniMapPlayer = (MiniMapActorBehavior)Instantiate(miniMapPlayer, new Vector3(0, 0.0f, 0.5f), Quaternion.identity);
            newMiniMapPlayer.transform.parent = transform;
            newMiniMapPlayer.transform.localPosition = new Vector3(0.0f, 0.0f, 0.1f);

            playerSquadList.Add(newMiniMapPlayer);
        }

        for (int i = 0; i < gameController.enemyTeam.Count; i++)
        {
            MiniMapActorBehavior newMiniMapEnemy = null;
            newMiniMapEnemy = (MiniMapActorBehavior)Instantiate(miniMapEnemy, new Vector3(0, 0.0f, 0.5f), Quaternion.identity);
            newMiniMapEnemy.transform.parent = transform;
            newMiniMapEnemy.transform.localPosition = new Vector3(0.0f, 0.0f, 0.1f);

            enemySquadList.Add(newMiniMapEnemy);
        }

        for (int i = 0; i < gameController.nuetrals.Count; i++)
        {
            MiniMapActorBehavior newMiniMapNuetral = null;
            newMiniMapNuetral = (MiniMapActorBehavior)Instantiate(miniMapNeutral, new Vector3(0, 0.0f, 0.5f), Quaternion.identity);
            newMiniMapNuetral.transform.parent = transform;
            newMiniMapNuetral.transform.localPosition = new Vector3(0.0f, 0.0f, 0.1f);

            neutralSquadList.Add(newMiniMapNuetral);
        }
    }
コード例 #16
0
ファイル: GridBehavior.cs プロジェクト: Rhyrs/Game
    void Start()
    {
        //theMap = new MovePointBehavior[theMapLength * theMapWidth];
        gameController = GameObject.FindGameObjectWithTag("Grid").GetComponent<GameControllerBehaviour>();

        for (int index = 0; index < gameController.enemyTeam.Count; index++)
            ignoreList.Add(gameController.enemyTeam[index].currentMovePoint);
        for (int index = 0; index < gameController.playerTeam.Count; index++)
            ignoreList.Add(gameController.playerTeam[index].currentMovePoint);
        for (int index = 0; index < gameController.nuetrals.Count; index++)
            ignoreList.Add(gameController.nuetrals[index].currentMovePoint);

        for (int length = 0; length < theMapLength; length++)
        {
            for (int width = 0; width < theMapWidth; width++)
            {
                if (length < theMapLength - 1)
                {
                    if (theMap[width + (length * theMapWidth)] && theMap[width + ((length + 1) * theMapWidth)])
                    {
                        theMap[width + (length * theMapWidth)].neighborList[0] = theMap[width + ((length + 1) * theMapWidth)];
                        theMap[width + ((length + 1) * theMapWidth)].neighborList[2] = theMap[width + (length * theMapWidth)];
                    }
                }
                if (width < theMapWidth - 1)
                {
                    if (theMap[width + (length * theMapWidth)] && theMap[width + 1 + (length * theMapWidth)])
                    {
                        theMap[width + (length * theMapWidth)].neighborList[1] = theMap[width + 1 + (length * theMapWidth)];
                        theMap[width + 1 + (length * theMapWidth)].neighborList[3] = theMap[width + (length * theMapWidth)];
                    }
                }
            }
        }
    }
コード例 #17
0
    void Start()
    {
        minimapBG      = GameObject.Find("MiniMapBG");
        theMiniMap     = new MiniMapPointBehaviour[theGrid.theMapLength * theGrid.theMapWidth];
        gameController = GameObject.FindGameObjectWithTag("Grid").GetComponent <GameControllerBehaviour>();

        miniMapWidth  = theGrid.theMapWidth;
        miniMapLength = theGrid.theMapLength;

        float xPositionOffset  = -(miniMapWidth / 2.0f);
        float yPositionOffset  = -(miniMapLength / 2.0f);
        float currentXPosition = 0.0f;
        float currentYPosition = 0.0f;

        for (int x = 0; x < miniMapLength; x++)
        {
            currentXPosition = xPositionOffset * 0.1f + 0.05f;
            currentYPosition = (yPositionOffset + x + 0.5f) * 0.1f;

            for (int z = 0; z < miniMapWidth; z++)
            {
                MiniMapPointBehaviour newMiniMapPoint = null;
                newMiniMapPoint = (MiniMapPointBehaviour)Instantiate(miniPointPrefab, new Vector3(currentXPosition, 0.0f, currentYPosition), Quaternion.identity);
                newMiniMapPoint.transform.parent        = transform;
                newMiniMapPoint.name                    = abc[z].ToString() + x.ToString();
                newMiniMapPoint.transform.localPosition = new Vector3(currentXPosition, currentYPosition, -0.01f);
                newMiniMapPoint.renderer.enabled        = true;
                currentXPosition = (xPositionOffset + z + 1) * 0.1f + 0.05f;
                theMiniMap[z + (x * miniMapWidth)] = newMiniMapPoint;
            }
        }

        for (int x = 0; x < miniMapLength; x++)
        {
            for (int z = 0; z < miniMapWidth; z++)
            {
                if (!theGrid.theMap[z + (x * miniMapWidth)])
                {
                    Destroy(theMiniMap[z + (x * miniMapWidth)].gameObject);
                }
            }
        }

        for (int i = 0; i < gameController.playerTeam.Count; i++)
        {
            MiniMapActorBehavior newMiniMapPlayer = null;
            newMiniMapPlayer = (MiniMapActorBehavior)Instantiate(miniMapPlayer, new Vector3(0, 0.0f, 0.5f), Quaternion.identity);
            newMiniMapPlayer.transform.parent        = transform;
            newMiniMapPlayer.transform.localPosition = new Vector3(0.0f, 0.0f, 0.1f);
            newMiniMapPlayer.renderer.enabled        = true;
            playerSquadList.Add(newMiniMapPlayer);
        }

        for (int i = 0; i < gameController.enemyTeam.Count; i++)
        {
            MiniMapActorBehavior newMiniMapEnemy = null;
            newMiniMapEnemy = (MiniMapActorBehavior)Instantiate(miniMapEnemy, new Vector3(0, 0.0f, 0.5f), Quaternion.identity);
            newMiniMapEnemy.transform.parent        = transform;
            newMiniMapEnemy.transform.localPosition = new Vector3(0.0f, 0.0f, 0.1f);
            newMiniMapEnemy.renderer.enabled        = true;

            enemySquadList.Add(newMiniMapEnemy);
        }

        for (int i = 0; i < gameController.nuetrals.Count; i++)
        {
            MiniMapActorBehavior newMiniMapNuetral = null;
            newMiniMapNuetral = (MiniMapActorBehavior)Instantiate(miniMapNeutral, new Vector3(0, 0.0f, 0.5f), Quaternion.identity);
            newMiniMapNuetral.transform.parent        = transform;
            newMiniMapNuetral.transform.localPosition = new Vector3(0.0f, 0.0f, 0.1f);
            newMiniMapNuetral.renderer.enabled        = true;

            neutralSquadList.Add(newMiniMapNuetral);
        }
    }
コード例 #18
0
ファイル: GridBehavior.cs プロジェクト: rawrange69/Game
    void Start()
    {
        gameController = GameObject.FindGameObjectWithTag("Grid").GetComponent<GameControllerBehaviour>();
        Debug.Log(theMapLength.ToString());
        Debug.Log(theMapWidth.ToString());
        Debug.Log(theVerticalFence.Length.ToString());
        Debug.Log(theHorizontalFence.Length.ToString());
        Debug.Log(theMap.Length.ToString());

        for (int index = 0; index < gameController.enemyTeam.Count; index++)
            ignoreList.Add(gameController.enemyTeam[index].currentMovePoint);
        for (int index = 0; index < gameController.playerTeam.Count; index++)
            ignoreList.Add(gameController.playerTeam[index].currentMovePoint);
        for (int index = 0; index < gameController.nuetrals.Count; index++)
            ignoreList.Add(gameController.nuetrals[index].currentMovePoint);

        for (int length = 0; length < theMapLength; length++)
        {
            for (int width = 0; width < theMapWidth; width++)
            {

                if (length < theMapLength - 1)
                {
                    //Debug.Log((width + (length * theMapWidth)).ToString());

                    if (isFenced)
                    {
                        if (theMap[width + (length * theMapWidth)] && theMap[width + ((length + 1) * theMapWidth)] && theVerticalFence[width + (length * theMapWidth)])
                        {
                            theMap[width + (length * theMapWidth)].neighborList[0] = theMap[width + ((length + 1) * theMapWidth)];
                            theMap[width + ((length + 1) * theMapWidth)].neighborList[2] = theMap[width + (length * theMapWidth)];
                        }
                    }
                    else
                    {
                        if (theMap[width + (length * theMapWidth)] && theMap[width + ((length + 1) * theMapWidth)])
                        {
                            theMap[width + (length * theMapWidth)].neighborList[0] = theMap[width + ((length + 1) * theMapWidth)];
                            theMap[width + ((length + 1) * theMapWidth)].neighborList[2] = theMap[width + (length * theMapWidth)];
                        }
                    }
                }

                if (width < theMapWidth - 1)
                {
                    if (isFenced)
                    {
                        if (theMap[width + (length * theMapWidth)] && theMap[width + 1 + (length * theMapWidth)] && theHorizontalFence[width + (length * theMapWidth)])
                        {
                            theMap[width + (length * theMapWidth)].neighborList[1] = theMap[width + 1 + (length * theMapWidth)];
                            theMap[width + 1 + (length * theMapWidth)].neighborList[3] = theMap[width + (length * theMapWidth)];
                        }
                    }
                    else
                    {
                        if (theMap[width + (length * theMapWidth)] && theMap[width + 1 + (length * theMapWidth)])
                        {
                            theMap[width + (length * theMapWidth)].neighborList[1] = theMap[width + 1 + (length * theMapWidth)];
                            theMap[width + 1 + (length * theMapWidth)].neighborList[3] = theMap[width + (length * theMapWidth)];
                        }
                    }
                }
            }
        }
    }
コード例 #19
0
 /// <summary>
 /// Start this instance.
 /// </summary>
 //protected override void Start()
 void Start()
 {
     //base.Start();
     isEnabled = false;
     // Commented out until we have art assests
     //ToggleMenuGroup();
     gameController = GameObject.FindGameObjectWithTag("Grid").GetComponent<GameControllerBehaviour>();
     menuGroup = GameObject.Find("Menu Group HUD").gameObject;
     turnCount = GameObject.Find("turnCountText").GetComponent<TextMesh>();
     whoseTurn = GameObject.Find("whoseTurnText").GetComponent<TextMesh>();
 }
コード例 #20
0
ファイル: GridBehavior.cs プロジェクト: andreimesquita/Game-1
    /// <summary>
    /// This to setup neighbor lists for each node in the grid.
    /// 
    /// Alex Reiss
    /// </summary>
    void Start()
    {
        int currentIndex = 0;
       
        gameController = GetComponent<GameControllerBehaviour>();

        for (int index = 0; index < gameController.enemyTeam.Count; index++)
            ignoreList.Add(gameController.enemyTeam[index].currentMovePoint);
        for (int index = 0; index < gameController.playerTeam.Count; index++)
            ignoreList.Add(gameController.playerTeam[index].currentMovePoint);
        for (int index = 0; index < gameController.nuetrals.Count; index++)
            ignoreList.Add(gameController.nuetrals[index].currentMovePoint);
		
        for (int length = 0; length < theMapLength; length++)
        {
            for (int width = 0; width < theMapWidth; width++)
            {

                if (theMap[width + (length * theMapWidth)])
                    theMap[width + (length * theMapWidth)].index = currentIndex;


                if (length < theMapLength - 1)
                {
                    if (isFenced)
                    {
                        if (theMap[width + (length * theMapWidth)] && theMap[width + ((length + 1) * theMapWidth)] && theVerticalFence[width + (length * theMapWidth)])
                        {
                            theMap[width + (length * theMapWidth)].neighborList[0] = theMap[width + ((length + 1) * theMapWidth)];
                            theMap[width + ((length + 1) * theMapWidth)].neighborList[2] = theMap[width + (length * theMapWidth)];
                        }
                    }
                    else
                    {
                        if (theMap[width + (length * theMapWidth)] && theMap[width + ((length + 1) * theMapWidth)])
                        {
                            theMap[width + (length * theMapWidth)].neighborList[0] = theMap[width + ((length + 1) * theMapWidth)];
                            theMap[width + ((length + 1) * theMapWidth)].neighborList[2] = theMap[width + (length * theMapWidth)];
                        }
                    }
                }

                if (width < theMapWidth - 1)
                {
                    if (isFenced)
                    {
                        if (theMap[width + (length * theMapWidth)] && theMap[width + 1 + (length * theMapWidth)] && theHorizontalFence[width + (length * theMapWidth)])
                        {
                            theMap[width + (length * theMapWidth)].neighborList[1] = theMap[width + 1 + (length * theMapWidth)];
                            theMap[width + 1 + (length * theMapWidth)].neighborList[3] = theMap[width + (length * theMapWidth)];
                        }
                    }
                    else
                    {
                        if (theMap[width + (length * theMapWidth)] && theMap[width + 1 + (length * theMapWidth)])
                        {
                            theMap[width + (length * theMapWidth)].neighborList[1] = theMap[width + 1 + (length * theMapWidth)];
                            theMap[width + 1 + (length * theMapWidth)].neighborList[3] = theMap[width + (length * theMapWidth)];
                        }
                    }
                }

                currentIndex++;
            }
        }
    }