Exemplo n.º 1
0
 // Apply the changes as specified in the action. If the action is relative, add the action to the existing values rather than replacing.
 public void ExecuteAction(BulletAction action)
 {
     if (action.relative)
     {
         speed += action.speed;
         angle += action.angle;
         acceleration += action.acceleration;
         maxSpeed += action.maxSpeed;
         angularVelocity += action.angularVelocity;
     } else {
         speed = action.speed;
         angle = action.angle;
         acceleration = action.acceleration;
         maxSpeed = action.maxSpeed;
         angularVelocity = action.angularVelocity;
     }
 }
Exemplo n.º 2
0
    void shoot()
    {
        GameObject bullet = Instantiate(towerController.bullet) as GameObject;

        bullet.transform.parent = PlayManager.Instance.Temp.Bullet.transform;
        if (bullet.GetComponent <BulletController>().isDown)
        {
            bullet.GetComponentInChildren <SpriteRenderer>().material.renderQueue = GameConfig.RenderQueueBulletDown;
        }
        else
        {
            bullet.GetComponentInChildren <SpriteRenderer>().material.renderQueue = GameConfig.RenderQueueBulletUp;
        }

        switch (towerController.chaseType)
        {
        case EBulletChaseType.CHASE:
            bullet.transform.position = towerController.appearBullet.transform.position;
            break;

        case EBulletChaseType.DROP:
            //bullet.transform.parent = towerController.appearBullet.transform;
            //bullet.transform.localPosition = Vector3.zero;
            break;

        case EBulletChaseType.EXPLOSION:
            bullet.transform.position = enemy.transform.position;
            break;

        case EBulletChaseType.BOMB:
            bullet.transform.position = towerController.appearBullet.transform.position;
            break;

        case EBulletChaseType.ARCHITECT:
            bullet.transform.position = towerController.appearBullet.transform.position;
            break;
        }

        bullet.transform.localScale = Vector3.one;

        BulletAction bulletAction = bullet.GetComponent <BulletAction>();

        bulletAction.towerController = this.towerController;
        bulletAction.towerAction     = this;
    }
Exemplo n.º 3
0
    /// <summary>
    /// changes object parameters to a value, recorded at a time
    /// </summary>
    /// <param name="time">playback time, float</param>
    void GoToTime(float time)
    {
        BulletAction state = recordedActions.Find(x => x.time == time);

        if (state != null)
        {
            EnableObject(state.isActive);
            transform.position = state.position;
        }
        else
        {
            // if object doesnt have a recorded state
            // it means that it didnt exist yet
            EnableObject(false);
        }

        StopBodyFromMoving();
    }
Exemplo n.º 4
0
 // Apply the changes as specified in the action. If the action is relative, add the action to the existing values rather than replacing.
 public void ExecuteAction(BulletAction action) {
     if(action.type == 0)
     {
         if (action.relative)
         {
             speed += action.speed;
             angle += action.angle;
         } else
         {
             speed = action.speed;
             angle = action.angle;
         }
     }
     else if (action.type == 1)
     {
         if (action.relative)
         {
             speed += action.speed;
             angle += action.angle;
             acceleration += action.acceleration;
             maxSpeed += action.maxSpeed;
             angularVelocity += action.angularVelocity;
         }
         else
         {
             speed = action.speed;
             angle = action.angle;
             acceleration = action.acceleration;
             maxSpeed = action.maxSpeed;
             angularVelocity = action.angularVelocity;
         }
     } else if (action.type == 2)
     {
         SetGraphic(BulletManager.propertyList[action.newGraphic]);
     }
     else if (action.type == 3)
     {
         angle = BulletManager.AngleToPlayerFrom(transform.position);
     }
 }
Exemplo n.º 5
0
    //obligatory comment that makes this function stand out so you can find it better
    void BulletTagActionsGUI(int i)
    {
        if (bp.bulletTags[i].actions == null)
        {
            bp.bulletTags[i].actions = new BulletAction[0];
        }

        var actions = new List <BulletAction>(bp.bulletTags[i].actions);

        if (actions.Count != bp.btaFoldouts[i].sub.Count)
        {
            bp.btaFoldouts[i].sub = new List <bool>(new bool[actions.Count]);
        }

        GUILayout.BeginHorizontal();
        bp.btaFoldouts[i].main = EditorGUILayout.Foldout(bp.btaFoldouts[i].main, "Actions");
        if (GUILayout.Button("Collapse All", GUILayout.Width(150)))
        {
            bp.btaFoldouts[i].main = !bp.btaFoldouts[i].main;

            for (var zz = 0; zz < bp.btaFoldouts[i].sub.Count; zz++)
            {
                bp.btaFoldouts[i].sub[zz] = bp.btaFoldouts[i].main;
            }
        }
        GUILayout.EndHorizontal();

        if (bp.btaFoldouts[i].main)
        {
            EditorGUI.indentLevel++;
            var removeIndex = -1;
            var moveIndex   = -1;

            for (var l = 0; l < actions.Count; l++)
            {
                EditorGUIUtility.labelWidth = 140;
                EditorGUIUtility.fieldWidth = 100;

                GUILayout.BeginHorizontal();
                var str = "Action " + (l + 1);
                bp.btaFoldouts[i].sub[l] = EditorGUILayout.Foldout(bp.btaFoldouts[i].sub[l], str);

                if (GUILayout.Button("Down", GUILayout.Width(50)))
                {
                    moveIndex = l;
                }
                if (GUILayout.Button("Remove", GUILayout.Width(80)))
                {
                    removeIndex = l;
                }
                GUILayout.EndHorizontal();

                if (bp.btaFoldouts[i].sub[l])
                {
                    GUI.changed = false;

                    EditorGUI.indentLevel++;

                    var ac = actions[l];

                    ac.type = (BulletActionType)EditorGUILayout.EnumPopup("Action Type", ac.type);

                    switch (ac.type)
                    {
                    case (BulletActionType.Wait):
                        GUILayout.BeginHorizontal();
                        if (!ac.randomWait)
                        {
                            ac.waitTime.x = EditorGUILayout.FloatField("Wait Time", ac.waitTime.x);
                        }
                        else
                        {
                            ac.waitTime = EditorGUILayout.Vector2Field("Time Range", ac.waitTime);
                        }
                        ac.randomWait = EditorGUILayout.Toggle("Randomize", ac.randomWait);
                        GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal();
                        ac.rankWait = EditorGUILayout.Toggle("AddRank", ac.rankWait);
                        if (ac.rankWait)
                        {
                            ac.waitTime.z = EditorGUILayout.FloatField("RankTime", ac.waitTime.z);
                        }
                        GUILayout.EndHorizontal();
                        break;

                    case (BulletActionType.ChangeDirection):
                        ac.direction = (DirectionType)EditorGUILayout.EnumPopup("DirectionType", ac.direction);
                        GUILayout.BeginHorizontal();
                        if (!ac.randomAngle)
                        {
                            ac.angle.x = EditorGUILayout.IntField("Angle", (int)ac.angle.x);
                        }
                        else
                        {
                            ac.angle = EditorGUILayout.Vector2Field("Angle Range", ac.angle);
                        }
                        ac.randomAngle = EditorGUILayout.Toggle("Randomize", ac.randomAngle);
                        GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal();
                        ac.rankAngle = EditorGUILayout.Toggle("Add Rank", ac.rankAngle);
                        if (ac.rankAngle)
                        {
                            ac.angle.z = EditorGUILayout.FloatField("RankAngle", ac.angle.z);
                        }
                        GUILayout.EndHorizontal();

                        GUILayout.BeginHorizontal();
                        if (!ac.randomWait)
                        {
                            ac.waitTime.x = EditorGUILayout.FloatField("Time", ac.waitTime.x);
                        }
                        else
                        {
                            ac.waitTime = EditorGUILayout.Vector2Field("Time Range", ac.waitTime);
                        }
                        ac.randomWait = EditorGUILayout.Toggle("Randomize", ac.randomWait);
                        GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal();
                        ac.rankWait = EditorGUILayout.Toggle("AddRank", ac.rankWait);
                        if (ac.rankWait)
                        {
                            ac.waitTime.z = EditorGUILayout.FloatField("RankTime", ac.waitTime.z);
                        }
                        GUILayout.EndHorizontal();

                        ac.waitForChange = EditorGUILayout.Toggle("WaitToFinish", ac.waitForChange);
                        break;

                    case (BulletActionType.ChangeSpeed):
                    case (BulletActionType.VerticalChangeSpeed):
                        GUILayout.BeginHorizontal();
                        if (!ac.randomSpeed)
                        {
                            ac.speed.x = EditorGUILayout.FloatField("New Speed", ac.speed.x);
                        }
                        else
                        {
                            ac.speed = EditorGUILayout.Vector2Field("Speed Range", ac.speed);
                        }
                        ac.randomSpeed = EditorGUILayout.Toggle("Randomize", ac.randomSpeed);
                        GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal();
                        ac.rankSpeed = EditorGUILayout.Toggle("Add Rank", ac.rankSpeed);
                        if (ac.rankSpeed)
                        {
                            ac.speed.z = EditorGUILayout.FloatField("RankSpeed", ac.speed.z);
                        }
                        GUILayout.EndHorizontal();
                        EditorGUILayout.Space();
                        GUILayout.BeginHorizontal();
                        if (!ac.randomWait)
                        {
                            ac.waitTime.x = EditorGUILayout.FloatField("Time", ac.waitTime.x);
                        }
                        else
                        {
                            ac.waitTime = EditorGUILayout.Vector2Field("Time Range", ac.waitTime);
                        }
                        ac.randomWait = EditorGUILayout.Toggle("Randomize", ac.randomWait);
                        GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal();
                        ac.rankWait = EditorGUILayout.Toggle("Add Rank", ac.rankWait);
                        if (ac.rankWait)
                        {
                            ac.waitTime.z = EditorGUILayout.FloatField("RankTime", ac.waitTime.z);
                        }
                        GUILayout.EndHorizontal();

                        ac.waitForChange = EditorGUILayout.Toggle("WaitToFinish", ac.waitForChange);
                        break;

                    case (BulletActionType.StartRepeat):
                        ac.repeatCount.x = EditorGUILayout.IntField("Repeat Count", (int)ac.repeatCount.x);
                        GUILayout.BeginHorizontal();
                        ac.rankRepeat = EditorGUILayout.Toggle("AddRank", ac.rankRepeat);
                        if (ac.rankRepeat)
                        {
                            ac.repeatCount.y = EditorGUILayout.FloatField("RepeatRank", ac.repeatCount.y);
                        }
                        GUILayout.EndHorizontal();
                        break;

                    case (BulletActionType.Fire):
                        ac.direction = (DirectionType)EditorGUILayout.EnumPopup("DirectionType", ac.direction);

                        if (!ac.useParam)
                        {
                            GUILayout.BeginHorizontal();
                            if (!ac.randomAngle)
                            {
                                ac.angle.x = EditorGUILayout.IntField("Angle", (int)ac.angle.x);
                            }
                            else
                            {
                                ac.angle = EditorGUILayout.Vector2Field("Angle Range", ac.angle);
                            }
                            ac.randomAngle = EditorGUILayout.Toggle("Randomize", ac.randomAngle);
                            GUILayout.EndHorizontal();
                            GUILayout.BeginHorizontal();
                            ac.rankAngle = EditorGUILayout.Toggle("Add Rank", ac.rankAngle);
                            if (ac.rankAngle)
                            {
                                ac.angle.z = EditorGUILayout.FloatField("RankAngle", ac.angle.z);
                            }
                            GUILayout.EndHorizontal();
                        }
                        ac.useParam = EditorGUILayout.Toggle("UseParamAngle", ac.useParam);
                        EditorGUILayout.Space();
                        ac.overwriteBulletSpeed = EditorGUILayout.Toggle("OverwriteSpeed", ac.overwriteBulletSpeed);
                        if (ac.overwriteBulletSpeed)
                        {
                            GUILayout.BeginHorizontal();
                            if (!ac.randomSpeed)
                            {
                                ac.speed.x = EditorGUILayout.FloatField("New Speed", ac.speed.x);
                            }
                            else
                            {
                                ac.speed = EditorGUILayout.Vector2Field("Speed Range", ac.speed);
                            }
                            ac.randomSpeed = EditorGUILayout.Toggle("Randomize", ac.randomSpeed);
                            GUILayout.EndHorizontal();
                            GUILayout.BeginHorizontal();
                            ac.rankSpeed = EditorGUILayout.Toggle("Add Rank", ac.rankSpeed);
                            if (ac.rankSpeed)
                            {
                                ac.speed.z = EditorGUILayout.FloatField("RankSpeed", ac.speed.z);
                            }
                            GUILayout.EndHorizontal();
                            ac.useSequenceSpeed = EditorGUILayout.Toggle("UseSequence", ac.useSequenceSpeed);
                        }
                        EditorGUILayout.Space();
                        ac.bulletTagIndex = EditorGUILayout.IntSlider("BulletTagIdx", ac.bulletTagIndex, 1, bp.bulletTags.Length);
                        break;
                    }
                    EditorGUI.indentLevel--;
                    if (GUI.changed)
                    {
                        SceneView.RepaintAll();
                    }
                }
            }

            if (moveIndex >= 0 && moveIndex != actions.Count - 1)
            {
                var temp = actions[moveIndex];
                actions[moveIndex]     = actions[moveIndex + 1];
                actions[moveIndex + 1] = temp;

                var temp2 = bp.btaFoldouts[i].sub[moveIndex];
                bp.btaFoldouts[i].sub[moveIndex]     = bp.btaFoldouts[i].sub[moveIndex + 1];
                bp.btaFoldouts[i].sub[moveIndex + 1] = temp2;
            }

            if (removeIndex >= 0)
            {
                actions.RemoveAt(removeIndex);
                bp.btaFoldouts[i].sub.RemoveAt(removeIndex);
            }

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("");
            if (GUILayout.Button("Add Action", GUILayout.Width(100)))
            {
                var ac = new BulletAction();
                actions.Add(ac);
                bp.btaFoldouts[i].sub.Add(true);
            }
            GUILayout.EndHorizontal();

            bp.bulletTags[i].actions = actions.ToArray();
        }
    }
    //obligatory comment that makes this function stand out so you can find it better
    void BulletTagActionsGUI(int i)
    {
        if (bp.bulletTags[i].actions == null)
            bp.bulletTags[i].actions = new BulletAction[0];

        var actions = new List<BulletAction>(bp.bulletTags[i].actions);

        if (actions.Count != bp.btaFoldouts[i].sub.Count)
            bp.btaFoldouts[i].sub = new List<bool>(new bool[actions.Count]);

        GUILayout.BeginHorizontal();
        bp.btaFoldouts[i].main = EditorGUILayout.Foldout(bp.btaFoldouts[i].main, "Actions");
        if (GUILayout.Button("Collapse All", GUILayout.Width(150)))
        {
            bp.btaFoldouts[i].main = !bp.btaFoldouts[i].main;

            for (var zz = 0; zz < bp.btaFoldouts[i].sub.Count; zz++)
                bp.btaFoldouts[i].sub[zz] = bp.btaFoldouts[i].main;
        }
        GUILayout.EndHorizontal();

        if (bp.btaFoldouts[i].main)
        {
            EditorGUI.indentLevel++;
            var removeIndex = -1;
            var moveIndex = -1;

            for (var l = 0; l < actions.Count; l++)
            {
                EditorGUIUtility.labelWidth = 140;
                EditorGUIUtility.fieldWidth = 100;

                GUILayout.BeginHorizontal();
                var str = "Action " + (l + 1);
                bp.btaFoldouts[i].sub[l] = EditorGUILayout.Foldout(bp.btaFoldouts[i].sub[l], str);

                if (GUILayout.Button("Down", GUILayout.Width(50)))
                    moveIndex = l;
                if (GUILayout.Button("Remove", GUILayout.Width(80)))
                    removeIndex = l;
                GUILayout.EndHorizontal();

                if (bp.btaFoldouts[i].sub[l])
                {
                    GUI.changed = false;

                    EditorGUI.indentLevel++;

                    var ac = actions[l];

                    ac.type = (BulletActionType)EditorGUILayout.EnumPopup("Action Type", ac.type);

                    switch (ac.type)
                    {
                        case (BulletActionType.Wait):
                            GUILayout.BeginHorizontal();
                            if (!ac.randomWait)
                                ac.waitTime.x = EditorGUILayout.FloatField("Wait Time", ac.waitTime.x);
                            else
                                ac.waitTime = EditorGUILayout.Vector2Field("Time Range", ac.waitTime);
                            ac.randomWait = EditorGUILayout.Toggle("Randomize", ac.randomWait);
                            GUILayout.EndHorizontal();
                            GUILayout.BeginHorizontal();
                            ac.rankWait = EditorGUILayout.Toggle("AddRank", ac.rankWait);
                            if (ac.rankWait)
                                ac.waitTime.z = EditorGUILayout.FloatField("RankTime", ac.waitTime.z);
                            GUILayout.EndHorizontal();
                            break;

                        case (BulletActionType.ChangeDirection):
                            ac.direction = (DirectionType)EditorGUILayout.EnumPopup("DirectionType", ac.direction);
                            GUILayout.BeginHorizontal();
                            if (!ac.randomAngle)
                                ac.angle.x = EditorGUILayout.IntField("Angle", (int)ac.angle.x);
                            else
                                ac.angle = EditorGUILayout.Vector2Field("Angle Range", ac.angle);
                            ac.randomAngle = EditorGUILayout.Toggle("Randomize", ac.randomAngle);
                            GUILayout.EndHorizontal();
                            GUILayout.BeginHorizontal();
                            ac.rankAngle = EditorGUILayout.Toggle("Add Rank", ac.rankAngle);
                            if (ac.rankAngle)
                                ac.angle.z = EditorGUILayout.FloatField("RankAngle", ac.angle.z);
                            GUILayout.EndHorizontal();

                            GUILayout.BeginHorizontal();
                            if (!ac.randomWait)
                                ac.waitTime.x = EditorGUILayout.FloatField("Time", ac.waitTime.x);
                            else
                                ac.waitTime = EditorGUILayout.Vector2Field("Time Range", ac.waitTime);
                            ac.randomWait = EditorGUILayout.Toggle("Randomize", ac.randomWait);
                            GUILayout.EndHorizontal();
                            GUILayout.BeginHorizontal();
                            ac.rankWait = EditorGUILayout.Toggle("AddRank", ac.rankWait);
                            if (ac.rankWait)
                                ac.waitTime.z = EditorGUILayout.FloatField("RankTime", ac.waitTime.z);
                            GUILayout.EndHorizontal();

                            ac.waitForChange = EditorGUILayout.Toggle("WaitToFinish", ac.waitForChange);
                            break;

                        case (BulletActionType.ChangeSpeed):
                        case (BulletActionType.VerticalChangeSpeed):
                            GUILayout.BeginHorizontal();
                            if (!ac.randomSpeed)
                                ac.speed.x = EditorGUILayout.FloatField("New Speed", ac.speed.x);
                            else
                                ac.speed = EditorGUILayout.Vector2Field("Speed Range", ac.speed);
                            ac.randomSpeed = EditorGUILayout.Toggle("Randomize", ac.randomSpeed);
                            GUILayout.EndHorizontal();
                            GUILayout.BeginHorizontal();
                            ac.rankSpeed = EditorGUILayout.Toggle("Add Rank", ac.rankSpeed);
                            if (ac.rankSpeed)
                                ac.speed.z = EditorGUILayout.FloatField("RankSpeed", ac.speed.z);
                            GUILayout.EndHorizontal();
                            EditorGUILayout.Space();
                            GUILayout.BeginHorizontal();
                            if (!ac.randomWait)
                                ac.waitTime.x = EditorGUILayout.FloatField("Time", ac.waitTime.x);
                            else
                                ac.waitTime = EditorGUILayout.Vector2Field("Time Range", ac.waitTime);
                            ac.randomWait = EditorGUILayout.Toggle("Randomize", ac.randomWait);
                            GUILayout.EndHorizontal();
                            GUILayout.BeginHorizontal();
                            ac.rankWait = EditorGUILayout.Toggle("Add Rank", ac.rankWait);
                            if (ac.rankWait)
                                ac.waitTime.z = EditorGUILayout.FloatField("RankTime", ac.waitTime.z);
                            GUILayout.EndHorizontal();

                            ac.waitForChange = EditorGUILayout.Toggle("WaitToFinish", ac.waitForChange);
                            break;

                        case (BulletActionType.StartRepeat):
                            ac.repeatCount.x = EditorGUILayout.IntField("Repeat Count", (int)ac.repeatCount.x);
                            GUILayout.BeginHorizontal();
                            ac.rankRepeat = EditorGUILayout.Toggle("AddRank", ac.rankRepeat);
                            if (ac.rankRepeat)
                                ac.repeatCount.y = EditorGUILayout.FloatField("RepeatRank", ac.repeatCount.y);
                            GUILayout.EndHorizontal();
                            break;

                        case (BulletActionType.Fire):
                            ac.direction = (DirectionType)EditorGUILayout.EnumPopup("DirectionType", ac.direction);

                            if (!ac.useParam)
                            {
                                GUILayout.BeginHorizontal();
                                if (!ac.randomAngle)
                                    ac.angle.x = EditorGUILayout.IntField("Angle", (int)ac.angle.x);
                                else
                                    ac.angle = EditorGUILayout.Vector2Field("Angle Range", ac.angle);
                                ac.randomAngle = EditorGUILayout.Toggle("Randomize", ac.randomAngle);
                                GUILayout.EndHorizontal();
                                GUILayout.BeginHorizontal();
                                ac.rankAngle = EditorGUILayout.Toggle("Add Rank", ac.rankAngle);
                                if (ac.rankAngle)
                                    ac.angle.z = EditorGUILayout.FloatField("RankAngle", ac.angle.z);
                                GUILayout.EndHorizontal();
                            }
                            ac.useParam = EditorGUILayout.Toggle("UseParamAngle", ac.useParam);
                            EditorGUILayout.Space();
                            ac.overwriteBulletSpeed = EditorGUILayout.Toggle("OverwriteSpeed", ac.overwriteBulletSpeed);
                            if (ac.overwriteBulletSpeed)
                            {
                                GUILayout.BeginHorizontal();
                                if (!ac.randomSpeed)
                                    ac.speed.x = EditorGUILayout.FloatField("New Speed", ac.speed.x);
                                else
                                    ac.speed = EditorGUILayout.Vector2Field("Speed Range", ac.speed);
                                ac.randomSpeed = EditorGUILayout.Toggle("Randomize", ac.randomSpeed);
                                GUILayout.EndHorizontal();
                                GUILayout.BeginHorizontal();
                                ac.rankSpeed = EditorGUILayout.Toggle("Add Rank", ac.rankSpeed);
                                if (ac.rankSpeed)
                                    ac.speed.z = EditorGUILayout.FloatField("RankSpeed", ac.speed.z);
                                GUILayout.EndHorizontal();
                                ac.useSequenceSpeed = EditorGUILayout.Toggle("UseSequence", ac.useSequenceSpeed);
                            }
                            EditorGUILayout.Space();
                            ac.bulletTagIndex = EditorGUILayout.IntSlider("BulletTagIdx", ac.bulletTagIndex, 1, bp.bulletTags.Length);
                            break;
                    }
                    EditorGUI.indentLevel--;
                    if (GUI.changed)
                        SceneView.RepaintAll();
                }
            }

            if (moveIndex >= 0 && moveIndex != actions.Count - 1)
            {
                var temp = actions[moveIndex];
                actions[moveIndex] = actions[moveIndex + 1];
                actions[moveIndex + 1] = temp;

                var temp2 = bp.btaFoldouts[i].sub[moveIndex];
                bp.btaFoldouts[i].sub[moveIndex] = bp.btaFoldouts[i].sub[moveIndex + 1];
                bp.btaFoldouts[i].sub[moveIndex + 1] = temp2;
            }

            if (removeIndex >= 0)
            {
                actions.RemoveAt(removeIndex);
                bp.btaFoldouts[i].sub.RemoveAt(removeIndex);
            }

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("");
            if (GUILayout.Button("Add Action", GUILayout.Width(100)))
            {
                var ac = new BulletAction();
                actions.Add(ac);
                bp.btaFoldouts[i].sub.Add(true);
            }
            GUILayout.EndHorizontal();

            bp.bulletTags[i].actions = actions.ToArray();
        }
    }
Exemplo n.º 7
0
    // Add an action to the action queue.
    public void AddAction(BulletAction action)
    {
        if (action.timer <= 0 && actionQueue == null)
        {
            ExecuteAction(action);
            return;
        }

        if (actionQueue == null)
        {
            actionQueue = new List<BulletAction>();
        }

        actionQueue.Add(action);
    }
 // Adds an action to the queue of a specified bullet.
 public static void AddAction(GameObject shot, BulletAction action)
 {
     shot.GetComponent<Bullet>().AddAction(action);
 }
 // Adds an action to the queue of the last shot bullet.
 public static void AddAction(BulletAction action)
 {
     shotID.GetComponent<Bullet>().AddAction(action);
 }