예제 #1
0
    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            var        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit))
            {
                var piece = hit.collider.gameObject.GetComponent <PieceController> ();

                if (m_lastSquareSelected != null)
                {
                    m_lastSquareSelected.Unselect();
                }

                if (piece == null)
                {
                    m_lastSquareSelected = hit.collider.gameObject.GetComponent <SquareController> ();
                    m_lastSquareSelected.Select();
                    BoardController.Instance.MoveCurrentPieceTo(m_lastSquareSelected);
                }
                else
                {
                    BoardController.Instance.SelectPiece(piece);
                }
            }
        }
    }
예제 #2
0
    public LoveState(SquareController square)
    {
        _square = square;

        //spinSpeed = (_ctrl.dna.GetGene(Gene.Speed) + _target.dna.GetGene(Gene.Speed)) / 25.0f;
        spinSpeed = 0.5f;
    }
예제 #3
0
 public void ResetInfo()
 {
     SetZone(false, "Pool", Vector3.right * 1000);
     pair    = null;
     isHeld  = false;
     grabbed = false;
 }
예제 #4
0
    public TalkState(SquareController square)
    {
        _square = square;

        talkTime        = 3.0f;
        currentTalkTime = 0.0f;
    }
예제 #5
0
    // mask some moves as not possible
    public override void CollectDiscreteActionMasks(DiscreteActionMasker actionMasker)
    {
        // contains the list of disallowed sheep/moves by number (see: OnActionReceived)
        List <int>  notAllowed           = new List <int>();
        List <bool> perSheepAllowedMoves = new List <bool>();

        for (int i = 0; i < gameManager.sheep.Length; i++)
        {
            // grab the sheep controller
            SheepController  sheep  = gameManager.sheep[i].GetComponent <SheepController>();
            SquareController square = sheep.Square().GetComponent <SquareController>();

            // Get List<bool> of possible moves (true = allowed, false = not allowed)
            // Order is (must match above!):
            // row: 1, col: -1 = 0
            // row: 1, col: 1= 1
            perSheepAllowedMoves = square.PossibleSheepMovesDir();

            // for any false, add the index (or index+1) into notAllowed list
            for (int j = 0; j < perSheepAllowedMoves.Count; j++)
            {
                if (!perSheepAllowedMoves[j])
                {
                    notAllowed.Add(2 * i + j);
                }
            }
        }

        actionMasker.SetMask(0, notAllowed);
    }
예제 #6
0
    void SquareClicked(SquareController sq)
    {
        bool isBuffed;
        var  square = sq.GetSquare();

        if (selectedPiece != null)
        {
            if (availableMoves.Any(x => x.Row == square.Row && x.Column == square.Column))
            {
                var piece           = selectedPiece.GetComponent <BasePiece>();
                var pieceController = selectedPiece.GetComponent <PieceController>();
                pieceController.SetTargetPosition(sq.gameObject.transform.position);
                isBuffed = piece.CheckElement(cellElements);
                piece.MoveTo(square, piecePositions, isBuffed);
                DeselectPiece(piece);
                SwitchTurns();
            }
        }
        else
        {
            var piece = piecePositions[square.Row - 1][square.Column - 65];
            if (piece != null && piece.Selectable)
            {
                SelectPiece(piece);
            }
        }
    }
예제 #7
0
    //function tobe called in other managers to log events
    public void FillEventLog(string eventName, int player = -1, SquareController square = null)
    {
        string[] LogText = new string[14];
        FillBasicInfo(LogText);
        LogText[7] = eventName;
        LogText[8] = player == -1 ? "" : player.ToString();

        //Fill in relevant data if square is provided, otherwise fill entries with empty strings
        if (square != null)
        {
            LogText[9]  = square.type.ToString();
            LogText[10] = square.column == -1 ? "" : square.column.ToString();
            LogText[11] = square.row == -1 ? "" : square.row.ToString();
            //If the square is in/from the "Play" zone, give the y coord as height
            LogText[12] = square.zone == "Play" ? square.transform.position.y.ToString() : "";
            LogText[13] = square.zone;
        }
        else
        {
            LogText[9]  = "";
            LogText[10] = "";
            LogText[11] = "";
            LogText[12] = "";
            LogText[13] = "";
        }
        WritetoCSV(LogText);

        //Turn on if storing csv files in Firebase
        //if (eventName.Contains("Exited"))
        //{
        //    StoreCSVToFirebase(csvPath);
        //}
    }
예제 #8
0
	void ToTalkState(SquareController interactionSquare) {
		_square.interactionSquare = interactionSquare;
		_square.currentState = _square.talkState;

		interactionSquare.interactionSquare = _square;
		interactionSquare.currentState = interactionSquare.talkState;
	}
예제 #9
0
    /// <summary>
    /// this is checking to see if the ray cast hit either a cube or a button. else statments are non cube objects
    /// </summary>
    void HandGrabStart()
    {
        GameObject hitObject = hit.transform.gameObject;

        //Checks to see if object is a cube and if it can be picked up (or is gold)
        if (hitObject.tag.Contains("cube"))
        {
            SquareController pickUpSquare = hitObject.GetComponent <SquareController>();
            if (pickUpSquare.CanPickUp(player) || pickUpSquare.type == 2)
            {
                SetGrabbedObject(hit.transform.gameObject);
                grabbing = true;
            }
        }
        else
        {
            switch (hitObject.tag)
            {
            case "one player button":
                OnePlayerButton();
                break;

            case "two player button":
                TwoPlayerButton();
                break;

            case "easy button":
                EasyButton();
                break;

            case "med button":
                MedButton();
                break;

            case "hard button":
                HardButton();
                break;

            case "start button":
                StartButton();
                break;

            case "human":
                ChangeHeadHuman();
                break;

            case "cat":
                ChangeHeadCat();
                break;

            case "mouse":
                ChangeHeadMouse();
                break;

            case "options button":
                ChangeHeadMouse();
                break;
            }
        }
    }
예제 #10
0
    void HandGrabHold()
    {
        line.material = redBase;
        if (grabbedObject != null)
        {
            bool             forceposition = false;
            SquareController grabbedBlock  = grabbedObject.GetComponent <SquareController>();

            if (grabbedBlock.zone == "Build")
            {
                //Don't move objects in the build zone
                //Instead increment timer towards deleting
                deleteTimer += Time.deltaTime;
                if (deleteTimer > deleteWaitTime)
                {
                    DissolveObject(grabbedObject);

                    //Tell the sound script to play the corresponding sound
                    //at the blockDestroySounds AudioSource. -Nathan
                    SoundManager.instance.soundPlay(1, 1);
                }
            }
            //Don't move full gold blocks unless only 1 player
            else if (grabbedBlock.type == 2 && Manager.NumPlayers != 1)
            {
                if (grabbedBlock.playerHolds[0] && grabbedBlock.playerHolds[1])
                {
                    PlayZoneController.instance.PickupGold(grabbedBlock);
                }
            }
            else if (grabbedBlock.zone == "Interact")
            {
                //Regular move block around on stick logic
                if (!hitSomething)
                {
                    compareDistance = 20f;
                }
                else
                {
                    compareDistance = Vector3.Distance(hand.transform.position, hit.point);
                    if (hit.transform.gameObject.tag == "DropZone" && grabbedObject != null)
                    {
                        grabbedObject.transform.position = hit.transform.position;
                        line.SetPosition(1, hit.transform.position);
                        //hit.transform.GetComponent<MeshRenderer>().enabled = false;
                        forceposition = true;
                    }
                }
                if (!forceposition && grabbedObject != null)
                {
                    newGrabDistance = Mathf.Min(compareDistance, grabDistance);
                    line.SetPosition(1, hand.transform.position + targetVector * newGrabDistance);
                    grabbedObject.transform.position = hand.transform.position + targetVector * newGrabDistance;

                    SoundManager.instance.soundPlay(1, 2);
                }
            }
        }
    }
예제 #11
0
    public void SwitchGravity()
    {
        Physics2D.gravity = -Physics2D.gravity;
        Camera.main.transform.RotateAround(Camera.main.transform.position, Camera.main.transform.forward, 180);
        SquareController squareController = GameObject.FindObjectOfType <SquareController>();

        squareController.normalGravity = !squareController.normalGravity;
    }
예제 #12
0
    void ToTalkState(SquareController interactionSquare)
    {
        _square.interactionSquare = interactionSquare;
        _square.currentState      = _square.talkState;

        interactionSquare.interactionSquare = _square;
        interactionSquare.currentState      = interactionSquare.talkState;
    }
예제 #13
0
        public void TestGetSquaresCount_WhenNoSquares_Return0()
        {
            //Arrange
            DbContextOptionsBuilder <SquareContext> optionsBuilder = new();

            optionsBuilder.UseInMemoryDatabase(MethodBase.GetCurrentMethod().Name);

            using (SquareContext ctx = new(optionsBuilder.Options))
            {
                var s1_point1 = new Point {
                    CoordinateX = 0, CoordinateY = 3
                };
                var s1_point2 = new Point {
                    CoordinateX = 1, CoordinateY = 2
                };
                var s1_point3 = new Point {
                    CoordinateX = 3, CoordinateY = 0
                };
                var s1_point4 = new Point {
                    CoordinateX = 0, CoordinateY = 0
                };

                var s2_point1 = new Point {
                    CoordinateX = -1, CoordinateY = 1
                };
                var s2_point2 = new Point {
                    CoordinateX = 1, CoordinateY = 1
                };
                var s2_point3 = new Point {
                    CoordinateX = 1, CoordinateY = -2
                };
                var s2_point4 = new Point {
                    CoordinateX = -1, CoordinateY = -1
                };


                ctx.AddRange(new Point[] { s1_point1, s1_point2, s1_point3, s1_point4 });
                ctx.AddRange(new Point[] { s2_point1, s2_point2, s2_point3, s2_point4 });
                ctx.SaveChanges();
            }

            ActionResult <int> result;

            using (SquareContext ctx = new(optionsBuilder.Options))
            {
                var pointService = new PointService(ctx);

                var controller = new SquareController(pointService);

                //Act
                result = controller.GetSquaresCount();
            }

            var count = result.Value;

            //Assert
            Assert.AreEqual(0, count);
        }
예제 #14
0
    public SquareController GetMirror(SquareController square)
    {
        SquareController mirror = mirrorPool[square.type][0];

        mirrorPool[square.type].Remove(mirror);
        mirror.isMirror = true;
        mirror.mirror   = square;
        return(mirror);
    }
예제 #15
0
    public SquareController GetGoldMerge(SquareController square)
    {
        SquareController goldMerge = goldMergePool[0];

        goldMergePool.Remove(goldMerge);
        goldMerge.row    = square.row;
        goldMerge.column = square.column;
        return(goldMerge);
    }
예제 #16
0
    public void HandleCollision(Collider2D collider)
    {
        SquareController square = collider.gameObject.GetComponent <SquareController>();

        if (square && square.currentState.CanInteract() && Random.value < 0.20f)
        {
            ToTalkState(square);
        }
    }
예제 #17
0
 void Start()
 {
     instance     = this;
     mode         = rigidbody2D.collisionDetectionMode;
     mass         = rigidbody2D.mass;
     drag         = rigidbody2D.drag;
     angularDrag  = rigidbody2D.angularDrag;
     gravityScale = rigidbody2D.gravityScale;
 }
예제 #18
0
    public bool CheckIsSquare(int x, int y)
    {
        GameObject sqr = cachedSquares.Find(square => {
            SquareController controller = square.GetComponent <SquareController>();

            return(controller.positionX == x && controller.positionY == y);
        });

        return(sqr != null);
    }
예제 #19
0
    public void CacheSquare(GameObject go)       //NOTE: done separately, so they don't tick
    {
        if (!cachedSquares.Contains(go))
        {
            cachedSquares.Add(go);

            SquareController controller = go.GetComponent <SquareController>();

            go.transform.position = new Vector3(controller.positionX * squareWidth, controller.positionY * squareHeight, 0);
        }
    }
예제 #20
0
    public void DropBlock(SquareController block, int col)
    {
        fallingBlocks.Add(block);
        block.transform.position = dropLocs[col];
        block.SetZone(true, "Play", endLocs[col], col);
        spawningPool.Remove(block);

        //Tell the sound script to play the corresponding sound
        //at the blockDropSounds AudioSource. -Nathan
        //REMOVED, TRENT SAYS TOO MUCH STIMULI
        //SoundManager.instance.soundPlay(0, col + 2);
    }
예제 #21
0
    void HandGrabRelease()
    {
        Debug.Log("let go");
        line.SetPosition(1, endPos);
        line.material = blueBase;

        deleteTimer = 0.0f;

        if (grabbedObject != null)
        {
            SquareController grabbedBlock = grabbedObject.GetComponent <SquareController>();
            grabbedBlock.isHeld = false;
            grabbedBlock.playerHolds[player] = false;

            //STOP playing a sound when a block is no longer held. - Nathan
            SoundManager.instance.soundPlay(1, -1);

            // If letting go of block already in Build zone, if it hasn't already deleted by timer, just return it back to the main layer and let it resume falling
            if (grabbedBlock.zone == "Build")
            {
                grabbedObject.layer = 1;
            }
            // If dropping a block in a DropZone above the build zone
            else if (hitSomething && hit.transform.gameObject.tag == "DropZone")
            {
                grabbedObject.layer = 1;
                //get the curent dropzone number
                Transform DropParent = hit.transform.parent;
                // will respond true if square can be placed in column of buildZone, false otherwise
                bool canFit = BuildZoneController.instance.AddSquare(hit.transform.GetSiblingIndex(), grabbedBlock, 0);
                //If it can't fit in the build zone column, it recycles back into the playZone spawning pool
                if (!canFit)
                {
                    PlayZoneController.instance.RecycleBlock(grabbedBlock);
                    Destroy(grabbedObject);
                }
                //hit.transform.GetComponent<MeshRenderer>().enabled = true;
            }
            // Otherwise the block is dissolved to recycle back into the playZone's spawning pool
            else
            {
                DissolveObject(grabbedObject);

                //Play Sound through SoundManager.
                SoundManager.instance.soundPlay(1, 1);
            }

            grabbedObject = null;
        }

        grabbing = false;
    }
    private void Awake()
    {
        CoinDisplayController = coinDisplayController;
        LifeDisplayController = lifeDisplayController;
        SquareController      = squareController;

        squareController.FindRespawnPoint();
        squareController.Respawn();

        foreach (GameObject element in objectsNotToDestroyOnLoad)
        {
            DontDestroyOnLoad(element);
        }
    }
예제 #23
0
	public void MoveCurrentPieceTo (SquareController square)
	{
		if (m_lastSelectedPiece != null && m_lastSelectedPiece.CurrentSquare.Model.CurrentPiece != null) {
			var move = new CheckersMove (m_lastSelectedPiece.CurrentSquare.Model.CurrentPiece, square.Model);
			var fitness = GAController.Instance.Fitness;
			
			if (fitness.Board.GetMoveKind (move) == CheckersMoveKind.Invalid) {
				HudController.IsInvalidMove = true; 
			} else {
				HudController.IsInvalidMove = false;
				fitness.Board.MovePiece (move);
				GAController.Instance.MovePiece ();
			}
		}
	}
예제 #24
0
    void SpawnSquare(SquareDNA dna)
    {
        Vector3          randomPos  = new Vector3(Random.Range(cameraRect.x, cameraRect.xMax), Random.Range(cameraRect.yMax, cameraRect.y), 0.0f);
        GameObject       individual = Instantiate(square, randomPos, Quaternion.identity) as GameObject;
        SquareController sq         = individual.GetComponent <SquareController>();

        if (sq == null)
        {
            Destroy(individual);
            return;
        }
        sq.cameraRect = cameraRect;
        population.Add(dna);
        sq.SetDNA(dna);
        //Debug.Log(dna);
    }
예제 #25
0
    public void SetGrabbedObject(GameObject obj)
    {
        grabbedObject = obj;
        SquareController grabbedSquare = grabbedObject.GetComponent <SquareController>();

        grabDistance = Vector3.Distance(hand.transform.position, hit.point);
        if (grabbedSquare.zone == "Play")
        {
            grabbedSquare.SetZone(false, "Interact", grabbedSquare.transform.position);
        }
        if (Manager.NumPlayers == 1 || grabbedSquare.type != 2)
        {
            grabbedObject.layer = 2;
        }
        grabbedSquare.playerHolds[player] = true;
    }
예제 #26
0
    //Attempts to add a given square to a column in the build zone, returns true if the square was properly added, false if there is no space in the column
    public bool AddSquare(int col, SquareController square, int player)
    {
        int count = buildGrid[col].Count;

        //Check if a half Gold block pairs with a priorly dropped half gold block in the same col
        if (count > 0 && GoldMatch(square, buildGrid[col][count - 1]))
        {
            int gHeight = count - 1;
            while (gHeight > 0 && GoldMatch(square, buildGrid[col][gHeight - 1]))
            {
                gHeight--;
            }
            //Link both halves to each other for scoring and falling purposes
            buildGrid[col][gHeight].pair = square;
            square.pair = buildGrid[col][gHeight];
            square.transform.position = GridLocation[0][col, height];
            square.SetZone(true, "Build", GridLocation[0][col, gHeight], col, gHeight);

            if (Manager.NumPlayers == 2)
            {
                square.mirror = PlayZoneController.instance.GetMirror(square);
                square.mirror.transform.position = GridLocation[1][col, height];
                square.mirror.SetZone(true, "Build", GridLocation[1][col, gHeight], col, gHeight);
            }
            AnalyticsManager.instance.FillEventLog("Block Dropped In Drop Zone", player, square);
            return(true);
        }
        //Checks to see if the column is filled
        if (count < height)
        {
            //Tells the square it is now in the "Build" zone and which column and row it will end up in
            square.transform.position = GridLocation[0][col, height];
            square.SetZone(true, "Build", GridLocation[0][col, count], col, count);
            buildGrid[col].Add(square);

            if (Manager.NumPlayers == 2)
            {
                square.mirror = PlayZoneController.instance.GetMirror(square);
                square.mirror.transform.position = GridLocation[1][col, height];
                square.mirror.SetZone(true, "Build", GridLocation[1][col, count], col, count);
            }
            AnalyticsManager.instance.FillEventLog("Block Dropped In Drop Zone", player, square);
            return(true);
        }
        //If it reaches this point without returning, the column is full, it can't fit any more blocks
        return(false);
    }
예제 #27
0
    public GameObject[] returnIncorrectPositions()
    {
        int numIncorrect = 0;

        for (int x = 0; x < 5; x++)
        {
            for (int y = 0; y < 5; y++)
            {
                GameObject        objectpos         = gridArray[x][y];
                GridPosController gridPosController = objectpos.GetComponent <GridPosController>();
                //Debug.Log("Position:" + gridPosController.positionX + "," + gridPosController.positionY);
                if (gridPosController.currentSquare != null)
                {
                    SquareController squareController = gridPosController.currentSquare.GetComponent <SquareController>();
                    if (!squareController.IsPositionCorrect())
                    {
                        numIncorrect++;
                    }
                }
            }
        }
        GameObject[] incorrectArray = new GameObject[numIncorrect];
        int          i = 0;

        for (int x = 0; x < 5; x++)
        {
            for (int y = 0; y < 5; y++)
            {
                GameObject        objectpos         = gridArray[x][y];
                GridPosController gridPosController = objectpos.GetComponent <GridPosController>();
                //Debug.Log("Position:" + gridPosController.positionX + "," + gridPosController.positionY);
                if (gridPosController.currentSquare != null)
                {
                    SquareController squareController = gridPosController.currentSquare.GetComponent <SquareController>();
                    if (!squareController.IsPositionCorrect())
                    {
                        incorrectArray[i] = objectpos;
                        i++;
                    }
                }
            }
        }
        Debug.Log("Number incorrect:" + numIncorrect);
        return(incorrectArray);
    }
예제 #28
0
 public void DeleteSquare()
 {
     if (isMirror && mirror != null)
     {
         mirror.DeleteSquare();
         return;
     }
     if (zone == "Build")
     {
         BuildZoneController.instance.RemoveSquare(column, row, type);
     }
     PlayZoneController.instance.RecycleBlock(this);
     if (mirror != null)
     {
         PlayZoneController.instance.RecycleBlock(mirror);
         mirror = null;
     }
 }
예제 #29
0
    public void GoldMerge(int row, int col)
    {
        SquareController goldHalf = buildGrid[col][row];

        buildGrid[col][row] = PlayZoneController.instance.GetGoldMerge(buildGrid[col][row]);
        buildGrid[col][row].transform.position = goldHalf.transform.position;
        buildGrid[col][row].SetZone(false, "Build", GridLocation[0][col, row], col, row);

        buildGrid[col][row].mirror = PlayZoneController.instance.GetMirror(buildGrid[col][row]);
        buildGrid[col][row].mirror.transform.position = goldHalf.mirror.transform.position;
        buildGrid[col][row].mirror.SetZone(false, "Build", GridLocation[1][col, row], col, row);

        PlayZoneController.instance.RecycleBlock(goldHalf.pair.mirror);
        PlayZoneController.instance.RecycleBlock(goldHalf.mirror);

        PlayZoneController.instance.RecycleBlock(goldHalf.pair);
        PlayZoneController.instance.RecycleBlock(goldHalf);
    }
예제 #30
0
 public void LockInPlace(SquareController block)
 {
     try
     {
         var gridIndex = TransformToGridIndex(block.transform.position);
         block.transform.SetParent(transform);
         staticBlocks.Add(gridIndex, block);
         if (gridIndex >= 12 * 12 - 4)
         {
             GameOver();
         }
     }
     catch
     {
         GameObject.Destroy(block.gameObject);
         GameOver();
     }
 }
예제 #31
0
    public void RecycleBlock(SquareController block)
    {
        fallingBlocks.Remove(block);
        if (block.isMirror)
        {
            mirrorPool[block.type].Add(block);
        }
        else
        {
            switch (block.type)
            {
            case 2:
                if (block.zone == "Build" && Manager.NumPlayers == 2)
                {
                    goldMergePool.Add(block);
                }
                else
                {
                    spawningPool.Add(block);
                }
                break;

            case 3:
                goldLeftPool.Add(block);
                break;

            case 4:
                goldRightPool.Add(block);
                break;

            default:
                spawningPool.Add(block);
                break;
            }
        }

        block.playerHolds[0]     = false;
        block.playerHolds[1]     = false;
        block.gameObject.layer   = 1;
        block.transform.position = new Vector3(1000, 0, 0);
        block.SetZone(false, "Pool", new Vector3(1000, 0, 0));
        block.dirty = false;
    }
예제 #32
0
    public void MoveCurrentPieceTo(SquareController square)
    {
        if (m_lastSelectedPiece != null && m_lastSelectedPiece.CurrentSquare.Model.CurrentPiece != null)
        {
            var move    = new CheckersMove(m_lastSelectedPiece.CurrentSquare.Model.CurrentPiece, square.Model);
            var fitness = GAController.Instance.Fitness;

            if (fitness.Board.GetMoveKind(move) == CheckersMoveKind.Invalid)
            {
                HudController.IsInvalidMove = true;
            }
            else
            {
                HudController.IsInvalidMove = false;
                fitness.Board.MovePiece(move);
                GAController.Instance.MovePiece();
            }
        }
    }
예제 #33
0
	private void Update ()
	{
		if (Input.GetMouseButtonDown (0)) {
			var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
			RaycastHit hit;
			
			if (Physics.Raycast (ray, out hit)) {
				var piece = hit.collider.gameObject.GetComponent<PieceController> ();
				
				if (m_lastSquareSelected != null) {
					m_lastSquareSelected.Unselect ();
				}
				
				if (piece == null) {
					m_lastSquareSelected = hit.collider.gameObject.GetComponent<SquareController> ();
					m_lastSquareSelected.Select ();
					BoardController.Instance.MoveCurrentPieceTo (m_lastSquareSelected);
				} else {
					BoardController.Instance.SelectPiece (piece);
				}
			}
		}
	}
예제 #34
0
	public MoveState(SquareController square) {
		_square = square;

		target = _square.transform.position;
	}
예제 #35
0
	public TalkState(SquareController square) {
		_square = square;

		talkTime = 3.0f;
		currentTalkTime = 0.0f;
	}
예제 #36
0
	public IdleState(SquareController square) {
		_square = square;
	}
예제 #37
0
 void StartCharge()
 {
     // started charging, grab the target square
     RaycastHit hit;
     Vector3 pos = transform.position;
     pos.y += .1f;
     if(!Physics.Raycast(pos, -Vector3.up, out hit, cc.height * 1.1f))  {
         Debug.Log("Missed a square?!?");
         return;
     }
     chargeTarget = hit.collider.gameObject.GetComponent<SquareController>();
     if (chargeTarget == null)  {
         Debug.Log("No SquareController on target!");
         return;
     }
     // if we're currently restricted to only toggling a
     // certain square (such as during the tutorial)
     // make sure this is it
     if(restrictedCharge != null && restrictedCharge != chargeTarget)
         return;
     pc = ((GameObject)GameObject.Instantiate(progressCircleTemplate)).GetComponent<ProgressCircle>();
     pc.Percent = 0;
     pc.FullColor = Color.white;
     pc.EmptyColor = Color.white;
     pos = chargeTarget.transform.position;
     pos.y += .1f;
     pc.transform.position = pos;
     pc.transform.rotation = Quaternion.Euler(new Vector3(90, 180, 0));
     chargeStart = Time.time;
     anim.SetBool("Charging", true);
     anim.SetBool("Pound", false);
     velocity = Vector3.zero;
 }
예제 #38
0
 void ToggledSquare(SquareController target)
 {
     switch(target.boardIndex) {
         case 17:
             Debug.Log("Now do 22!");
             player.restrictedCharge = board.getSquare(22);
             arrow.transform.position = player.restrictedCharge.transform.position;
             break;
         //case 22:
         //    Debug.Log("Done!");
         //    Application.LoadLevel("generalLevel");
         //    break;
     }
 }
예제 #39
0
	public LoveState(SquareController square) {
		_square = square;

		//spinSpeed = (_ctrl.dna.GetGene(Gene.Speed) + _target.dna.GetGene(Gene.Speed)) / 25.0f;
		spinSpeed = 0.5f;
	}