Exemple #1
0
    void UnleachAlien()
    {
        if (!m_Active)
        {
            return;
        }

        AlienBase clone = null;

        if (m_Pool.Count != 0)
        {
            clone = m_Pool[0];
            m_Pool.RemoveAt(0);

            if (m_Rigging)
            {
                m_Rigging.SetTrigger("open");
            }

            clone.gameObject.SetActive(true);

            if (m_Target)
            {
                clone.LockTarget(m_Target);
            }
        }
        else
        {
            if (m_DestroyAfterLast)
            {
                Die();
            }
        }
    }
Exemple #2
0
    // Called by CrusherHandle
    public void CrushAlien()
    {
        if (collidingAlien == null)
        {
            return;
        }
        AlienBase alienLogic = collidingAlien.GetComponent <AlienBase>();

        if (alienLogic.Crushable())
        {
            alienLogic.CrushMeDaddy();
        }
    }
Exemple #3
0
    protected AlienBase CreateAlien(bool active)
    {
        if (m_SpawnLocation == null)
        {
            m_SpawnLocation = transform;
        }

        AlienBase clone = Instantiate(m_Alien, m_SpawnLocation.position, m_SpawnLocation.rotation) as AlienBase;

        clone.DisablePersistency();
        clone.gameObject.SetActive(active);
        clone.transform.SetParent(GameController.EntityHolder);

        return(clone);
    }
    public void checkChildStatuses()
    {
        bool dropAll = true;

        foreach (GameObject morp in morpsConnectedList)
        {
            AlienBase morpScript = morp.GetComponent <AlienBase>();
            if (morpScript.getIsHeld() || morpScript.getIsOnTable())
            {
                dropAll = false;
                break;
            }
        }
        if (dropAll)
        {
            // StartCoroutine(dropMultiMorp());
            alienDropped.Raise();
            Destroy(gameObject);
        }
    }
Exemple #5
0
    public void UpdateMinMaxTime(AlienBase myBase)
    {
        if (currentBaseStateIndex < 0 || currentBaseStateIndex > myBase.StateCount)
        {
            currentBaseStateIndex = myBase.StateCount;
        }

        minTime = myBase.GetMinTime(currentBaseStateIndex);
        maxTime = myBase.GetMaxTime(currentBaseStateIndex);

        if (startTime < minTime || startTime == -1)
        {
            startTime = minTime;
        }

        if (endTime > maxTime || endTime == -1)
        {
            endTime = maxTime;
        }

        if (startTime >= endTime)
        {
            if (startTime - 0.5f >= minTime)
            {
                startTime -= 0.5f;
            }
            else
            {
                startTime = minTime;
            }

            if (startTime >= endTime && endTime != maxTime)
            {
                endTime = startTime + 0.5f;
                if (endTime >= maxTime)
                {
                    endTime = maxTime;
                }
            }
        }
    }
Exemple #6
0
    void ClearPool()
    {
        if (m_Pool != null)
        {
            if (m_Pool.Count > 0)
            {
                int dbg = 0;
                for (int i = 0; i < m_Pool.Count; i++)
                {
                    AlienBase toDestroy = m_Pool[i];

                    if (!toDestroy.gameObject.activeSelf)
                    {
                        Destroy(toDestroy.gameObject);
                    }

                    dbg++;
                }
                m_Pool.Clear();
                Debug.Log("cleaned " + dbg);
            }
        }
    }
Exemple #7
0
    public override void OnInspectorGUI()
    {
        myTarget = (AlienBase)target;

        UpdateNeededReferences();

        currentStateIndex = 0;

        myTarget.UpdateBaseTime         = EditorGUILayout.FloatField("Performance: UpdateBaseTime", myTarget.UpdateBaseTime);
        myTarget.UpdateGrowingPartsTime = EditorGUILayout.FloatField("Performance: UpdateGrowingPartsTime", myTarget.UpdateGrowingPartsTime);

        GUILayout.Space(5);

        myTarget.useHealthAsTime = EditorGUILayout.Toggle("Use EnemieBase Health Script", myTarget.useHealthAsTime);

        myTarget.ShowTestInEditor   = EditorGUILayout.BeginToggleGroup("Testing: ", myTarget.ShowTestInEditor);
        myTarget.UpdateGrowingParts = myTarget.ShowTestInEditor;

        if (myTarget.ShowTestInEditor)
        {
            GUILayout.Label("Testing:");
            if (GUILayout.Button("Update Growing Part List"))
            {
                UpdatePartList();
            }
            GUILayout.Label("Growing Parts Count: " + myTarget.parts.Count);

            if (GUILayout.Button("Try Automatic Growing Settings"))
            {
                myTarget.TryAutomaticGrowingSettings();
            }

            if (myTarget.StateOrder.Count != 0)
            {
                myTarget.currentTestState = EditorGUILayout.Popup(myTarget.currentTestState, myTarget.BaseStateList);
                myTarget.currentTime      = EditorGUILayout.Slider("Current Time", myTarget.currentTime, myTarget.StartTime, myTarget.EndTime);
            }
        }
        EditorGUILayout.EndToggleGroup();

        GUILayout.Space(10);
        GUILayout.Label("Set Up:");

        myTarget.minNeededTime = EditorGUILayout.FloatField("Min Time", myTarget.minNeededTime);
        myTarget.maxNeededTime = EditorGUILayout.FloatField("Max Time", myTarget.maxNeededTime);

        myTarget.StartUpTime = EditorGUILayout.Slider("StartUpTime", myTarget.StartUpTime, myTarget.minNeededTime, myTarget.maxNeededTime);

        EditorGUILayout.Popup(myTarget.currentState, myTarget.BaseStateList);

        GUILayout.Space(10);

        GUILayout.Label("Base States:");
        scrollValue = EditorGUILayout.BeginScrollView(scrollValue, GUILayout.MaxHeight(300), GUILayout.MinHeight(200));

        foreach (AlienBaseState state in myTarget.StateOrder)
        {
            DrawInspectorForState(state);

            GUILayout.Space(5);

            currentStateIndex++;
        }

        if (deleteStateIndex != -1)
        {
            DeleteState(deleteStateIndex);
            deleteStateIndex = -1;
        }

        EditorGUILayout.EndScrollView();

        if (GUILayout.Button("Add State"))
        {
            NewState();
        }

        if (GUI.changed)
        {
            if (myTarget.minNeededTime < 0)
            {
                myTarget.minNeededTime = 0;
            }

            UpdateMinMaxTime();

            myTarget.UpdateParts(true, true);

            EditorUtility.SetDirty(myTarget);
        }
    }