/// <summary> /// 激活效果 /// </summary> /// <param name="target">挂效果的对象.</param> private void ActiveEffect(Unit target) { for (int i = 0; i < _bulletParser.effectList.Length; i++) { BulletEffect effect = PoolMgr.Inst.SpawnObj <BulletEffect>(); effect.Init(_bulletParser.effectList[i], _skill.activeUnit, target); } }
void BulletRunning(EffectBasic eb) { BulletEffect be = (BulletEffect)eb; //从开始目标往目标飞行 float rate = (float)eb.nowTime / (float)eb.runningTime; Vector3 nPos = (be.target.transform.position - be.resorce.transform.position) * rate + be.resorce.transform.position; be.selfGO.transform.position = nPos; }
private void EntityShotByEntity(AbstractEntity shooter, int x1, int y1, AbstractEntity target, int x2, int y2) { this.gameLog.Add($"Target {target.name} shot by {shooter.name}"); BulletEffect be = new BulletEffect(x1, y1, x2, y2); EffectsSystem es = (EffectsSystem)this.ecs.GetSystem(nameof(EffectsSystem)); es.effects.Add(be); // todo - calc acc, damage etc... }
protected override void OnAttached(EntityLogic childEntity, Transform parentTransform, object userData) { base.OnAttached(childEntity, parentTransform, userData); if (childEntity is BulletEffect) { bulletEffect = (BulletEffect)childEntity; bulletEffect.SetBulletData(this.bulletData); leftEffectTimes = bulletEffect.EffectTimes; } }
public void TraceBullet(Vector3 from, Vector3 to, BulletEffect effect, float rotation) { Engine.FireBullet(from, to, new Color4(1.0f, 0.0f, 1.0f, 0.0f)); switch (effect) { case BulletEffect.None: break; case BulletEffect.Bloodsplatter: Engine.BloodSpray(to, rotation); break; } }
[HideInInspector] public bool m_isEditting; // true라면 화살표를 계산합니다. public virtual void Start() { if (m_activeList == null) { m_activeList = new List <Bullet>(); } if (m_isInit) { return; } m_isInit = true; if (lineY == 0) { lineY = GameObject.Find("BulletLine").transform.position.y; } m_rigid = GetComponent <Rigidbody2D>(); m_coll = GetComponent <Collider2D>(); m_buttonColl = GetComponent <CircleCollider2D>(); m_render = GetComponent <SpriteRenderer>(); m_effect = GetComponent <BulletEffect>(); m_arrowRender_ = transform.FindChild("Arrow").GetComponent <LineRenderer>(); m_parent = transform.parent; m_pivot = new Vector2(0, lineY); m_isDown = false; m_isUp = false; m_isClick = false; m_editShoot = false; m_isSetup = false; m_isRemove = false; EditBulletDir(m_moveDir); m_isLineup = false; m_isEditting = false; if (m_isMain) { m_activeList.Add(this); } //gameObject.SetActive(false); }
public GameContext() { Tracer.i("Initializing GameContext"); MainWindow = new MainWindow(this); MainWindow.Show(); RenderContext = MainWindow.RenderContext; DebugGrid = new BasicGrid(); DebugGrid.Load(RenderContext); GameWorld = MainWindow.WorldSpace; GameWorld.AddResource(DebugGrid); DirectInput = new DirectInputManager(RenderContext, MainWindow); OculusManager = new OculusDeviceManager(RenderContext); //PlayerContexts[0]=new PlayerContext(this,0); //PlayerContexts[1]=new PlayerContext(this,1); Controller = new ControlForm(this); Controller.Show(); _drawable = new BulletEffect(this); GameWorld.AddResource(_drawable); _drawable.Start(new Vector3(0, 0, 0), new Vector3(0, 0, 1)); //handOperationChecker=new JoystickHandOperationChecker(this,11); Tracer.i("Initializing GameContext Completed!"); }
public void Start() { this.m_bulletEffect = GetComponent <BulletEffect>(); }
public void NewBulletEffect(GameObject res, GameObject tar, GameObject self, BombType bt, string dmg, int delay, int time) { //新建一个飞弹 BulletEffect bEffect = new BulletEffect(delay, time, EFType.BulletEffect, res, tar, self, bt, dmg); //加入事件 }
public void HandleKeyInput(RLKeyPress keyPress) { this.doRepaint = true; if (this.effectsSystem.HasEffects()) { return; } switch (keyPress.Key) { case RLKey.Number1: case RLKey.Number2: case RLKey.Number3: case RLKey.Number4: case RLKey.Number5: case RLKey.Number6: case RLKey.Number7: case RLKey.Number8: case RLKey.Number9: int idx = keyPress.Key - RLKey.Number0; if (this.currentInputMode == InputMode.SelectItemFromFloor) { if (this.currentInputSubMode == InputSubMode.PickingUpItem) { PositionComponent pos = (PositionComponent)this.currentUnit.GetComponent(nameof(PositionComponent)); this.pickupItemSystem.PickupItem(this.currentUnit, this.menuItemList[idx], this.mapData.map[pos.x, pos.y]); this.gameLog.Add("item picked up"); this.currentInputMode = InputMode.Normal; this.menuItemList.Clear(); } } else if (this.currentInputMode == InputMode.SelectItemFromInv) { if (this.currentInputSubMode == InputSubMode.DroppingItem) { PositionComponent pos = (PositionComponent)this.currentUnit.GetComponent(nameof(PositionComponent)); this.pickupItemSystem.DropItem(this.currentUnit, this.menuItemList[idx], this.mapData.map[pos.x, pos.y]); this.gameLog.Add("item dropped up"); this.currentInputMode = InputMode.Normal; this.menuItemList.Clear(); } } else if (this.currentInputMode == InputMode.ActivatingCurrentItem) { TimerCanBeSetComponent tcbsc = (TimerCanBeSetComponent)this.currentUnit.GetComponent(nameof(TimerCanBeSetComponent)); if (tcbsc != null) { if (tcbsc.activated == false) { tcbsc.activated = true; tcbsc.timeLeft = idx; this.gameLog.Add("Timer set for " + idx); } else { this.gameLog.Add("Timer already set!"); } } } else { this.SelectUnit(idx); } break; case RLKey.Up: { MovementDataComponent m = (MovementDataComponent)this.currentUnit.GetComponent(nameof(MovementDataComponent)); m.route = null; m.offY = -1; break; } case RLKey.Down: { MovementDataComponent m = (MovementDataComponent)this.currentUnit.GetComponent(nameof(MovementDataComponent)); m.route = null; m.offY = 1; break; } case RLKey.Left: { MovementDataComponent m = (MovementDataComponent)this.currentUnit.GetComponent(nameof(MovementDataComponent)); m.route = null; m.offX = -1; break; } case RLKey.Right: { MovementDataComponent m = (MovementDataComponent)this.currentUnit.GetComponent(nameof(MovementDataComponent)); m.route = null; m.offX = 1; break; } case RLKey.Space: { MobDataComponent mdc = (MobDataComponent)this.currentUnit.GetComponent(nameof(MobDataComponent)); if (mdc.actionPoints > 0) { mdc.actionPoints -= 100; } break; } case RLKey.A: // Activate this.currentInputMode = InputMode.ActivatingCurrentItem; this.gameLog.Add("Enter number from 1-9"); break; case RLKey.D: { // Drop this.currentInputMode = InputMode.SelectItemFromInv; this.currentInputSubMode = InputSubMode.DroppingItem; this.ListItemsInInv(); this.gameLog.Add("Please select an item to drop"); break; } case RLKey.P: { // Pickup this.currentInputMode = InputMode.SelectItemFromFloor; this.currentInputSubMode = InputSubMode.PickingUpItem; this.ListItemsOnFloor(); this.gameLog.Add("Please select an item to pick-up"); break; } case RLKey.S: // Stop moving var md = (MovementDataComponent)this.currentUnit.GetComponent(nameof(MovementDataComponent)); md.route = null; this.gameLog.Add("Movement stopped"); break; case RLKey.T: { // Throw this.currentInputMode = InputMode.SelectMapPoint; this.currentInputSubMode = InputSubMode.ThrowingItem; this.gameLog.Add("Select where to throw"); break; } case RLKey.U: { // Use (e.g. shoot) this.UseCurrentItem(); break; } case RLKey.W: { // Walk this.currentInputMode = InputMode.SelectMapPoint; this.currentInputSubMode = InputSubMode.SelectingDestination; this.gameLog.Add("Select where to walk to"); break; } case RLKey.X: { // Test BulletEffect be = new BulletEffect(0, 0, 20, 20); EffectsSystem es = (EffectsSystem)this.ecs.GetSystem(nameof(EffectsSystem)); es.effects.Add(be); break; } } //if (action_performed) { this.SingleGameLoop(); //} this.checkVisibilitySystem.process(this.playersUnits); }
void Start() { this.bulletEffect = GetComponent <BulletEffect>(); }