// Use this for initialization void Start() { swFlag = transform.parent.GetComponent <SwitchFlag>(); speedMax = transform.parent.GetComponent <VelosityBlock>().power; speed = swFlag.flag ? speedMax : 0f; anim = GetComponent <Animator>(); }
public BombableWallActor(byte[] record, params int[] p) : base(record) { objectDependencies = p; flag = (byte)(Variable & 0x3F); dodongoCutscene = ((Variable & 0xA000) == 0); }
public BrownBoulderActor(byte[] record, params int[] p) : base(record) { objectDependencies = p; flags = (byte)Variable; type = ((Variable & 0x8000) > 0); }
/// <summary> /// Produces a <see cref="SwitchFlag"/> value from evaluating a series of conditions for use in a switch statement /// instead of using deeply nested if statements. /// </summary> /// <param name="firstCondition">The first condition to evaluate for a switch statement.</param> /// <param name="secondCondition">The second condition to evaluate for a switch statement.</param> /// <param name="thirdCondition">The third condition to evaluate for a switch statement.</param> /// <param name="forthCondition">The forth condition to evaluate for a switch statement.</param> /// <returns>The <see cref="SwitchFlag"/> value representing the evaluation of all the conditions.</returns> public static SwitchFlag From( bool firstCondition, bool secondCondition, bool thirdCondition, bool forthCondition) { SwitchFlag result = SwitchFlag.AllFalse; if (firstCondition) { result |= SwitchFlag.FirstTrue; } if (secondCondition) { result |= SwitchFlag.SecondTrue; } if (thirdCondition) { result |= SwitchFlag.ThirdTrue; } if (forthCondition) { result |= SwitchFlag.ForthTrue; } return(result); }
public FlameCircleActor(byte[] record, params int[] p) : base(record, p) { type = (byte)(Variable >> 12); camera = (byte)((Variable & 0xF00) >> 8); flags = (byte)(Variable & 0x3F); }
public GraveyardActor(byte[] record, params int[] p) : base(record) { objectDependencies = p; flags = (byte)(Variable >> 8); type = (byte)(Variable); }
public SilverRupeeActor(byte[] record, params int[] p) : base(record) { objectDependencies = p; type = (ushort)((Variable & 0xF000) >> 12); count = (ushort)((Variable & 0xFC0) >> 6); flags = (byte)(Variable & 0x3F); }
public WebActor(byte[] record, params int[] p) : base(record) { objectDependencies = p; setWhenBrokenFlag = (byte)(Variable & 0x3F); burnFlag = new SwitchFlag(Variable, 0x0FC0); type = (byte)((Variable & 0xF000) >> 12); }
public MoveableBlockActor(byte[] record, params int[] p) : base(record) { objectDependencies = p; flag = (byte)((Variable & 0x3F00) >> 8); color = (byte)((Variable & 0xF0) >> 4); risingEdge = ((Variable & 0x04) > 0); size = (byte)(Variable & 0x03); }
public override GameObject construct(GameObject prefab, Transform parent) { GameObject created = base.construct(prefab, parent); SwitchFlag switchFlag = created.GetComponent <SwitchFlag>(); if (switchFlag != null) { switchFlag.Setup( flag, switchable ); } return(created); }
public BlockSpotSwitchActor(byte[] record, params int[] p) : base(record) { objectDependencies = p; flag = (byte)(Variable); }
public LizafosActor(byte[] record, params int[] p) : base(record) { objectDependencies = p; type = (byte)Variable; flags = (byte)(Variable >> 8); }
public StandardDoorActor(byte[] record) : base(record) { flag = Shift.AsByte(Variable, 0x003F); locked = Shift.AsBool(Variable, 0x80); }
public SpiritStoneFaceActor(byte[] record, params int[] p) : base(record) { objectDependencies = p; flag = (byte)Variable; }
/// <summary> /// Determines whether the current switch flags value contains any of the specified flags. /// </summary> /// <param name="current">The current value to check for containing flags.</param> /// <param name="flags">The flags to check for.</param> /// <returns>True if the current value contains any of the flags; otherwise false.</returns> public static bool HasAnyFlag(this SwitchFlag current, SwitchFlag flags) { return((current & flags) != 0); }
// Update is called once per frame void Update() { if (Time.timeScale == 0) { return; } //ケーブルが伸び切るかオブジェクトに当たった時 if (usbRange == MAX_SCALE && flag) { //フラグをfalseにする flag = false; } //ケーブルが縮み切った時 if (!flag && usbRange == MIN_SCALE) { bool cFlag = false; //子オブジェクトにCableBlockがなければケーブルを消去する foreach (Transform child in cablePosition.transform) { if (child.gameObject.tag == "CableMoveBlock") { cableFlag = true; cFlag = true; } } if (!cFlag) { DestoryCable(); } } //USBが縮んでいるとき if (!flag) { bool downFlag = false; foreach (Transform child in cablePosition.transform) { //子オブジェクトのケーブルブロックを探す if (child.gameObject.name == "CableMoveBlock") { foreach (Transform child2 in child.transform) { //子オブジェクトのケーブルグラウンドを探す if (child2.gameObject.tag == "CableGround") { float range = 0.5f; //下にブロックが行っても大丈夫な状態ならケーブルの角度を変更する if (Physics.Raycast(child2.transform.position + new Vector3(0f, range, 0f) + (transform.forward * range), -Vector3.up, 0.5f, blockMask + LayerMask.GetMask("Enemy"))) { downFlag = true; } } } } } if (chilledBlock != null) { //USBコードを正面を向けるようにする targetAngleRotateY(transform.gameObject, cablePositionDefault.transform.eulerAngles, CABLE_ROTATE_SPEED); if (!downFlag) { targetAngleRotateX(transform.gameObject, cablePositionDefault.transform.eulerAngles, CABLE_ROTATE_SPEED); } } } //USBハブも正面に向ける if (!cableLock) { targetAngleRotateY(cablePosition, transform.eulerAngles, USB_ROTATE_SPEED); } //ケーブルの長さ変更 if (!cableFlag) { //USBケーブルの長さ変更 usbRange += SPEED * Time.deltaTime * BoolToInt(flag); //最大値や最小値を超えないように usbRange = Mathf.Clamp(usbRange, MIN_SCALE, MAX_SCALE); } if (flag) { RaycastHit hit; //レイを飛ばしてCableBlockがあるなら if (Physics.Raycast(transform.position, transform.forward, out hit, MAX_SCALE, cableMask)) { GameObject hitOb = hit.collider.transform.parent.gameObject; foreach (Transform child in hitOb.transform) { //子オブジェクトのケーブルブロックを探す if (child.gameObject.tag == "CablePositon") { //角度の変更 transform.LookAt(child.transform.position); //USBの角度の適応 cablePosition.transform.eulerAngles = transform.eulerAngles; //ケーブルがUsbBoxに当たった時(通り過ぎた時) if ((cablePosition.transform.position - (transform.position + transform.forward * usbRange)).magnitude > (cablePosition.transform.position - child.transform.position).magnitude) { if (!AboutFloat(transform.eulerAngles.y, child.transform.eulerAngles.y, 90f)) { DestoryFlag(); UsbRangeNormal(); break; } gameController.SeSoundLoad(AudioController.Se.Player_UsbSet); //USBの角度変更 transform.eulerAngles = child.eulerAngles; //場所変更 cablePosition.transform.position = child.transform.position; //Usbを指すための角度変更 cablePosition.transform.eulerAngles = child.eulerAngles; if (hitOb.tag == "CableMoveBlock") { cableMoveBlock = hitOb.gameObject.GetComponent <CableMoveBlock>(); playerMove.cableFlag = false; //子オブジェクトに設定 hitOb.transform.parent = cablePosition.transform; flag = false; //hitOb.GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezeAll; foreach (Transform child2 in hitOb.transform) { child2.gameObject.layer = LayerMask.NameToLayer("Default"); } hitOb.layer = LayerMask.NameToLayer("Default"); chilledBlock = hitOb; //リジッドボディの削除 Destroy(hitOb.GetComponent <Rigidbody>()); } else if (hitOb.tag == "CableSwitchBlock" || hitOb.tag == "ReloadBlock") { buttonUi.SetActive(true); childPort = hitOb; portBlockScript = childPort.GetComponent <PortBlock>(); ChildGimmickSearch(gimmickParent.transform, portBlockScript.portName); cableFlag = true; cableLockPositon = cablePosition.transform.position; cableLock = true; flag = false; } } else { //USBを伸ばす UsbRangeNormal(); } } } } else { UsbRangeNormal(); } } else { UsbRangeNormal(); } //ケーブルを持っているときの上移動 if (chilledBlock != null) { foreach (Transform child in cablePosition.transform) { //子オブジェクトのケーブルブロックを探す if (child.gameObject.name == "PortBlock") { BlockUpDown(child.gameObject); } } } //スイッチに当たっているとき if (cableLock) { //電源を入れる処理--------------------------------------- if (xBox.ButtonDown(XBox.Str.A)) { //電源の切り替え pawerFlag = !pawerFlag; //時間のリセット timer = 0f; } if (pawerFlag) { PortBlock pB = childPort.GetComponent <PortBlock>(); //変更する処理 if (TimerCount(pB.Timer, ref timer)) { ElectricCreate(childPort); gameController.SeSoundLoad(AudioController.Se.Player_UsbPower); if (childPort.name == "ReloadPort") { playerCharacter.GetComponent <PlayerMove>().Reload(); } for (int i = 0; i < childGimmick.Count; i++) { if (childGimmick[i].GetComponent <SwitchFlag>() != null) { SwitchFlag sF = childGimmick[i].GetComponent <SwitchFlag>(); sF.flag = !sF.flag; } if (childGimmick[i].GetComponent <SwitchBomb>() != null) { SwitchBomb sB = childGimmick[i].GetComponent <SwitchBomb>(); //入っていればカウントを進め時間が来れば発射する if (sB.bulletNum > 0) { sB.bulletNum--; //生成 GameObject bulletOb = Instantiate(sB.bullet); //場所と角度の設定 foreach (Transform child in childGimmick[i].transform) { if (child.transform.name == "BulletPositon") { bulletOb.transform.position = child.transform.position; bulletOb.transform.eulerAngles = child.transform.eulerAngles; } } } } } pawerFlag = false; } } for (int i = 0; i < childGimmick.Count; i++) { //扇風機を回転させる処理------------------------------------------------------- if (childGimmick[i].name == "Wind") { //場所と角度の設定 foreach (Transform child in childGimmick[i].transform) { //扇風機の羽の部分 if (child.transform.tag == "Wing") { Vector3 angle = child.gameObject.transform.eulerAngles; Vector2 rotate = new Vector2(Input.GetAxis((XBox.AxisStr.LeftButtonUp).ToString()), Input.GetAxis((XBox.AxisStr.LeftButtonRight).ToString())).normalized * 30f * Time.deltaTime; angle += new Vector3(rotate.x, rotate.y, 0F); if (angle.x > 0 && angle.x < 90) { angle.x = 0f; } if (angle.x < -90) { angle.x = -90f; } child.gameObject.transform.eulerAngles = angle; //場所と角度の設定 } } } } UsbRangeNormal(); cablePosition.transform.position = cableLockPositon; //ケーブルの長さを算出し、限界の長さを超えていたら消去 if ((cableLockPositon - transform.position).magnitude > MAX_SCALE) { DestoryFlag(); usbRange = MAX_SCALE; } //大きく動いたらケーブルを離す if (Mathf.Abs(xBox.AxisGet(XBox.AxisStr.LeftJoyRight)) > 0.8f || Mathf.Abs(xBox.AxisGet(XBox.AxisStr.LeftJoyUp)) > 0.8f) { DestoryFlag(); } } //ケーブルの向きの更新 transform.LookAt(cablePosition.transform.position); //ケーブルの長さの更新 ScaleChange(Vector3.Distance(cablePosition.transform.position, transform.position)); //ケーブルを手放す処理 if (chilledBlock != null && usbRange == MIN_SCALE) { if (playerMove.isGround || !cableMoveBlock.isGround) { blockTimer = 0f; } else { if (TimerCount(BLOCK_TIMER_MAX, ref blockTimer)) { DestoryFlag(); blockTimer = 0f; } } } }
public LiftingDoorActor(byte[] record) : base(record) { flags = Shift.AsByte(Variable, 0x003F); type = Shift.AsByte(Variable, 0x0FC0); }
/// <summary> /// Determines whether the current switch flags value contains the specified flag or flags (all of them). /// This implementation is faster than the Enum.HasFlag method because it avoids boxing of values. /// </summary> /// <param name="current">The current value to check for containing flags.</param> /// <param name="flag">The flag or combined flags to check for.</param> /// <returns>True if the current value contains the flag(s); otherwise false.</returns> public static bool HasFlagEfficient(this SwitchFlag current, SwitchFlag flag) { return((current & flag) == flag); }
public TransitionPlaneActor(byte[] record) : base(record) { flag = Shift.AsByte(Variable, 0x003F); type = Shift.AsUInt16(Variable, 0xFFC0); }
public MegatonStatueActor(byte[] record, params int[] p) : base(record, p) { flag = new SwitchFlag(Variable, 0x3F00);//(byte)((Variable & 0x3F00) >> 8); type = (byte)(Variable & 0xFF); }
public WellWaterActor(byte[] record, params int[] p) : base(record) { objectDependencies = p; flag = (byte)(Variable & 0x3F); }
public TimeBlockActor(byte[] record, params int[] p) : base(record, p) { flag = (byte)(Variable & 0x3F); }
public StoneStairsActor(byte[] record, params int[] p) : base(record) { objectDependencies = p; flags = (byte)Variable; }