protected override void NewEnemyBeforeEnable(MZEnemy enemy) { enemy.healthPoint = 25; MZMode mode = enemy.AddMode( "mode" ); MZMove_LinearBy move = mode.AddMove<MZMove_LinearBy>( "move" ); move.velocity = 100; move.isRunOnce = true; move.direction = ( positionType == MZFormation.PositionType.Left )? 0 : 180; MZPartControl partControl = new MZPartControl( enemy.partsByNameDictionary[ "MainBody" ] ); mode.AddPartControlUpdater().Add( partControl ); int mainWay = ( rank < 5 )? 1 : 3; AddCrossWayAttack( enemy.partsByNameDictionary[ "MainBody" ], mode, 270, mainWay ); if( rank >= 7 ) { int extraWay = 1 + ( rank - 7 )/2; AddCrossWayAttack( enemy.partsByNameDictionary[ "MainBody" ], mode, 270 + 40, extraWay ); AddCrossWayAttack( enemy.partsByNameDictionary[ "MainBody" ], mode, 270 - 40, extraWay ); } }
protected override void NewEnemyBeforeEnable(MZEnemy enemy) { enemy.healthPoint = 4; MZMode mode = enemy.AddMode( "mode" ); MZMove_TurnTo move = mode.AddMove<MZMove_TurnTo>( "GoTurn" ); move.direction = ( positionType == PositionType.Left )? 0 : 180; move.velocity = 200; move.totalTime = 4; move.rotationType = ( positionType == PositionType.Left )? MZMove.RotationType.CW : MZMove.RotationType.CCW; move.destinationDegrees = ( positionType == PositionType.Left )? -45 : -135; MZPartControl partControl = new MZPartControl( enemy.partsByNameDictionary[ "MainBody" ] ); mode.AddPartControlUpdater().Add( partControl ); MZAttack_OddWay attack = partControl.AddAttack<MZAttack_OddWay>(); attack.numberOfWays = 3; attack.colddown = 10; attack.duration = -1; attack.intervalDegrees = 15; attack.initVelocity = 500; attack.bulletName = "EBDonuts"; attack.targetHelp = new MZTargetHelp_Target(); attack.isRunOnce = true; }
protected override void NewEnemyBeforeEnable(MZEnemy enemy) { enemy.healthPoint = 5; enemy.partsByNameDictionary[ "MainBody" ].faceTo = MZFaceTo.Create<MZFaceTo_MovingDirection>( null ); AddShowMode( enemy ); AddRocketMode( enemy ); }
protected override void NewEnemyBeforeEnable(MZEnemy enemy) { enemy.healthPoint = 1/*1*rank*/; MZMove.RotationType rotType = rotationType; enemy.partsByNameDictionary[ "MainBody" ].faceTo = new MZFaceTo_MovingDirection(); if( _constructCode == 1 ) { if( positionType == MZFormation.PositionType.Mid ) { enemy.position += new Vector2( 50*( ( currentEnemyCreatedCount%2 == 0 )? 1 : -1 ), 0 ); } else { enemy.position += ( ( currentEnemyCreatedCount%2 == 0 )? new Vector2( 0, 100 ) : Vector2.zero ); } } if( positionType == MZFormation.PositionType.Mid ) { rotType = ( currentEnemyCreatedCount%2 == 0 )? MZMove.RotationType.CCW : MZMove.RotationType.CW; } MZMode mode = enemy.AddMode( "mode" ); // move float velocity = 400; MZMove_LinearBy moveLinear1 = mode.AddMove<MZMove_LinearBy>( "l1" ); moveLinear1.direction = ( positionType == MZFormation.PositionType.Mid )? 270 : GetStartDirection( rotType ); moveLinear1.velocity = velocity; moveLinear1.duration = 0.8f; MZMove_TurnTo moveTurn = mode.AddMove<MZMove_TurnTo>( "t" ); moveTurn.rotationType = rotType; moveTurn.direction = moveLinear1.direction; moveTurn.destinationDegrees = GetDestinationDirection( rotType ); moveTurn.totalTime = 0.5f; moveTurn.duration = 100; moveTurn.velocity = velocity; // main attack MZPartControl mainPartControl = new MZPartControl( enemy.partsByNameDictionary[ "MainBody" ] ); mode.AddPartControlUpdater().Add( mainPartControl ); MZAttack_OddWay attack = mainPartControl.AddAttack<MZAttack_OddWay>(); attack.numberOfWays = 1; attack.initVelocity = 300; attack.additionalVelocity = 150; attack.bulletName = "EBDonuts"; attack.colddown = 0.1f; attack.duration = 0.3f; attack.targetHelp = new MZTargetHelp_Target(); MZAttack_Idle attackIdle = mainPartControl.AddAttack<MZAttack_Idle>(); attackIdle.duration = 3; }
protected override void NewEnemyBeforeEnable(MZEnemy enemy) { if( currentEnemyCreatedCount == 0 ) { SetMainEnemy( enemy ); } else { SetSubEnemy( enemy ); } }
protected override void NewEnemyBeforeEnable(MZEnemy enemy) { MZMode mode = enemy.AddMode( "m" ); MZMove_LinearTo move = mode.AddMove<MZMove_LinearTo>( "m" ); move.destinationPosition = _currentNewEnemyDestPos; move.totalTime = 0.3f; move.duration = 1.0f; mode.AddMove<MZMove_Idle>( "idle" ).duration = 3; MZMove_LinearBy leave = mode.AddMove<MZMove_LinearBy>( "leave" ); leave.direction = 270; leave.velocity = 200; MZPartControl mainPartControl = new MZPartControl( enemy.partsByNameDictionary[ "MainBody" ] ); mode.AddPartControlUpdater().Add( mainPartControl ); MZAttack_Idle attackShow = mainPartControl.AddAttack<MZAttack_Idle>(); attackShow.duration = 0.5f; attackShow.isRunOnce = true; MZAttack_EvenWay attackEven = mainPartControl.AddAttack<MZAttack_EvenWay>(); attackEven.numberOfWays = 4; attackEven.colddown = 0.2f; attackEven.duration = 0.6f; attackEven.intervalDegrees = 45; attackEven.initVelocity = 300;// + 25*currentCreatedMemberCount; // attackEven.additionalVelocity = 50; attackEven.bulletName = "EBBee"; attackEven.targetHelp = new MZTargetHelp_Target(); MZAttack_Idle attackIdleInterval = mainPartControl.AddAttack<MZAttack_Idle>(); attackIdleInterval.duration = 0.3f; MZAttack_OddWay attackOdd = mainPartControl.AddAttack<MZAttack_OddWay>(); attackOdd.numberOfWays = 1; attackOdd.colddown = 0.2f; attackOdd.duration = 0.6f; attackOdd.intervalDegrees = 5; attackOdd.initVelocity = 600;// + 25*currentCreatedMemberCount; attackOdd.bulletName = "EBBee2"; attackOdd.targetHelp = new MZTargetHelp_Target(); // attackOdd.additionalVelocity = 50; MZAttack_Idle attackIdle = mainPartControl.AddAttack<MZAttack_Idle>(); attackIdle.duration = 3.0f; }
protected override void NewEnemyBeforeEnable(MZEnemy enemy) { enemy.healthPoint = 10; enemy.enableRemoveTime = 12; MZMode mode = enemy.AddMode( "mode" ); switch( _constructCode ) { case 0: SetType1Move( mode, enemy ); break; case 1: SetType2Move( mode, enemy ); break; case 2: SetType3Move( mode, enemy ); break; default: MZDebug.AssertFalse( "not supprt code=" + _constructCode.ToString() ); break; } // main attack MZPartControl mainPartControl = new MZPartControl( enemy.partsByNameDictionary[ "MainBody" ] ); mode.AddPartControlUpdater().Add( mainPartControl ); mainPartControl.getFaceTo = new MZPartControl.GetFaceTo( testFaceTo ); MZAttack_Idle attackIdle = mainPartControl.AddAttack<MZAttack_Idle>(); attackIdle.duration = 0.8f; attackIdle.isRunOnce = true; MZAttack_OddWay attack = mainPartControl.AddAttack<MZAttack_OddWay>(); attack.numberOfWays = 1; attack.initVelocity = 200; attack.additionalVelocity = 50; attack.bulletName = "EBBee2"; attack.colddown = 0.05f; attack.duration = 0.15f; attack.targetHelp = new MZTargetHelp_AssignPosition(); ( attack.targetHelp as MZTargetHelp_AssignPosition ).assignPosition = Vector2.zero; MZAttack_Idle attackIdle2 = mainPartControl.AddAttack<MZAttack_Idle>(); attackIdle2.duration = 1.8f; }
protected override void NewEnemyBeforeEnable(MZEnemy enemy) { enemy.partsByNameDictionary[ "MainBody" ].faceTo = new MZFaceTo_MovingDirection(); MZMode mode = enemy.AddMode( "m" ); MZMove_LinearBy linear = mode.AddMove<MZMove_LinearBy>( "move" ); linear.velocity = 160; linear.direction = 270; int ways = 3 + _attackCode; float initDegrees = ( ways == 4 )? 0 : 30; float intervalDegrees = 360/ways; for( int i = 0; i < ways; i++ ) { MZPartControl pControl = new MZPartControl( enemy.partsByNameDictionary[ "MainBody" ] ); mode.AddPartControlUpdater().Add( pControl ); SetTwinWayAttack( pControl, initDegrees + i*intervalDegrees ); } }
protected override void NewEnemyBeforeEnable(MZEnemy enemy) { enemy.healthPoint = 20; float commonMoveVelocity = 80; MZMode mode = enemy.AddMode( "m1" ); mode.duration = 3.5f; MZMove_LinearBy move1 = mode.AddMove<MZMove_LinearBy>( "mm" ); move1.direction = 270; move1.velocity = commonMoveVelocity; MZPartControl twinLeftPartControl = new MZPartControl( enemy.partsByNameDictionary[ "MainBody" ] ); mode.AddPartControlUpdater().Add( twinLeftPartControl ); SetTwinWay( twinLeftPartControl, new Vector2( -45, -80 ), true ); MZPartControl twinRightPartControl = new MZPartControl( enemy.partsByNameDictionary[ "MainBody" ] ); mode.AddPartControlUpdater().Add( twinRightPartControl ); SetTwinWay( twinRightPartControl, new Vector2( 45, -80 ), false ); if( rank >= 5 ) { MZPartControl fanWayLeftPartControl = new MZPartControl( enemy.partsByNameDictionary[ "MainBody" ] ); mode.AddPartControlUpdater().Add( fanWayLeftPartControl ); SetFanWay( fanWayLeftPartControl, new Vector2( -45, 80 ), 1.2f ); MZPartControl fanWayRightPartControl = new MZPartControl( enemy.partsByNameDictionary[ "MainBody" ] ); mode.AddPartControlUpdater().Add( fanWayRightPartControl ); SetFanWay( fanWayRightPartControl, new Vector2( 45, 80 ), 1.4f ); } MZMode modeReset = enemy.AddMode( "m2" ); modeReset.duration = 0.5f; MZMove_LinearBy move2 = modeReset.AddMove<MZMove_LinearBy>( "mm" ); move2.direction = 270; move2.velocity = commonMoveVelocity; }
protected override void NewEnemyBeforeEnable(MZEnemy enemy) { enemy.healthPoint = 4; MZMode mode = enemy.AddMode( "mode" ); MZMove_ToTarget move = mode.AddMove<MZMove_ToTarget>( "GoDie" ); move.velocity = 200; move.target.calcuteEveryTime = true; MZPartControl partControl = new MZPartControl( enemy.partsByNameDictionary[ "MainBody" ] ); mode.AddPartControlUpdater().Add( partControl ); MZAttack_OddWay attack = partControl.AddAttack<MZAttack_OddWay>(); attack.numberOfWays = 3; attack.colddown = 10; attack.duration = -1; attack.intervalDegrees = 15; attack.initVelocity = 500; attack.bulletName = "EBDonuts"; attack.targetHelp = new MZTargetHelp_Target(); attack.isRunOnce = true; }
protected override void NewEnemyBeforeEnable(MZEnemy enemy) { enemy.healthPoint = 80; MZMode mode = enemy.AddMode( "m" ); SetMove( mode ); MZPartControl partControl = new MZPartControl( enemy.partsByNameDictionary[ "MainBody" ] ); mode.AddPartControlUpdater().Add( partControl ); AddRingAttack( partControl ); float degreesInterval = ( rank > 8 )? 10.0f : 4.0f; int centerDegreesInterval = ( rank < 5 )? 180 : 90; for( int centerDegrees = 0; centerDegrees < 360; centerDegrees += centerDegreesInterval ) { SetNewPartToMultiVortexAttack( mode, enemy, centerDegrees + degreesInterval ); SetNewPartToMultiVortexAttack( mode, enemy, centerDegrees - degreesInterval ); if( rank >= 8 ) SetNewPartToMultiVortexAttack( mode, enemy, centerDegrees ); } }
void SetType3Move(MZMode mode, MZEnemy enemy) { MZMove_Rotation rotShow = mode.AddMove<MZMove_Rotation>( "r" ); rotShow.angularVelocity = 50*_angularVelocityDirection; rotShow.variationOfRadians = -300; rotShow.radiansLimited = 400; rotShow.targetHelp.assignPosition = Vector2.zero; rotShow.duration = 1.5f; MZMove_Idle moveIdle = mode.AddMove<MZMove_Idle>( "i" ); moveIdle.duration = 5; MZMove_LinearTo moveOut = mode.AddMove<MZMove_LinearTo>( "l" ); moveOut.destinationPosition = Vector2.zero; moveOut.totalTime = 0.5f; moveOut.notEndAtDestation = true; }
void SetType2Move(MZMode mode, MZEnemy enemy) { MZMove_Rotation rotShow = mode.AddMove<MZMove_Rotation>( "r" ); rotShow.angularVelocity = 50*_angularVelocityDirection; rotShow.variationOfRadians = -100; rotShow.targetHelp.assignPosition = Vector2.zero; rotShow.duration = 20; }
void SetType1Move(MZMode mode, MZEnemy enemy) { MZMove_LinearBy show = mode.AddMove<MZMove_LinearBy>( "l" ); show.direction = MZMath.DegreesFromXAxisToVector( MZMath.UnitVectorFromP1ToP2( enemy.position, Vector2.zero ) ); show.duration = 0.6f; show.velocity = 500; MZMove_Rotation rotShow = mode.AddMove< MZMove_Rotation>( "r1" ); rotShow.angularVelocity = 50*_angularVelocityDirection; rotShow.variationOfRadians = -300; rotShow.radiansLimited = 400; rotShow.targetHelp.assignPosition = Vector2.zero; rotShow.duration = 10.0f; MZMove_Rotation rotOut = mode.AddMove< MZMove_Rotation>( "r2" ); rotOut.angularVelocity = 50*_angularVelocityDirection; rotOut.variationOfRadians = 300; rotOut.targetHelp.assignPosition = Vector2.zero; rotOut.duration = 10; }
void SetNewPartToMultiVortexAttack(MZMode mode, MZEnemy enemy, float degrees) { MZPartControl partControl = new MZPartControl( enemy.partsByNameDictionary[ "MainBody" ] ); mode.AddPartControlUpdater().Add( partControl ); AddMultiVortex( partControl, degrees ); }
void AddRocketMode(MZEnemy enemy) { MZMode mode = enemy.AddMode( "rocket" ); MZMove_ToTarget move = mode.AddMove<MZMove_ToTarget>( "move" ); move.velocity = 600; move.target.calcuteEveryTime = false; MZPartControl mainPartControl = new MZPartControl( enemy.partsByNameDictionary[ "MainBody" ] ); mode.AddPartControlUpdater().Add( mainPartControl ); MZAttack_OddWay attack = mainPartControl.AddAttack<MZAttack_OddWay>(); attack.numberOfWays = 1; attack.initVelocity = 300; attack.additionalVelocity = 50; attack.bulletName = "EBDonuts"; attack.colddown = 0.05f; attack.duration = 0.3f; attack.targetHelp = new MZTargetHelp_Target(); attack.targetHelp.calcuteEveryTime = false; mainPartControl.AddAttack<MZAttack_Idle>().duration = -1; }
public void Remove(MZEnemy enemy) { MZDebug.Assert( enemy.belongFormation == this && _enemiesList.Contains( enemy ), "I am not your father" ); _enemiesList.Remove( enemy ); }
protected override void NewEnemyBeforeEnable(MZEnemy enemy) { }
protected override void NewEnemyBeforeEnable(MZEnemy enemy) { enemy.InitDefaultMode(); }
/// <summary> /// set new enemy before enable, such like position, override default mode ... etc /// </summary> /// <param name='enemy'> /// Enemy. /// </param> protected abstract void NewEnemyBeforeEnable(MZEnemy enemy);
bool PreTestPlayerBulletCollideEnemy(MZBullet playerBullet, MZEnemy enemy) { return !( enemy.isActive == false || enemy.currentHealthPoint <= 0 ); }
public void NotifyDefeated(MZEnemy enemy) { MZDebug.Assert( enemy.currentHealthPoint <= 0, "you hp={0}, are you sure you would be defeated", enemy.healthPoint ); MZDebug.Assert( _enemiesList.Contains( enemy ) == true, "you are not my member, go out " + enemy.name ); _enemyDefeatedCount++; }
void SetSubEnemy(MZEnemy enemy) { enemy.healthPoint = 8; MZMode mode = enemy.AddMode( "m" ); AddCommonMove( mode, "common1" ).duration = _showTime; AddSplitMoveToSubEmemy( mode ); AddCommonMove( mode, "common2" ); MZPartControl partControl = new MZPartControl( enemy.partsByNameDictionary[ "MainBody" ] ); mode.AddPartControlUpdater().Add( partControl ); partControl.AddAttack<MZAttack_Idle>().duration = _showTime + 0.8f; MZAttack_OddWay odd = partControl.AddAttack<MZAttack_OddWay>(); odd.bulletName = "EBBee"; odd.colddown = 1.0f; odd.duration = 1.0f; odd.initVelocity = 400; odd.numberOfWays = 1; odd.targetHelp = new MZTargetHelp_Target(); }
void AddShowMode(MZEnemy enemy) { float duration = maxEnemyCreatedNumber*enemyCreateTimeInterval + 0.15f; MZMode mode = enemy.AddMode( "show" ); mode.duration = duration; MZMove_LinearTo move = mode.AddMove<MZMove_LinearTo>( "move" ); move.useRelativePosition = true; move.destinationPosition = GetShowMoveDestPosition(); move.totalTime = duration/3; move.duration = duration; }
void SetMainEnemy(MZEnemy enemy) { enemy.healthPoint = 30; MZMode mode = enemy.AddMode( "m" ); AddCommonMove( mode, "common1" ).duration = _showTime; mode.AddMove<MZMove_Idle>( "idle" ).duration = _splitTime; AddCommonMove( mode, "common2" ); MZPartControl partControl = new MZPartControl( enemy.partsByNameDictionary[ "MainBody" ] ); mode.AddPartControlUpdater().Add( partControl ); partControl.AddAttack<MZAttack_Idle>().duration = _showTime;// _showTime + 0.5f; // MZAttack_OddWay splitOdd = partControl.AddAttack<MZAttack_OddWay>(); splitOdd.bulletName = "EBDonutsLarge"; splitOdd.numberOfWays = 18; splitOdd.initVelocity = 500; splitOdd.colddown = 0.1f; splitOdd.duration = 0.1f; splitOdd.intervalDegrees = 360/splitOdd.numberOfWays; splitOdd.isRunOnce = true; partControl.AddAttack<MZAttack_Idle>().duration = 0.5f; MZAttack_OddWay odd = partControl.AddAttack<MZAttack_OddWay>(); odd.bulletName = "EBDonuts"; odd.numberOfWays = 16; odd.initVelocity = 300; odd.colddown = 0.25f; odd.duration = 1; odd.additionalVelocity = 50; odd.intervalDegrees = 360/odd.numberOfWays; odd.targetHelp = new MZTargetHelp_AssignDirection(); ( odd.targetHelp as MZTargetHelp_AssignDirection ).direction = 45; }
void OnPlayerBulletCollideEnemy(MZBullet playerBullet, MZEnemy enemy) { enemy.GetComponent<MZEnemy>().TakenDamage( playerBullet.GetComponent<MZBullet>().strength ); playerBullet.Disable(); }