コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: AlexYLD/NeatAI
        public void PaintDot(Dot dot, DotStatus dotStatus, string noBorder = null)
        {
            dot.status = dotStatus;
            if (dot.Label == null)
            {
                return;
            }

            Dispatcher.Invoke(() =>
            {
                switch (dotStatus)
                {
                case DotStatus.Apple:
                    dot.Label.Background = new SolidColorBrush(Colors.Red);
                    break;

                case DotStatus.Snake:
                    dot.Label.Background = new SolidColorBrush(Colors.Black);
                    break;

                case DotStatus.Field:
                    dot.Label.Background =
                        new SolidColorBrush((dot.X + dot.Y) % 2 == 0 ? Colors.LightGray : Colors.White);
                    break;
                }
            });
        }
コード例 #2
0
ファイル: MapDot.cs プロジェクト: Diggery/SuperSneak
 public void EnemyCapture()
 {
     currentStatus = DotStatus.EnemyUnpowered;
     foreach (MapLine line in connectedLines) line.SetOwners();
     timer = 0.0f;
     mapControl.PowerDots();
     SaveState();
 }
コード例 #3
0
        private string GetFormattedDotOfferedState()
        {
            if (IsDotOffered == null)
            {
                return(null);
            }

            return(DotStatus == null
                ? IsDotOffered.GetDisplayName()
                : $"{IsDotOffered.GetDisplayName()} - {DotStatus.GetDisplayName()}");
        }
コード例 #4
0
ファイル: CameraController.cs プロジェクト: andra9612/Dots
    // Update is called once per frame
    void Update()
    {
        if (Input.mousePosition.y > Screen.height - 10 && camera.transform.position.y < maxY)
        {
            camera.transform.Translate(0, moveSpeed * Time.deltaTime, 0);
        }
        if (Input.mousePosition.y < 10 && camera.transform.position.y > 0)
        {
            camera.transform.Translate(0, -moveSpeed * Time.deltaTime, 0);
        }

        if (Input.mousePosition.x > Screen.width - 10 && camera.transform.position.x < maxX)
        {
            camera.transform.Translate(moveSpeed * Time.deltaTime, 0, 0);
        }
        if (Input.mousePosition.x < 10 && camera.transform.position.x > 0)
        {
            camera.transform.Translate(-moveSpeed * Time.deltaTime, 0, 0);
        }

        if (Input.GetMouseButtonUp(0))
        {
            Ray ray = camera.ScreenPointToRay(Input.mousePosition);

            RaycastHit hit = new RaycastHit();

            if (Physics.Raycast(ray, out hit))
            {
                dotStatus = hit.transform.GetComponent <DotStatus> ();
                if (hit.collider.tag.Contains("Point") && dotStatus.isStand == false)
                {
                    dotStatus.ChangeStatus();
                    Instantiate(dot, hit.transform.position, Quaternion.identity, hit.transform);
                    Debug.Log("dot");
                    counter++;
                    text.text = counter.ToString();
                }

                if (hit.collider.tag.Contains("Dot") && dotStatus.isAdded == false)
                {
                    dotStatus.isAdded = true;
                    Debug.Log("tyta");
                    controller.AddToArray(hit.transform.gameObject);
                }
            }
        }
    }
コード例 #5
0
    public void ChangeStatus(DotStatus status)
    {
        currentStatus = status;

        GetComponent <ColorController>().ChangeMaterial(currentStatus);
    }
コード例 #6
0
ファイル: MapDot.cs プロジェクト: Diggery/SuperSneak
    void LoadState()
    {
        string[] dotStatus = GameLoadSave.GetMapDotState(transform.name).Split(new char[] {','});

        if (dotStatus[0].Equals("none")) return;

        switch (dotStatus[0]) {

        case "PlayerPowered" :
            currentStatus = DotStatus.PlayerPowered;
            break;
        case "PlayerUnpowered" :
            currentStatus = DotStatus.PlayerUnpowered;
            break;
        case "EnemyPowered" :
            currentStatus = DotStatus.EnemyPowered;
            break;
        case "EnemyUnpowered" :
            currentStatus = DotStatus.EnemyUnpowered;
            break;
        case "Depot" :
            currentStatus = DotStatus.Depot;
            break;
        case "Hacked" :
            currentStatus = DotStatus.Hacked;
            break;
        case "None" :
            currentStatus = DotStatus.None;
            break;
        }
        hackedTime = int.Parse(dotStatus[1]);
        print ("setting " + transform.name + " to " + currentStatus);
        foreach (MapLine line in connectedLines) {
            line.UpdateLine();
        }
    }
コード例 #7
0
ファイル: MapDot.cs プロジェクト: Diggery/SuperSneak
 public void UnHack()
 {
     currentStatus = DotStatus.None;
     foreach (MapLine line in connectedLines) line.SetOwners();
     mapControl.PowerDots();
     SaveState();
 }
コード例 #8
0
ファイル: MapDot.cs プロジェクト: Diggery/SuperSneak
 public void SetAsPlayerBase()
 {
     renderer.material.mainTexture = baseDotTexture;
     isPlayerBase = true;
     currentStatus = DotStatus.PlayerPowered;
     timer = 0.0f;
 }
コード例 #9
0
ファイル: MapDot.cs プロジェクト: Diggery/SuperSneak
 public void SetAsHacked()
 {
     hackedTime = 3;
     currentStatus = DotStatus.Hacked;
     timer = 0.0f;
     foreach (MapLine line in connectedLines) line.SetOwners();
     UnSelect();
     SaveState();
 }
コード例 #10
0
ファイル: MapDot.cs プロジェクト: Diggery/SuperSneak
 public void SetAsEnemyBase()
 {
     renderer.material.mainTexture = baseDotTexture;
     isEnemyBase = true;
     currentStatus = DotStatus.EnemyPowered;
     timer = 0.0f;
 }
コード例 #11
0
ファイル: MapDot.cs プロジェクト: Diggery/SuperSneak
 public void SetAsDepot()
 {
     currentStatus = DotStatus.Depot;
     timer = 0.0f;
 }
コード例 #12
0
ファイル: MapDot.cs プロジェクト: Diggery/SuperSneak
 public void Release()
 {
     currentStatus = DotStatus.None;
 }
コード例 #13
0
ファイル: MapDot.cs プロジェクト: Diggery/SuperSneak
 public void PowerUp()
 {
     if (currentStatus == DotStatus.PlayerUnpowered) {
         currentStatus = DotStatus.PlayerPowered;
         Instantiate(greenPowerUpFX, transform.position, Quaternion.identity);
     }
     if (currentStatus == DotStatus.EnemyUnpowered) {
         currentStatus = DotStatus.EnemyPowered;
         Instantiate(redPowerUpFX, transform.position, Quaternion.identity);
     }
     timer = 0.0f;
 }
コード例 #14
0
ファイル: MapDot.cs プロジェクト: Diggery/SuperSneak
 public void PowerDown()
 {
     CanBeCaptured(false);
     if (currentStatus == DotStatus.PlayerPowered) currentStatus = DotStatus.PlayerUnpowered;
     if (currentStatus == DotStatus.EnemyPowered) currentStatus = DotStatus.EnemyUnpowered;
     timer = 0.0f;
     foreach (MapLine line in connectedLines) line.SetOwners();
 }
コード例 #15
0
ファイル: Game.cs プロジェクト: AlexYLD/NeatAI
 private void ChangeDotStatus(Dot dot, DotStatus status)
 {
     dot.status = status;
     Window?.PaintDot(dot, status);
 }