// Start is called before the first frame update void Start() { volume = GetComponent <PostProcessVolume>(); //設定を取得する bloom = volume.profile.GetSetting <Bloom>(); shipMove = GameObject.Find("Ship").GetComponent <ShipMove>(); }
// string player; void Start() { rootGameObject = transform.root.gameObject; if (rootGameObject.name == "CPUShip") { CpushipMove = GameObject.Find("CPUShip").GetComponent <CpushipMove>(); CPUship = GameObject.Find("CPUShip"); flg = false; } else { shipMove = GameObject.Find("Ship").GetComponent <ShipMove>(); Ship = GameObject.Find("Ship"); flg = true; } speed = 0; //Debug.Log("root" + rootGameObject); //Debug.Log("GameObject" + shipMove); //Debug.Log("Flg " + flg); //"Particle1"オブジェクトから ParticleSystemコンポーネントを取得 ///最初にエラーを吐くが無視すること EmObj1 = transform.Find("Particle1").GetComponent <ParticleSystem>().emission.rateOverTime; EmObj2 = transform.Find("Particle2").GetComponent <ParticleSystem>().emission.rateOverTime; EmObj3 = transform.Find("Particle3").GetComponent <ParticleSystem>().emission.rateOverTime; EmObj4 = transform.Find("Particle4").GetComponent <ParticleSystem>().emission.rateOverTime; }
public override void Init(ShipBlueprint shipBP, ShipMove shipMove) { base.Init(shipBP, shipMove); combatInterface = CombatSystemInterface.Instance; spaceGround = SpaceGround.Instance; ConfigureShip(); }
void SetShipBoundary(float boundary) { GameObject gameManager = GameObject.Find("GameManager"); LoadSettings gameScript = gameManager.GetComponent <LoadSettings> (); ShipMove script = ships[gameScript.shipNumber].GetComponent <ShipMove> (); script.xBoarder = boundary; }
void Start() { main = GetComponent <ParticleSystem>().main; shipMove = GameObject.Find("Ship").GetComponent <ShipMove>(); Player = GameObject.Find("Ship"); speed = 0; offset = transform.position - Player.transform.position; }
public ShipMoveController(playerInput playerInput, Transform transform, GameStarter.ShipSettings shipSettings) { _playerInput = playerInput; var moveTransform = new AccelerationMove(transform, shipSettings._speed, shipSettings._acceleration); var rotation = new RotationShip(transform); _shipMove = new ShipMove(moveTransform, rotation); }
// Start is called before the first frame update void Start() { //子オブジェクトのTrailRendererを取得 AfterimageObj1 = transform.Find("Afterimage1").GetComponent <TrailRenderer>(); AfterimageObj2 = transform.Find("Afterimage2").GetComponent <TrailRenderer>(); AfterimageObj3 = transform.Find("Afterimage3").GetComponent <TrailRenderer>(); AfterimageObj4 = transform.Find("Afterimage4").GetComponent <TrailRenderer>(); Ship = GameObject.Find("Ship").GetComponent <ShipMove>(); }
void Toggle_Move() { // var so player cant move when button held down then paused GameObject ship = GameObject.FindWithTag("Ship"); if (ship != null) { ShipMove moveScript = ship.GetComponent <ShipMove>(); moveScript.canMove = !moveScript.canMove; } }
// Use this for initialization void Start() { instance = this; speed = 0; turningSpeedNow = 0; accel = 0.02f; astern = -0.015f; maxSpeed = 10f; maxAstSpeed = -3f; turningSpeed = 60f; framesHeld = 0; stopped = true; }
private void OnTriggerEnter2D(Collider2D collision) { ShipMove ship = collision.transform.GetComponent <ShipMove>(); if (ship) { if (pickupEffect != null) { Instantiate(pickupEffect, transform.position, transform.rotation); } Destroy(gameObject); } }
public static ShipController GetShip(Game gameView, ShipModel shipModel) { IView shipView = gameView.CreateView(shipModel.Name); IShipMove shipMove = new ShipMove(shipView.Rigidbody2D, shipModel.MoveForce); IShipRotate shipRotate = new ShipRotate(shipView.Rigidbody2D, shipModel.Torque); IShipHealth shipHealth = new ShipHealth(shipModel.MaxHealth); IShipCollided shipCollided = new ShipCollided(shipView, shipHealth); IShipFire shipFire = new ShipFire(); FireLock fireLock = new FireLock(); IShipFire shipLockableFire = new ShipLockableFire(shipFire, fireLock); return(new ShipController(shipModel, shipView, shipMove, shipRotate, shipCollided, shipHealth, shipLockableFire, fireLock)); }
public static ShipMove[] ShipMoves() { ShipMove[] moves = new ShipMove[] { new ShipMove("Forward", new Vector2[] { new Vector2(0, 8) }), new ShipMove("Soft Right", new Vector2[] { new Vector2(0, 3), new Vector2(4, 7) }), new ShipMove("Hard Right", new Vector2[] { new Vector2(0, 4), new Vector2(6, 4) }), new ShipMove("Hard Left", new Vector2[] { new Vector2(0, 4), new Vector2(-6, 4) }), new ShipMove("Soft Left", new Vector2[] { new Vector2(0, 3), new Vector2(-4, 7) }), }; return(moves); }
void Awake() { health = GetComponentInChildren <Health>(); setMaterialProperties = GetComponent <SetMaterialProperties>(); shipMove = GetComponentInChildren <ShipMove>(); spriteRenderer = GetComponent <SpriteRenderer>(); targetAcquisition = GetComponentInChildren <TargetAcquisition>(); trailRenderer = GetComponent <TrailRenderer>(); health.Damaged += OnDamaged; health.Died += OnDied; shipMove.FollowComplete += OnFollowComplete; targetAcquisition.TargetAcquired += OnTargetAcquired; targetAcquisition.TargetLost += OnTargetLost; }
// Update is called once per frame void Update() { if (!cd[0].ColdDownFinished()) { cd[0].ColdDown(Time.deltaTime); } if (!cd[1].ColdDownFinished()) { cd[1].ColdDown(Time.deltaTime); } if (Input.GetKey(KeyCode.Mouse0) && cd[0].ColdDownFinished()) { blast.GetComponent <is_en_tag>().is_enemy = GetComponentInParent <is_en_tag>().is_enemy; Vector3 mouse = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector3 v1 = mouse - transform.position; foreach (GameObject muzzle in muzz) { Vector3 v2 = muzzle.transform.position - transform.position; Vector3 tar = v1 - v2; tar.z = 0; float range = tar.magnitude; GameObject bullet = Instantiate(blast, muzzle.transform.position, muzzle.transform.rotation); bullet.GetComponent <Shell>().range = range; ShipMove s = GetComponentInParent <ShipMove>(); //Debug.Log(s); bullet.GetComponent <Shell>().shipSpeed = s.Speed; bullet.GetComponent <Shell>().shipToward = s.gameObject.transform.up; Debug.Log(bullet.GetComponent <Shell>().shipSpeed); Debug.Log(bullet.GetComponent <Shell>().shipToward); } cd[0].StartColdDown(); } if (Input.GetKey(KeyCode.Mouse1) && cd[1].ColdDownFinished()) { missile.GetComponent <is_en_tag>().is_enemy = GetComponentInParent <is_en_tag>().is_enemy; GameObject m = Instantiate(missile, launcher.transform.position, launcher.transform.rotation); Vector3 mouse = Camera.main.ScreenToWorldPoint(Input.mousePosition); mouse.z = 0; GameObject target = BattleController.instance.FindClosestEnemy(mouse, radii, GetComponentInParent <is_en_tag>().is_enemy); Debug.Log(target); m.GetComponent <Bullet>().Initial(0, new Vector3(0, 0, 0), GetComponentInParent <is_en_tag>().is_enemy, 0, target); cd[1].StartColdDown(); } }
public override void Awake() { base.Awake(); shipMove = gameObject.GetSafeComponent<ShipMove>(); shipAttack = gameObject.GetSafeComponent<ShipAttack>(); shipBlueprint = gameObject.GetSafeComponent<ShipBlueprint>(); componentCamera.enabled = false; //manual init to ensure correct intitialization order shipBlueprint.Init(); shipMove.Init(); shipAttack.Init(); selectedComponents = new List<ShipComponent>(); }
public void UpdateMovementPath() { List <Vector3> path = new List <Vector3>(); ShipMove sm = GetShipMove(); path.Add(transform.position + visualHolder.transform.localPosition); foreach (Vector2 w in sm.waypoints) { Vector3 point = new Vector3(w.x, 0, w.y); Vector3 adjustWaypoint = Quaternion.AngleAxis(transform.eulerAngles.y, Vector3.up) * point + transform.position + visualHolder.transform.localPosition; path.Add(adjustWaypoint); } pathSelectionController.SetPath(path); }
// Use this for initialization void Awake() { hydraInput = GameObject.FindGameObjectWithTag("HydraInput").GetComponent<SixenseInput>(); shipMove = gameObject.GetComponent<ShipMove>(); shipAttack = gameObject.GetComponent<ShipAttack>(); playerInventory = gameObject.GetComponent<PlayerInventory>(); switch (GOD.whatControllerAmIUsing) { case WhatControllerAmIUsing.KEYBOARD: hydraInput.enabled = false; break; case WhatControllerAmIUsing.MOUSE_KEYBOARD: hydraInput.enabled = false; break; case WhatControllerAmIUsing.HYDRA: hydraInput.enabled = true; break; default: break; } }
/* Methods */ // Use this for initialization void Start() { //Find and assign associated behaviours bank = gameObject.GetComponentInChildren <ShipBank>(); roll = gameObject.GetComponentInChildren <ShipRoll>(); wings = gameObject.GetComponentsInChildren <ShipWing>(); boost = gameObject.GetComponent <ShipBoost>(); rotate = gameObject.GetComponent <ShipRotate>(); move = gameObject.GetComponent <ShipMove>(); // // //Set camera's boundaries based on player's boundaries cameraPan.SetPanMaxDistance(5.0f, 5.0f); // // //Assign associated values to ensure animations sync up properly wings[0].wingDestroyed = false; wings[1].wingDestroyed = false; }
// Use this for initialization void Start() { instance = this; this.height = 2.0f * this._mainCamera.orthographicSize; this.width = this.height * this._mainCamera.aspect; var backs = this.transform.Find("Backs"); if (backs) { this._backs = backs.GetComponentsInChildren <BackLogic>(); } var player = this.transform.Find("Player"); if (player) { this._playerShip = player.GetComponentInChildren <ShipMove>(); if (this._playerShip) { this._playerShip.Initialize(this._mainCamera); } } this._enemy = this.transform.Find("Enemy"); this._pooledEnemyShip = new List <Ship>(this._enemy.childCount); this._pooledEnemyShip.AddRange(this._enemy.GetComponentsInChildren <Ship>()); if (this._backs != null) { for (int i = 0; i < this._backs.Length; ++i) { this.StartCoroutine(this._backs[i].Play()); } } var faded = AnimatedFaded.Create(2.0f, 2.0f); this.StartCoroutine(this.GenerateCommonEnemy()); }
public override void Parse(EndianBinaryReader reader) { ushort length; ushort id; byte[] content; if (!IsConnected() || tcpClient.Available == 0) { return; } var lengthBuffer = reader.ReadBytes(2); lengthBuffer = _proxy.Decrypt(lengthBuffer); if (BitConverter.IsLittleEndian) { Array.Reverse(lengthBuffer); } length = BitConverter.ToUInt16(lengthBuffer, 0); if (!IsConnected()) { return; } content = _proxy.Decrypt(reader.ReadBytes(length)); EndianBinaryReader cachedReader = new EndianBinaryReader(EndianBitConverter.Big, new MemoryStream(content)); id = cachedReader.ReadUInt16(); Console.WriteLine($"Received: {id}"); switch (id) { case ServerVersionCheck.ID: ServerVersionCheck serverVersionCheck = new ServerVersionCheck(cachedReader); if (serverVersionCheck.compatible) { Compatible?.Invoke(this, EventArgs.Empty); Send(new ClientRequestCode()); } else { NotCompatible?.Invoke(this, EventArgs.Empty); thread.Abort(); } break; case ServerRequestCode.ID: ServerRequestCode serverRequestCode = new ServerRequestCode(cachedReader); Generator generator = new Generator(); generator.Build(serverRequestCode.code); _proxy.InitStageOne(generator.Output); break; case ServerRequestCallback.ID: Console.WriteLine("Stage two received"); ServerRequestCallback serverRequestCallback = new ServerRequestCallback(cachedReader); _proxy.InitStageTwo(serverRequestCallback.secretKey); Console.WriteLine("StageTwo initialized"); Console.WriteLine("Sending login request"); SendEncoded(new Ping()); SendEncoded(new Login(api.Account.UserID, api.Account.SID, 0, api.Account.InstanceID)); SendEncoded(new Ready()); break; case BuildingInit.ID: BuildingInit buildingInit = new BuildingInit(cachedReader); lock (api.buildingsLocker) api.Buildings.Add(new Building(buildingInit.BuildingID, buildingInit.Name, buildingInit.X, buildingInit.Y, buildingInit.AssetType)); break; case DestroyBuilding.ID: DestroyBuilding destroyBuilding = new DestroyBuilding(cachedReader); lock (api.buildingsLocker) api.Buildings.RemoveAll(building => building.BuildingID == destroyBuilding.BuildingID); break; case GateInit.ID: GateInit gateInit = new GateInit(cachedReader); api.Gates.Add(new Gate(gateInit.GateType, gateInit.X, gateInit.Y)); break; case ShipDestroyed.ID: ShipDestroyed shipDestroyed = new ShipDestroyed(cachedReader); if (shipDestroyed.UserID == api.Account.UserID) { Destroyed?.Invoke(this, EventArgs.Empty); } break; case Notify.ID: Notify notify = new Notify(cachedReader); if (notify.MessageType == "ttip_killscreen_basic_repair") { Destroyed?.Invoke(this, EventArgs.Empty); } break; case MapChanged.ID: MapChanged mapChanged = new MapChanged(cachedReader); Console.WriteLine($"Map changed to: {mapChanged.MapID} | {mapChanged.var_294}"); SendEncoded(new MapChangeConfirmation(true)); break; case HeroInit.ID: HeroInit heroInit = new HeroInit(cachedReader); api.Boxes.Clear(); api.MemorizedBoxes.Clear(); api.Ores.Clear(); api.Ships.Clear(); api.Gates.Clear(); api.Buildings.Clear(); // Movement api.Account.X = heroInit.X; api.Account.Y = heroInit.Y; // Map statistics api.Account.HP = (int)heroInit.HP; api.Account.MaxHP = (int)heroInit.MaxHP; api.Account.Shield = (int)heroInit.Shield; api.Account.MaxShield = (int)heroInit.MaxShield; api.Account.NanoHP = (int)heroInit.NanoHP; api.Account.MaxNanoHP = (int)heroInit.MaxNanoHP; api.Account.FreeCargoSpace = (int)heroInit.FreeCargoSpace; api.Account.CargoCapacity = (int)heroInit.CargoCapacity; // Ship api.Account.Shipname = heroInit.Shipname; api.Account.Speed = (int)(heroInit.Speed * 0.97); // Statistics api.Account.Cloaked = heroInit.Cloaked; api.Account.Jackpot = heroInit.Jackpot; api.Account.Premium = heroInit.Premium; api.Account.Credits = heroInit.Credits; api.Account.Honor = heroInit.Honor; api.Account.Uridium = heroInit.Uridium; api.Account.XP = heroInit.XP; api.Account.Level = (int)heroInit.Level; api.Account.Rank = (int)heroInit.Rank; // Social api.Account.ClanID = (int)heroInit.ClanID; api.Account.ClanTag = heroInit.ClanTag; api.Account.FactionID = heroInit.FactionID; HeroInited?.Invoke(this, EventArgs.Empty); api.Account.Ready = true; Task.Delay(15000).ContinueWith(_ => api.Account.JumpAllowed = true); SendEncoded(new InitPacket(1)); SendEncoded(new InitPacket(2)); break; case 24328: //CpuInitializationCommand SendEncoded(new OldStylePacket("JCPU|GET")); break; case DroneFormationUpdated.ID: DroneFormationUpdated droneFormationUpdated = new DroneFormationUpdated(cachedReader); break; case ShipUpdated.ID: ShipUpdated shipUpdated = new ShipUpdated(cachedReader); api.Account.UpdateHitpointsAndShield(shipUpdated.HP, shipUpdated.Shield, shipUpdated.NanoHP); break; case ShieldUpdated.ID: ShieldUpdated shieldUpdated = new ShieldUpdated(cachedReader); api.Account.UpdateShield(shieldUpdated.Shield, shieldUpdated.MaxShield); break; case CargoUpdated.ID: CargoUpdated cargoUpdated = new CargoUpdated(cachedReader); api.Account.FreeCargoSpace = api.Account.CargoCapacity - (int)cargoUpdated.CargoCount; break; case HitpointsUpdated.ID: HitpointsUpdated hitpointsUpdated = new HitpointsUpdated(cachedReader); api.Account.UpdateHitpoints(hitpointsUpdated.HP, hitpointsUpdated.MaxHP, hitpointsUpdated.NanoHP, hitpointsUpdated.MaxNanoHP); break; case ShipAttacked.ID: ShipAttacked shipAttacked = new ShipAttacked(cachedReader); Attacked?.Invoke(this, shipAttacked); break; case ShipInit.ID: ShipInit shipInit = new ShipInit(cachedReader); Ship newShip = new Ship(); newShip.UserID = (int)shipInit.UserID; newShip.Username = shipInit.Username; newShip.NPC = shipInit.NPC; // Movement newShip.X = shipInit.X; newShip.Y = shipInit.Y; // Ship newShip.Shipname = shipInit.Shipname; // Statistics newShip.Cloaked = shipInit.Cloaked; // Social newShip.ClanID = (int)shipInit.ClanID; newShip.ClanTag = shipInit.ClanTag; newShip.FactionID = (int)shipInit.FactionID; lock (api.shipsLocker) api.Ships.Add(newShip); break; case ShipMove.ID: ShipMove shipMove = new ShipMove(cachedReader); ShipMoving?.Invoke(this, shipMove); break; case BoxInit.ID: BoxInit boxInit = new BoxInit(cachedReader); if (boxInit.Hash.Length != 5) { Box box = new Box(boxInit.Hash, boxInit.X, boxInit.Y, boxInit.Type); lock (api.boxesLocker) lock (api.memorizedBoxesLocker) { api.Boxes.Add(box); api.MemorizedBoxes.Add(box); } } break; case DestroyItem.ID: DestroyItem item = new DestroyItem(cachedReader); lock (api.boxesLocker) lock (api.memorizedBoxesLocker) { api.Boxes.RemoveAll(box => box.Hash == item.Hash); if (item.CollectedByPlayer) { api.MemorizedBoxes.RemoveAll(box => box.Hash == item.Hash); } } lock (api.oresLocker) api.Ores.RemoveAll(ore => ore.Hash == item.Hash); break; case DestroyShip.ID: DestroyShip destroyedShip = new DestroyShip(cachedReader); lock (api.Ships) api.Ships.RemoveAll(ship => ship.UserID == destroyedShip.UserID); break; case OreInit.ID: OreInit oreInit = new OreInit(cachedReader); lock (api.oresLocker) api.Ores.Add(new Ore(oreInit.Hash, oreInit.X, oreInit.Y, oreInit.Type)); break; case 17162: if (!pingThread.IsAlive) { pingThread = new Thread(new ThreadStart(PingLoop)); pingThread.Start(); } break; case OldStylePacket.ID: OldStylePacket oldStylePacket = new OldStylePacket(cachedReader); string[] splittedMessage = oldStylePacket.Message.Split('|'); switch (splittedMessage[1]) { case OldPackets.SELECT: switch (splittedMessage[2]) { case OldPackets.CONFIG: api.Account.Config = Convert.ToInt32(splittedMessage[3]); break; } break; case OldPackets.PORTAL_JUMP: Console.WriteLine($"(Old) Map changed to: {splittedMessage[2]}"); SendEncoded(new MapChangeConfirmation(true)); break; case OldPackets.LOG_MESSAGE: switch (splittedMessage[3]) { case OldPackets.BOX_CONTENT_CREDITS: api.Account.CollectedCredits += double.Parse(splittedMessage[4]); break; case OldPackets.BOX_CONTENT_URIDIUM: api.Account.CollectedUridium += double.Parse(splittedMessage[4]); break; case OldPackets.BOX_CONTENT_EE: api.Account.CollectedEE += int.Parse(splittedMessage[4]); break; case OldPackets.BOX_CONTENT_XP: api.Account.CollectedXP += double.Parse(splittedMessage[4]); break; case OldPackets.BOX_CONTENT_HON: api.Account.CollectedHonor += double.Parse(splittedMessage[4]); break; } LogMessage?.Invoke(this, string.Join("|", splittedMessage)); break; default: Console.WriteLine("Received unsupported old style packet with message: {0}", oldStylePacket.Message); break; } break; default: Console.WriteLine("Received packet of ID {0} with total size of {1} which is not supported", id, length + 4); break; } }
private void Start() { rb = GetComponent <Rigidbody>(); bc = GetComponent <BoxCollider>(); sm = GetComponent <ShipMove>(); }
private void Start() { shipMove = GetComponent <ShipMove>(); }
public void OnEnable() { shipMove = (ShipMove)target; }
public ShipCommand(int shipID, int moveID, int actionID) { this.shipID = shipID; shipMove = GlobalShipMoves.ShipMoves()[moveID]; shipAction = GlobalShipActions.ShipActions()[actionID]; }
public ShipCommand(int shipID) { this.shipID = shipID; shipMove = GlobalShipMoves.ShipMoves()[0]; shipAction = GlobalShipActions.ShipActions()[0]; }
public ShipCommand(ShipController sc) { this.shipID = sc.shipID; shipMove = GlobalShipMoves.ShipMoves()[0]; shipAction = GlobalShipActions.ShipActions()[0]; }
private void Awake() { shipMove = ship.GetComponent <ShipMove>(); shipGun = ship.GetComponent <ShipGun>(); }
// Use this for initialization void Awake() { shipMove = GameObject.Find("sexyShip").GetComponent<ShipMove>(); }
/// <summary> /// initializes the various components of the ship and setups up references /// </summary> /// <param name="shipBP"></param> /// <param name="shipMove"></param> /// <param name="playerAttack"></param> public void Init(ShipBlueprint shipBP, ShipMove shipMove, PlayerAttack playerAttack) { base.Init(shipBP, shipMove); this.playerAttack = playerAttack; this.playerAttack.Init(); combatInterface = CombatSystemInterface.Instance; spaceGround = SpaceGround.Instance; ConfigurePlayerShip(); }
private void Start() { shipMove = shipManager.MainShipObject.GetComponent <ShipMove>(); }
public static int GetGlobalMoveIndex(ShipMove move) { List <ShipMove> moves = new List <ShipMove>(ShipMoves()); return(moves.FindIndex(x => x.name == move.name)); }
private void LoadObjects() { shipCollisionStatus = gameObject.GetComponent <ShipCollision> (); shipFire = gameObject.GetComponent <ShipFire> (); shipMove = gameObject.GetComponent <ShipMove> (); }
/// <summary> /// sets up references /// </summary> /// <param name="shipBP"></param> /// <param name="shipMove"></param> public virtual void Init(ShipBlueprint shipBP, ShipMove shipMove) { this.shipBP = shipBP; this.ShipBPMetaData = shipBP.MetaData; this.shipMove = shipMove; this.shipMove.Init(); InitStats(); InitReferences(); //component hp bars are only displayed when damaged Components.Where(comp => comp.CompHP >= comp.MaxHP).ToList() .ForEach(comp => comp.ShowHPBars(false)); }
public ShipCommand(ShipCmdState cmd) { this.shipID = cmd.shipID; shipMove = GlobalShipMoves.ShipMoves()[cmd.moveID]; shipAction = GlobalShipActions.ShipActions()[cmd.actionID]; }
// Start is called before the first frame update void Awake() { _shipMove = GetComponent <ShipMove>(); }