示例#1
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        if (GUILayout.Button("Generate new patrol path", GUILayout.Height(30)))
        {
            PatrolEnemy p = ((PatrolEnemy)target);

            GameObject newG = new GameObject("Enemy patrol path");
            newG.transform.position = p.transform.position;
            LineTrack l = newG.AddComponent <LineTrack>();
            l.CalculateStartPoints();
            p.Track = l;
        }
    }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        if (GUILayout.Button("Generate new bullet path", GUILayout.Height(30)))
        {
            BulletDistributor b = ((BulletDistributor)target);

            GameObject newG = new GameObject("Bullet spawn path");
            newG.transform.position = b.transform.position;
            LineTrack l = newG.AddComponent <LineTrack>();
            l.CalculateStartPoints(0, -15);
            b.MoveMode       = TrackMoveMode.Circle;
            b.SpawnMode      = BulletSpawnMode.OnTrack;
            b.TrackToSpawnOn = l;
        }
    }
示例#3
0
    public virtual void CreateFlyParticle()
    {
        bool isCreate = false;

        foreach (SkillEffectData.SkillFlyParticleData flyParticleData in _mSkillDataSlot._skillEffectData._skillFlyParticleList)
        {
            if (_mCurrentTrackTime >= flyParticleData._delayTime)
            {
                // tzz added for null
                if (_mSkillUser.U3DGameObject == null)
                {
                    continue;
                }

                // Play fly sound
                if (null != flyParticleData._skillSound)
                {
                    Debug.Log("_mSkillUser " + _mSkillUser.U3DGameObject.name + "Sound " + flyParticleData._skillSound._soundName);
                    Globals.Instance.MSoundManager.PlaySoundEffect(flyParticleData._skillSound._soundName);
                }

                Vector3 startPosition = _mSkillUser.U3DGameObject.transform.position;

                // Create multiple missile effects
                foreach (SkillDataSlot.AttackTargetData attackTargetData in _mSkillDataSlot._attackTargetDataList.Values)
                {
                    UnityEngine.Object obj = Resources.Load(flyParticleData._particleName);
                    if (null == obj)
                    {
                        isCreate = true;
                        Debug.Log("[Skill]: Cann't find the fly effect name " + flyParticleData._particleName);
                        continue;
                    }

                    // Calculate the Projectile ParticleEffect information
                    GameObject go = GameObject.Instantiate(obj, Vector3.zero, Quaternion.identity) as GameObject;

                    WarshipL target      = Globals.Instance.MPlayerManager.GetWarship(attackTargetData._targetID);
                    Vector3  endPosition = target.U3DGameObject.transform.position;

                    float missileHorzSpeed = flyParticleData.speed;
                    float targetHorzSpeed  = target.MoveSpeed;
                    if (attackTargetData._moveState == (int)GameData.BattleGameData.MoveState.STOP)
                    {
                        targetHorzSpeed = 0.0f;
                    }

                    MotionTrack motionTrack = null;
                    // Lihaojie 2012.09.26 Add a time track model, solve the problem which caused by the cure skill and damage skill order
                    if (_mSkillDataSlot.IsCureSkill())
                    {
                        motionTrack = new TimeTrack(GameDefines.BATTLE_STEP_TIME - flyParticleData._delayTime - 0.05f);
                    }
                    else
                    {
                        switch ((EWarshipType)_mSkillUser.Property.WarshipType)
                        {
                        case EWarshipType.CARRIER:
                        {
                            startPosition.y += 50.0f;
                            endPosition.y   += 50.0f;
                            // missileHorzSpeed = 150;
                            motionTrack = new AirCraftTrack(startPosition, endPosition, missileHorzSpeed, targetHorzSpeed);
                            break;
                        }

                        case EWarshipType.SUBMARINE:
                        {
                            motionTrack = new  LineTrack(startPosition, endPosition, missileHorzSpeed, targetHorzSpeed);
                            break;
                        }

                        case EWarshipType.SURFACE_SHIP:
                        {
                            // Assume the two speed is in x axis
                            float gravityAcceleration = -100.0f;

                            // MotionTrack motionTrack = new ParabolicTrack(startPosition, endPosition, horzSpeed);
                            motionTrack = new ParabolicTrack(startPosition, endPosition, missileHorzSpeed, targetHorzSpeed, gravityAcceleration);
                            break;
                        }
                        }
                    }

                    MissileL missile = new MissileL(go, motionTrack);
                    _mMissileEffectList.Add(missile);
                    _mFlyEffectObjs.Add(go);

                    isCreate     = true;
                    _mSkillState = SkillState.FLY;
                }                 // End foreach
            }
        }

        _mIsFlyParticleCreated = isCreate;
    }