internal bool IsCleared() { if (goals.Count != 0) { foreach (var kv in goals) { ColoredStone stone = kv.Key; ColoredBlock block = kv.Value; if (stone.X != block.X || stone.Y != block.Y - 2) { return(false); } } return(true); } return(false); }
//------------------------------- DIALOG LAUNCHING --------------------------------- // // Before invoking this application one needs to open any part/empty part in NX // because of the behavior of the blocks. // // Make sure the dlx file is in one of the following locations: // 1.) From where NX session is launched // 2.) $UGII_USER_DIR/application // 3.) For released applications, using UGII_CUSTOM_DIRECTORY_FILE is highly // recommended. This variable is set to a full directory path to a file // containing a list of root directories for all custom applications. // e.g., UGII_CUSTOM_DIRECTORY_FILE=<NX install directory>\ugii\menus\custom_dirs.dat // // You can create the dialog using one of the following way: // // 1. Journal Replay // // 1) Replay this file through Tool->Journal->Play Menu. // // 2. USER EXIT // // 1) Create the Shared Library -- Refer "Block Styler programmer's guide" // 2) Invoke the Shared Library through File->Execute->NX Open menu. // //------------------------------------------------------------------------------ public static void Main() { try { theColoredBlock = new ColoredBlock(); // The following method shows the dialog immediately theColoredBlock.Show(); } catch (Exception ex) { //---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.Message); } finally { theColoredBlock.Dispose(); } }
protected override void Die() { if (_actualDead) { _myAnimations.Play("Dazed_Loop"); } if (Physics.Raycast(transform.position + Vector3.up, _deathDirection, out hit, _collisionCheckDist)) { if (hit.collider.GetComponent <ColoredBlock>()) { ColoredBlock other = hit.collider.GetComponent <ColoredBlock>(); if (_myColor == other.GetColor) { other.CorrectMatch(); _mySpawner.RemoveMe(this); Dead(); } else { _deathDirection = Vector3.zero; _myAgent.enabled = true; _hit = false; _dead = false; } } else { _deathDirection = Vector3.zero; _hit = false; _dead = false; transform.position = _spawnPoint; } } transform.position += _deathDirection * _knockBack * Time.deltaTime; }
public void RemoveBlock(ColoredBlock _colorBlockToRemove) { _coloredBlocks.Remove(_colorBlockToRemove); }
//makes the ghost die in a certain way //depending on what kind of room the ghost is in protected override void Die() { if (!_actualDead) { _myAnimations.Play("Dazed_Loop"); } //Debug.DrawLine(transform.position, transform.position + _deathDirection*_collisionCheckDist); if (_actualDead == false) { switch (_myMechanic) { case Mechanic.NONE: Debug.Log("No Mechanic"); break; case Mechanic.SWARM: base.Die(); if (Physics.Raycast(transform.position + Vector3.up, _deathDirection, out hit, _collisionCheckDist)) { if (!hit.collider.GetComponent <BaseEnemy>() && !hit.collider.GetComponent <PlayerController>()) { _myCollider.enabled = false; _mySpawner.RemoveMe(this); _mySpawner.CheckForEnd(); Dead(); } } transform.position += _deathDirection * _knockBack * Time.deltaTime; break; case Mechanic.COLOR: Vector3 _newDeathDirection = _deathDirection; if (Vector3.Distance(transform.position, _myPillar.transform.position) <= _cheatingDistance) { if (transform.position.z > _myPillar.transform.position.z) { _newDeathDirection.z -= _cheatingSensitivity; } else if (transform.position.z < _myPillar.transform.position.z) { _newDeathDirection.z += _cheatingSensitivity; } if (transform.position.x > _myPillar.transform.position.x) { _newDeathDirection.x -= _cheatingSensitivity; } else if (transform.position.x > _myPillar.transform.position.x) { _newDeathDirection.x += _cheatingSensitivity; } } if (Physics.Raycast(transform.position + Vector3.up, _newDeathDirection, out hit, _collisionCheckDist)) { if (hit.collider.GetComponent <ColoredBlock>()) { ColoredBlock other = hit.collider.GetComponent <ColoredBlock>(); if (_myColor == other.GetColor) { _myCollider.enabled = false; other.CorrectMatch(); _mySpawner.RemoveMe(this); Dead(); } else { _deathDirection = Vector3.zero; _myAgent.enabled = true; _hit = false; _dead = false; } } else if (!hit.collider.GetComponent <BaseEnemy>() && !hit.collider.GetComponent <PlayerController>()) { _newDeathDirection = Vector3.zero; _myAgent.enabled = true; _hit = false; _dead = false; _myAnimations.Play("Moving"); } } transform.position += _newDeathDirection * _knockBack * Time.deltaTime; break; case Mechanic.BOSS: break; default: break; } } }