示例#1
0
        private void PathChange()
        {
            RenderTargetCube tc = new RenderTargetCube(Game1.graphicsDevice, Math.Max(64, (int)Resolution.get()), false, SurfaceFormat.Color, DepthFormat.None);

            {
                for (int i = 0; i < 6; i++)
                {
                    CubeMapFace face = (CubeMapFace)i;
                    SkyFaceTexture = AssetManager.Load <Texture2D>(this.GetParent().TextureDirectory.get() +
                                                                   Path.get() + face.ToString().Substring(0, 3).ToLower() +
                                                                   face.ToString().Last().ToString().ToUpper());
                    Game1.graphicsDevice.SetRenderTarget(tc, face);
                    Game1.graphicsDevice.Clear(Color.Black);
                    Game1.graphicsDevice.Textures[0] = SkyFaceTexture;
                    Deferred3DScene.PasteEffect.CurrentTechnique.Passes[0].Apply();
                    FullscreenQuad.Draw();
                }
            }

            Game1.graphicsDevice.SetRenderTarget(null);
            Game1.graphicsDevice.Clear(Color.Transparent);
            if (MyCube.get() != null)
            {
                MyCube.get().Dispose();
            }
            MyCube.set(tc);
        }
示例#2
0
    //----------------------------------------------------------------------------------------------------
    /// <summary>
    /// 当たり判定
    /// </summary>
    private void OnTriggerEnter(Collider other)
    {
        if (!myAiBoss)
        {
            return;
        }

        if (other.gameObject.name == myAiBoss.PlayerObjectName)
        {
            //頂点の位置
            Vector3 vLDB = new Vector3(gameObject.transform.position.x - m_cubeLength, gameObject.transform.position.y - m_cubeLength, gameObject.transform.position.z - m_cubeLength);
            Vector3 vLDF = new Vector3(gameObject.transform.position.x - m_cubeLength, gameObject.transform.position.y - m_cubeLength, gameObject.transform.position.z + m_cubeLength);
            Vector3 vLUB = new Vector3(gameObject.transform.position.x - m_cubeLength, gameObject.transform.position.y + m_cubeLength, gameObject.transform.position.z - m_cubeLength);
            Vector3 vLUF = new Vector3(gameObject.transform.position.x - m_cubeLength, gameObject.transform.position.y + m_cubeLength, gameObject.transform.position.z + m_cubeLength);
            Vector3 vRDB = new Vector3(gameObject.transform.position.x + m_cubeLength, gameObject.transform.position.y - m_cubeLength, gameObject.transform.position.z - m_cubeLength);
            Vector3 vRDF = new Vector3(gameObject.transform.position.x + m_cubeLength, gameObject.transform.position.y - m_cubeLength, gameObject.transform.position.z + m_cubeLength);
            Vector3 vRUB = new Vector3(gameObject.transform.position.x + m_cubeLength, gameObject.transform.position.y + m_cubeLength, gameObject.transform.position.z - m_cubeLength);
            Vector3 vRUF = new Vector3(gameObject.transform.position.x + m_cubeLength, gameObject.transform.position.y + m_cubeLength, gameObject.transform.position.z + m_cubeLength);

            //当たり判定発生
            MyCube explosionRange = new MyCube(vLDB, vRDB, vLDF, vRDF, vLUB, vRUB, vLUF, vRUF);
            myAttackManager.EnemyAttack(explosionRange, MaskAttribute.Non, myAiBoss.Attack, 0.1f);

            //削除
            Destroy(this.gameObject);
        }
    }
示例#3
0
    //----------------------------------------------------------------------------------------------------
    /// <summary>
    /// 爆発本体
    /// </summary>
    public void Explosion()
    {
        //エフェクトプレファブ
        GameObject bombEffect = GameObject.Instantiate(m_bombEffect) as GameObject;

        bombEffect.transform.position = m_effectPoint.position;

        //当たり判定Cube
        explosionPoint = this.gameObject.transform.position;

        //頂点の位置
        Vector3 vLDB = new Vector3(explosionPoint.x - m_bombPower, explosionPoint.y - m_bombPower, explosionPoint.z - m_bombPower);
        Vector3 vLDF = new Vector3(explosionPoint.x - m_bombPower, explosionPoint.y - m_bombPower, explosionPoint.z + m_bombPower);
        Vector3 vLUB = new Vector3(explosionPoint.x - m_bombPower, explosionPoint.y + m_bombPower, explosionPoint.z - m_bombPower);
        Vector3 vLUF = new Vector3(explosionPoint.x - m_bombPower, explosionPoint.y + m_bombPower, explosionPoint.z + m_bombPower);
        Vector3 vRDB = new Vector3(explosionPoint.x + m_bombPower, explosionPoint.y - m_bombPower, explosionPoint.z - m_bombPower);
        Vector3 vRDF = new Vector3(explosionPoint.x + m_bombPower, explosionPoint.y - m_bombPower, explosionPoint.z + m_bombPower);
        Vector3 vRUB = new Vector3(explosionPoint.x + m_bombPower, explosionPoint.y + m_bombPower, explosionPoint.z - m_bombPower);
        Vector3 vRUF = new Vector3(explosionPoint.x + m_bombPower, explosionPoint.y + m_bombPower, explosionPoint.z + m_bombPower);

        //当たり判定発生
        MyCube explosionRange = new MyCube(vLDB, vRDB, vLDF, vRDF, vLUB, vRUB, vLUF, vRUF);

        myAttackManager.EnemyAttack(explosionRange, MaskAttribute.Non, myAiBoss.Attack, 1);

        //爆弾削除
        Destroy(this.gameObject);

        //SEの再生
        MySoundManager.Instance.Play(SeCollection.Explosion, true, transform.position.x, transform.position.y, transform.position.z);
    }
示例#4
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        MyCube myCube = (MyCube)target;

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Cambiar Color"))
        {
            myCube.GenerateColor();
        }

        if (GUILayout.Button("Reset"))
        {
            myCube.Reset();
        }



        GUILayout.EndHorizontal();

        myCube.size = EditorGUILayout.Slider(myCube.size, 0f, 1f);
        myCube.transform.localScale = Vector3.one * myCube.size;
    }
示例#5
0
        internal void Init()
        {
            using (MyCube.Pin())
            {
                if (!MyCube.MarkedForClose && Entity != null)
                {
                    Ai.FirstRun = true;

                    StorageSetup();
                    InventoryInit();
                    PowerInit();

                    if (Platform.State == MyWeaponPlatform.PlatformState.Inited)
                    {
                        Platform.ResetParts(this);
                    }

                    Entity.NeedsWorldMatrix = true;

                    if (!Ai.GridInit)
                    {
                        Session.CompReAdds.Add(new CompReAdd {
                            Ai = Ai, AiVersion = Ai.Version, AddTick = Ai.Session.Tick, Comp = this
                        });
                    }
                    else
                    {
                        OnAddedToSceneTasks();
                    }

                    Platform.State = MyWeaponPlatform.PlatformState.Ready;

                    for (int i = 0; i < Platform.Weapons.Length; i++)
                    {
                        var weapon = Platform.Weapons[i];
                        weapon.UpdatePivotPos();

                        if (Session.IsClient)
                        {
                            weapon.Target.ClientDirty = true;
                        }

                        if (weapon.Ammo.CurrentAmmo == 0 && !weapon.Reloading)
                        {
                            weapon.EventTriggerStateChanged(EventTriggers.EmptyOnGameLoad, true);
                        }

                        weapon.Azimuth   = weapon.System.HomeAzimuth;
                        weapon.Elevation = weapon.System.HomeElevation;

                        weapon.AimBarrel();
                    }
                }
                else
                {
                    Log.Line($"Comp Init() failed");
                }
            }
        }
示例#6
0
 public override void Destroy()
 {
     if (MyCube.get() != null)
     {
         MyCube.get().Dispose();
     }
     base.Destroy();
 }
 internal void TerminalRefresh(bool update = true)
 {
     Emitter.RefreshCustomInfo();
     if (update && InControlPanel && InThisTerminal)
     {
         MyCube.UpdateTerminal();
     }
 }
示例#8
0
    public CubeMove(MyCube target, float moveSpeed)
    {
        this.target = target;

        this.moveSpeed = moveSpeed;


        execute();
    }
示例#9
0
        private bool GridOwnsController()
        {
            var notTime = _tick != 0 && _tick % 600 != 0;

            if (notTime && !DsState.State.ControllerGridAccess)
            {
                return(false);
            }
            if (notTime)
            {
                return(true);
            }
            var myGridBigOwners = MyGrid.BigOwners;

            if (myGridBigOwners.Count == 0)
            {
                DsState.State.ControllerGridAccess = false;
                return(false);
            }
            if (MyCube.OwnerId == 0)
            {
                MyCube.ChangeOwner(myGridBigOwners[0], MyOwnershipShareModeEnum.Faction);
            }

            var controlToGridRelataion = MyCube.GetUserRelationToOwner(myGridBigOwners[0]);

            DsState.State.InFaction = controlToGridRelataion == MyRelationsBetweenPlayerAndBlock.FactionShare;
            DsState.State.IsOwner   = controlToGridRelataion == MyRelationsBetweenPlayerAndBlock.Owner;

            if (controlToGridRelataion != MyRelationsBetweenPlayerAndBlock.Owner && controlToGridRelataion != MyRelationsBetweenPlayerAndBlock.FactionShare)
            {
                if (DsState.State.ControllerGridAccess)
                {
                    DsState.State.ControllerGridAccess = false;
                    Shield.RefreshCustomInfo();
                    if (Session.Enforced.Debug == 4)
                    {
                        Log.Line($"GridOwner: controller is not owned: {ShieldMode} - ShieldId [{Shield.EntityId}]");
                    }
                }
                DsState.State.ControllerGridAccess = false;
                return(false);
            }

            if (!DsState.State.ControllerGridAccess)
            {
                DsState.State.ControllerGridAccess = true;
                Shield.RefreshCustomInfo();
                if (Session.Enforced.Debug == 4)
                {
                    Log.Line($"GridOwner: controller is owned: {ShieldMode} - ShieldId [{Shield.EntityId}]");
                }
            }
            DsState.State.ControllerGridAccess = true;
            return(true);
        }
示例#10
0
    //----------------------------------------------------------------------------------------------------
    ///<summary>
    ///特殊攻撃//
    ///</summary>
    public void SpecialAttack()
    {
        switch (m_myObjectName)
        {
        case "CarryMinister(Clone)":
            float warpPosX, warpPosY, warpPosZ;
            float randamX = Random.Range(-4, 4);
            float randamZ = Random.Range(-4, 4);
            warpPosX = myStage.CurrentField.BossRoomCenterPos.x + randamX;
            warpPosY = myStage.CurrentField.BossRoomCenterPos.y + 1;
            warpPosZ = myStage.CurrentField.BossRoomCenterPos.z + randamZ;
            myPlayer.transform.position = new Vector3(warpPosX, warpPosY, warpPosZ);

            //SEの再生
            MySoundManager.Instance.Play(SeCollection.Warp,
                                         true, myPlayer.transform.position.x, myPlayer.transform.position.y, myPlayer.transform.position.z);
            break;

        case "VirusMinister(Clone)":
            m_attack = 5;
            Vector3 attackPoint = GameObject.Find(m_myObjectName).transform.position;

            GameObject poizonfog = GameObject.Instantiate(poizonFog) as GameObject;
            poizonfog.transform.position = transform.position;

            float cubeLength = 2f;
            //頂点の位置
            Vector3 vLDB = new Vector3(attackPoint.x - cubeLength, 1 + attackPoint.y - cubeLength, attackPoint.z - cubeLength);
            Vector3 vLDF = new Vector3(attackPoint.x - cubeLength, 1 + attackPoint.y - cubeLength, attackPoint.z + cubeLength);
            Vector3 vLUB = new Vector3(attackPoint.x - cubeLength, 1 + attackPoint.y + cubeLength, attackPoint.z - cubeLength);
            Vector3 vLUF = new Vector3(attackPoint.x - cubeLength, 1 + attackPoint.y + cubeLength, attackPoint.z + cubeLength);
            Vector3 vRDB = new Vector3(attackPoint.x + cubeLength, 1 + attackPoint.y - cubeLength, attackPoint.z - cubeLength);
            Vector3 vRDF = new Vector3(attackPoint.x + cubeLength, 1 + attackPoint.y - cubeLength, attackPoint.z + cubeLength);
            Vector3 vRUB = new Vector3(attackPoint.x + cubeLength, 1 + attackPoint.y + cubeLength, attackPoint.z - cubeLength);
            Vector3 vRUF = new Vector3(attackPoint.x + cubeLength, 1 + attackPoint.y + cubeLength, attackPoint.z + cubeLength);

            ////当たり判定発生
            MyCube attackRange = new MyCube(vLDB, vRDB, vLDF, vRDF, vLUB, vRUB, vLUF, vRUF);
            myAttackManager.EnemyAttack(attackRange, MaskAttribute.Virus, m_attack, 2);
            m_attack = 25;

            //SEの再生
            MySoundManager.Instance.Play(SeCollection.PoisonGas, true, transform.position.x, transform.position.y, transform.position.z);
            break;

        case "MirrorMinister(Clone)":
            break;

        case "MagicMinister(Clone)":
            break;
        }
        m_gameTime            = 0;
        m_specialAttackCount += 1;
    }
示例#11
0
    public override BuildingMaterial TakeMaterial(Transform carryPos)
    {
        //deparent the log
        //lmao this will all have to change
        BuildingMaterial _log = UpgradeModels[1].GetComponent <BuildingMaterial>();

        _log.transform.parent = carryPos;//the log
        _log.transform.DOLocalMove(Vector3.zero, 0.5f);
        _log.transform.DOLocalRotate(Vector3.zero, 0.5f);
        MyCube.UpgradeTile(CubeUpgradeTypes.Nil);
        return(_log);
    }
示例#12
0
        internal void TerminalRefresh(bool update = true)
        {
            if (Ai?.LastTerminal == MyCube)
            {
                TerminalBlock.RefreshCustomInfo();
            }

            if (update && InControlPanel)
            {
                MyCube.UpdateTerminal();
            }
        }
示例#13
0
        private void BlockReset(bool clearAnimation)
        {
            if (!IsFunctional)
            {
                return;
            }

            if (!_compact && SubpartRotor == null)
            {
                Entity.TryGetSubpart("Rotor", out SubpartRotor);
                if (SubpartRotor == null)
                {
                    return;
                }
            }
            else if (!_compact)
            {
                if (SubpartRotor.Closed)
                {
                    SubpartRotor.Subparts.Clear();
                }
                Entity.TryGetSubpart("Rotor", out SubpartRotor);
            }

            if (clearAnimation)
            {
                _blockReset       = true;
                RotationTime      = 0;
                TranslationTime   = 0;
                AnimationLoop     = 0;
                EmissiveIntensity = 0;

                if (!_compact)
                {
                    var rotationMatrix = Matrix.CreateRotationY(0);
                    var matrix         = rotationMatrix * Matrix.CreateTranslation(0, 0, 0);
                    SubpartRotor.PositionComp.SetLocalMatrix(ref matrix, null, true);
                    SubpartRotor.SetEmissiveParts(PlasmaEmissive, Color.Transparent, 0);
                }
                else
                {
                    MyCube.SetEmissiveParts(PlasmaEmissive, Color.Transparent, 0);
                }
            }

            if (Session.Enforced.Debug == 3)
            {
                Log.Line($"EmitterAnimationReset: [EmitterType: {Definition.Name} - Compact({_compact})] - Tick:{_tick.ToString()} - EmitterId [{Emitter.EntityId}]");
            }
        }
示例#14
0
    private void OnEnable()
    {
        if (lastCube == null)
        {
            lastCube = GameObject.Find("Main Cube").GetComponent <MyCube>();
        }

        if (startActionType != ActionType.NONE)
        {
            currentCube = this;
        }

        transform.localScale = new Vector3(lastCube.transform.localScale.x, transform.localScale.y, lastCube.transform.localScale.z);
    }
示例#15
0
        public void RemoveDecals(Vector3I position)
        {
            List <MyDecalPartIdentity> decals;

            if (m_cubeDecals.TryGetValue(position, out decals))
            {
                MyCube cube = null;
                for (int it = 0; it < decals.Count; it++)
                {
                    RemoveDecal(position, decals, it, ref cube);
                }

                decals.Clear();
            }
        }
示例#16
0
        public bool GridEnemy(MyCubeGrid grid, List <long> owners = null)
        {
            if (owners == null)
            {
                owners = grid.BigOwners;
            }
            if (owners.Count == 0)
            {
                return(true);
            }
            var relationship = MyCube.GetUserRelationToOwner(owners[0]);
            var enemy        = relationship != MyRelationsBetweenPlayerAndBlock.Owner && relationship != MyRelationsBetweenPlayerAndBlock.FactionShare;

            return(enemy);
        }
示例#17
0
        private void InventoryInit()
        {
            using (MyCube.Pin())
            {
                if (InventoryInited || !MyCube.HasInventory || MyCube.MarkedForClose || (Platform.State != MyWeaponPlatform.PlatformState.Inited && Platform.State != MyWeaponPlatform.PlatformState.Incomplete) || BlockInventory == null)
                {
                    Platform.PlatformCrash(this, false, true, $"InventoryInit failed: IsInitted:{InventoryInited} - NoInventory:{!MyCube.HasInventory} - Marked:{MyCube.MarkedForClose} - PlatformNotReady:{Platform.State != MyWeaponPlatform.PlatformState.Ready}({Platform.State}) - nullInventory:{BlockInventory == null}");
                    return;
                }

                if (MyCube is IMyConveyorSorter || BlockInventory.Constraint == null)
                {
                    BlockInventory.Constraint = new MyInventoryConstraint("ammo");
                }

                BlockInventory.Constraint.m_useDefaultIcon = false;
                BlockInventory.Refresh();
                BlockInventory.Constraint.Clear();

                if (!string.IsNullOrEmpty(CustomIcon))
                {
                    var iconPath = Platform.Structure.ModPath + "\\Textures\\GUI\\Icons\\" + CustomIcon;
                    BlockInventory.Constraint.Icon = iconPath;
                    BlockInventory.Constraint.UpdateIcon();
                }

                for (int i = 0; i < Platform.Weapons.Length; i++)
                {
                    var w = Platform.Weapons[i];

                    if (w == null)
                    {
                        Log.Line($"InventoryInit weapon null");
                        continue;
                    }
                    for (int j = 0; j < w.System.AmmoTypes.Length; j++)
                    {
                        if (w.System.AmmoTypes[j].AmmoDef.Const.MagazineDef != null)
                        {
                            BlockInventory.Constraint.Add(w.System.AmmoTypes[j].AmmoDef.Const.MagazineDef.Id);
                        }
                    }
                }
                BlockInventory.Refresh();

                InventoryInited = true;
            }
        }
示例#18
0
        private void GridOwnsController()
        {
            if (MyGrid.BigOwners.Count == 0)
            {
                DsState.State.ControllerGridAccess = false;
                return;
            }

            _gridOwnerId       = MyGrid.BigOwners[0];
            _controllerOwnerId = MyCube.OwnerId;

            if (_controllerOwnerId == 0)
            {
                MyCube.ChangeOwner(_gridOwnerId, MyOwnershipShareModeEnum.Faction);
            }

            var controlToGridRelataion = MyCube.GetUserRelationToOwner(_gridOwnerId);

            DsState.State.InFaction = controlToGridRelataion == MyRelationsBetweenPlayerAndBlock.FactionShare;
            DsState.State.IsOwner   = controlToGridRelataion == MyRelationsBetweenPlayerAndBlock.Owner;

            if (controlToGridRelataion != MyRelationsBetweenPlayerAndBlock.Owner && controlToGridRelataion != MyRelationsBetweenPlayerAndBlock.FactionShare)
            {
                if (DsState.State.ControllerGridAccess)
                {
                    DsState.State.ControllerGridAccess = false;
                    Shield.RefreshCustomInfo();
                    if (Session.Enforced.Debug == 4)
                    {
                        Log.Line($"GridOwner: controller is not owned: {ShieldMode} - ShieldId [{Shield.EntityId}]");
                    }
                }
                DsState.State.ControllerGridAccess = false;
                return;
            }

            if (!DsState.State.ControllerGridAccess)
            {
                DsState.State.ControllerGridAccess = true;
                Shield.RefreshCustomInfo();
                if (Session.Enforced.Debug == 4)
                {
                    Log.Line($"GridOwner: controller is owned: {ShieldMode} - ShieldId [{Shield.EntityId}]");
                }
            }
            DsState.State.ControllerGridAccess = true;
        }
示例#19
0
        private void InventoryInit()
        {
            using (MyCube?.Pin())
            {
                if (InventoryInited || MyCube == null || !MyCube.HasInventory || MyCube.MarkedForClose || Platform == null || Platform.State == MyWeaponPlatform.PlatformState.Invalid || Platform.Weapons?.Length == 0 || BlockInventory == null)
                {
                    return;
                }


                if (MyCube is IMyConveyorSorter || BlockInventory.Constraint == null)
                {
                    BlockInventory.Constraint = new MyInventoryConstraint("ammo");
                }

                BlockInventory.Constraint.m_useDefaultIcon = false;
                BlockInventory.ResetVolume();
                BlockInventory.Refresh();
                BlockInventory.Constraint.Clear();

                var maxInventoryVolume = 0f;
                for (int i = 0; i < Platform.Weapons.Length; i++)
                {
                    var w = Platform.Weapons[i];

                    if (w == null)
                    {
                        continue;
                    }

                    for (int j = 0; j < w.System?.WeaponAmmoTypes?.Length; j++)
                    {
                        if (w.System.WeaponAmmoTypes[j].AmmoDef.Const.MagazineDef != null)
                        {
                            BlockInventory.Constraint.Add(w.System.WeaponAmmoTypes[j].AmmoDef.Const.MagazineDef.Id);
                        }
                    }

                    maxInventoryVolume += w.System?.MaxAmmoVolume ?? 0;
                }

                BlockInventory.FixInventoryVolume(maxInventoryVolume);
                BlockInventory.Refresh();

                InventoryInited = true;
            }
        }
示例#20
0
        internal void SubpartClosed(MyEntity ent)
        {
            try
            {
                if (ent == null)
                {
                    return;
                }

                using (MyCube.Pin())
                {
                    ent.OnClose -= SubpartClosed;
                    if (!MyCube.MarkedForClose && Platform.State == MyWeaponPlatform.PlatformState.Ready)
                    {
                        Platform.ResetParts(this);
                        Status = Start.Started;

                        foreach (var w in Platform.Weapons)
                        {
                            w.Azimuth   = 0;
                            w.Elevation = 0;
                            w.Elevation = 0;

                            if (w.ActiveAmmoDef.AmmoDef.Const.MustCharge)
                            {
                                w.Reloading = false;
                            }

                            if (!FunctionalBlock.Enabled)
                            {
                                w.EventTriggerStateChanged(EventTriggers.TurnOff, true);
                            }
                            else if (w.AnimationsSet.ContainsKey(EventTriggers.TurnOn))
                            {
                                Session.FutureEvents.Schedule(w.TurnOnAV, null, 100);
                            }

                            if (w.Ammo.CurrentAmmo == 0)
                            {
                                w.EventTriggerStateChanged(EventTriggers.EmptyOnGameLoad, true);
                            }
                        }
                    }
                }
            }
            catch (Exception ex) { Log.Line($"Exception in SubpartClosed: {ex}"); }
        }
示例#21
0
    public CubeStop(MyCube target)
    {
        this.target = target;

        float remainder = calculateRemainder();


        float min = 0.04f;
        float max = CubeSpawner.startSpawnDirection == SpawnDirection.LEFT ?
                    MyCube.lastCube.transform.localScale.z : MyCube.lastCube.transform.localScale.x;

        float direction = remainder > 0 ? 1f : -1f;

        if (Mathf.Abs(remainder) < max && Mathf.Abs(remainder) > min)
        {
            target.isDocking = true;

            if (CubeSpawner.startSpawnDirection == SpawnDirection.LEFT)
            {
                spliteZoneZ(remainder, direction);
            }
            else if (CubeSpawner.startSpawnDirection == SpawnDirection.RIGHT)
            {
                spliteZoneX(remainder, direction);
            }
        }
        else if (Mathf.Abs(remainder) <= min)
        {
            target.isDocking = true;

            connectionZones();

            GameController.getInstance().combo();
        }
        else
        {
            target.isDocking = false;

            this.target.gameObject.AddComponent <Rigidbody>();
            this.target.gameObject.AddComponent <RemoveCube>();

            GameController.getInstance().endGame();

            Debug.Log("END GAME");
        }
    }
示例#22
0
        internal void TerminalRefresh(bool update = true)
        {
            if (Platform.State != MyWeaponPlatform.PlatformState.Ready || Status != Start.Started)
            {
                return;
            }

            if (Ai?.LastTerminal == MyCube)
            {
                TerminalBlock.RefreshCustomInfo();

                if (update && InControlPanel)
                {
                    MyCube.UpdateTerminal();
                }
            }
        }
示例#23
0
        private void Timing()
        {
            if (_tock60 && !_isDedicated && MyAPIGateway.Gui.GetCurrentScreen == MyTerminalPageEnum.ControlPanel && Session.Instance.LastTerminalId == Modulator.EntityId)
            {
                Modulator.RefreshCustomInfo();
                MyCube.UpdateTerminal();
            }

            if (_tock33)
            {
                if (SettingsUpdated)
                {
                    SettingsUpdated = false;
                    ModSet.SaveSettings();
                    ModState.SaveState();
                    if (Session.Enforced.Debug == 3)
                    {
                        Log.Line($"SettingsUpdated: server:{_isServer} - ModulatorId [{Modulator.EntityId}]");
                    }
                }
            }
            else if (_tock34)
            {
                if (ClientUiUpdate)
                {
                    ClientUiUpdate = false;
                    MyCube.UpdateTerminal();
                    Modulator.RefreshCustomInfo();
                    if (!_isServer)
                    {
                        ModSet.NetworkUpdate();
                    }
                }
            }

            if (_isDedicated || (_subDelayed && _tick > _subTick + 9))
            {
                if (Session.Enforced.Debug == 3)
                {
                    Log.Line($"Delayed tick: {_tick} - hierarchytick: {_subTick}");
                }
                _subDelayed = false;
                HierarchyChanged();
            }
        }
示例#24
0
        private void Timing()
        {
            if (_count++ == 59)
            {
                _count = 0;
                _lCount++;
                if (_lCount == 10)
                {
                    _lCount = 0;
                    _eCount++;
                    if (_eCount == 10)
                    {
                        _eCount = 0;
                    }
                }
            }

            if (_isServer)
            {
                if (_shapeEvent || FitChanged)
                {
                    CheckExtents();
                }
                if (_adjustShape)
                {
                    AdjustShape(true);
                }
                HeatManager();
            }

            if (_count == 29)
            {
                if (!_isDedicated)
                {
                    Shield.RefreshCustomInfo();
                    if (MyAPIGateway.Gui.GetCurrentScreen == MyTerminalPageEnum.ControlPanel && Session.Instance.LastTerminalId == Shield.EntityId)
                    {
                        MyCube.UpdateTerminal();
                    }
                }
                _runningDamage = _dpsAvg.Add((int)_damageReadOut);
                _runningHeal   = _hpsAvg.Add((int)(_shieldChargeRate * ConvToHp));
                _damageReadOut = 0;
            }
        }
示例#25
0
        private void Timing()
        {
            if (_tock60 && !_isDedicated)
            {
                TerminalRefresh();
            }

            if (_tock33)
            {
                if (SettingsUpdated)
                {
                    SettingsUpdated = false;
                    ModSet.SaveSettings();
                    ModState.SaveState();
                    if (Session.Enforced.Debug == 3)
                    {
                        Log.Line($"SettingsUpdated: server:{_isServer} - ModulatorId [{Modulator.EntityId}]");
                    }
                }
            }
            else if (_tock34)
            {
                if (ClientUiUpdate)
                {
                    ClientUiUpdate = false;
                    MyCube.UpdateTerminal();
                    Modulator.RefreshCustomInfo();
                    if (!_isServer)
                    {
                        ModSet.NetworkUpdate();
                    }
                }
            }

            if (_isDedicated || (_subDelayed && _tick > _subTick + 9))
            {
                if (Session.Enforced.Debug == 3)
                {
                    Log.Line($"Delayed tick: {_tick} - hierarchytick: {_subTick}");
                }
                _subDelayed = false;
                HierarchyChanged();
            }
        }
示例#26
0
    //----------------------------------------------------------------------------------------------------
    /// <summary>
    /// カウンター攻撃当たり判定
    /// </summary>
    void CounterAttack()
    {
        float m_length = 0.8f;

        Vector3 vLDB = new Vector3(transform.position.x - m_length, 1 + transform.position.y - m_length, transform.position.z - m_length);
        Vector3 vLDF = new Vector3(transform.position.x - m_length, 1 + transform.position.y - m_length, transform.position.z + m_length);
        Vector3 vLUB = new Vector3(transform.position.x - m_length, 1 + transform.position.y + m_length, transform.position.z - m_length);
        Vector3 vLUF = new Vector3(transform.position.x - m_length, 1 + transform.position.y + m_length, transform.position.z + m_length);
        Vector3 vRDB = new Vector3(transform.position.x + m_length, 1 + transform.position.y - m_length, transform.position.z - m_length);
        Vector3 vRDF = new Vector3(transform.position.x + m_length, 1 + transform.position.y - m_length, transform.position.z + m_length);
        Vector3 vRUB = new Vector3(transform.position.x + m_length, 1 + transform.position.y + m_length, transform.position.z - m_length);
        Vector3 vRUF = new Vector3(transform.position.x + m_length, 1 + transform.position.y + m_length, transform.position.z + m_length);

        //当たり判定発生と攻撃
        MyCube attackRange = new MyCube(vLDB, vRDB, vLDF, vRDF, vLUB, vRUB, vLUF, vRUF);

        AttackManagerScript.EnemyAttack(attackRange, MaskAttribute.Non, m_attack, 0.1f);
        m_counterAttackFlag = 0;
    }
示例#27
0
    //----------------------------------------------------------------------------------------------------
    ///<summary>
    ///攻撃当たり範囲作成//
    ///</summary>
    void MakeAttackRange()
    {
        Vector3 attackPoint = GameObject.Find(m_myObjectName).transform.position;

        float cubeLength = 1f;
        //頂点の位置
        Vector3 vLDB = new Vector3(attackPoint.x - cubeLength, 1 + attackPoint.y - cubeLength, attackPoint.z - cubeLength);
        Vector3 vLDF = new Vector3(attackPoint.x - cubeLength, 1 + attackPoint.y - cubeLength, attackPoint.z + cubeLength);
        Vector3 vLUB = new Vector3(attackPoint.x - cubeLength, 1 + attackPoint.y + cubeLength, attackPoint.z - cubeLength);
        Vector3 vLUF = new Vector3(attackPoint.x - cubeLength, 1 + attackPoint.y + cubeLength, attackPoint.z + cubeLength);
        Vector3 vRDB = new Vector3(attackPoint.x + cubeLength, 1 + attackPoint.y - cubeLength, attackPoint.z - cubeLength);
        Vector3 vRDF = new Vector3(attackPoint.x + cubeLength, 1 + attackPoint.y - cubeLength, attackPoint.z + cubeLength);
        Vector3 vRUB = new Vector3(attackPoint.x + cubeLength, 1 + attackPoint.y + cubeLength, attackPoint.z - cubeLength);
        Vector3 vRUF = new Vector3(attackPoint.x + cubeLength, 1 + attackPoint.y + cubeLength, attackPoint.z + cubeLength);

        //当たり判定発生
        MyCube attackRange = new MyCube(vLDB, vRDB, vLDF, vRDF, vLUB, vRUB, vLUF, vRUF);

        myAttackManager.EnemyAttack(attackRange, MaskAttribute.Non, m_attack, 1);
    }
示例#28
0
    public void selectAction(ActionType type)
    {
        switch (type)
        {
        case ActionType.MOVE:
            action = new CubeMove(this, moveSpeed);
            break;

        case ActionType.STOP:
            DOTween.KillAll();
            action = new CubeStop(this);

            lastCube = currentCube;

            break;

        default: action = null;
            break;
        }
    }
示例#29
0
        internal void SubpartClosed(MyEntity ent)
        {
            try
            {
                if (ent == null || MyCube == null)
                {
                    return;
                }

                using (MyCube.Pin())
                {
                    ent.OnClose -= SubpartClosed;
                    if (!MyCube.MarkedForClose && Platform.State == MyWeaponPlatform.PlatformState.Ready)
                    {
                        Platform.ResetParts(this);
                        Status = Start.Started;

                        foreach (var w in Platform.Weapons)
                        {
                            w.Azimuth   = 0;
                            w.Elevation = 0;
                            if (!FunctionalBlock.Enabled)
                            {
                                w.EventTriggerStateChanged(EventTriggers.TurnOff, true);
                            }

                            if (w.State.Sync.CurrentAmmo == 0)
                            {
                                w.EventTriggerStateChanged(EventTriggers.EmptyOnGameLoad, true);
                            }
                        }
                    }
                }
            }
            catch (Exception ex) { Log.Line($"Exception in SubpartClosed: {ex}"); }
        }
示例#30
0
 private void OnDestroy()
 {
     currentCube = null;
     lastCube    = null;
 }
        private void RemoveDecal(Vector3I position, List<MyDecalPartIdentity> decals, int index, ref MyCube cube)
        {
            MyDecalPartIdentity decal = decals[index];
            MyDecals.RemoveDecal(decal.DecalId);

            if (cube == null)
            {
                bool found = m_gridRender.CubeGrid.TryGetCube(position, out cube);
                if (!found)
                    return;
            }

            if (decal.CubePartIndex != -1)
            {
                var part = cube.Parts[decal.CubePartIndex];
                var cell = GetCell(position);
                cell.RemoveCubePartDecal(part, decal.DecalId);
            }
        }