private void LoadAttackManifest()
    {
        string manifestName = "ManifestListArea1";

        GameObject _meObj = Instantiate(Resources.Load("Prefabs/Manifests/" + manifestName, typeof(GameObject))) as GameObject;

        ManifestList manifestScript = _meObj.GetComponent <ManifestList> ();

        int numEntries = manifestScript.NumEntriesUsed;

        Debug.Log("LoadAttackManifest : numEntries = " + numEntries.ToString());

        int runningIndex = 0;

        for (int e = 0; e < numEntries; e++)
        {
            ManifestEntry me = manifestScript.GetManifestEntryAtIndex(e);

            int          numToLoad       = me.NumToLoad;
            string       alienPrefabName = me.PrefabName;
            WayPointList startingPoints  = me.StartingPoints;

            GameObject           _moduleDataObj = Instantiate(Resources.Load("Prefabs/AlienModuleData/" + alienPrefabName, typeof(GameObject))) as GameObject;
            AlienModuleContainer amc            = _moduleDataObj.GetComponent <AlienModuleContainer> ();
            AlienModuleData      amd            = amc.mData;

            for (int i = 0; i < numToLoad; i++)
            {
                GameObject _aaObj = Instantiate(Resources.Load("Prefabs/AlienAttackObject", typeof(GameObject))) as GameObject;

                if (_aaObj != null)
                {
                    if (AlienAttackObjectContainer != null)
                    {
                        _aaObj.transform.parent = AlienAttackObjectContainer.transform;
                    }
                    _aaObj.name = "attackObj" + runningIndex.ToString();


                    Vector3 startingVec = startingPoints.GetVector3AtIndex(i);
                    //Debug.Log("vec = " + startingVec.x.ToString() + " "  + startingVec.y.ToString() + " " + startingVec.z.ToString());

                    AlienAttackObject objectScript = _aaObj.GetComponent <AlienAttackObject> ();
                    objectScript.StoragePosition = StoragePoint.transform.position;
                    objectScript.StartPosition   = startingVec;
                    objectScript.AttachModuleData(amd);
                    objectScript.FixUp();

                    //temp test
                    objectScript.SetBaseSpriteScale(0.3f, 0.3f);

                    AlienAttackObjectList.Add(_aaObj);

                    runningIndex++;
                }
            }
        }
    }
Beispiel #2
0
    private void GetWayPointData()
    {
        int wpIndex = mCurrentWayPoint;

        //mWayPointList = mModuleData.WayPointList;

        _startPosition = mWayPointList.GetVector3AtIndex(wpIndex);

        _startPosition += WayPointOffset;

        if (wpIndex < mMaxWayPointCount - 1)
        {
            _destinationPosition  = mWayPointList.GetVector3AtIndex(wpIndex + 1);
            _destinationPosition += WayPointOffset;
        }
        else
        {
            //arrived at end point
            mOnEndPoint = true;
        }

        WayPoint wp = mWayPointList.GetWayPointDataAtIndex(wpIndex);

        _waitTime = wp.WaitTime;

        //_velocity = wp.Velocity;
        _velocity = 1f;

        _acceleration        = wp.Acceleration;
        _decelAtPercentOfMag = wp.DecelAtPercentOfMag;
        _decelaration        = wp.Decelaration;
        _minVelocity         = wp.MinVelocity;
        _chanceToReverse     = wp.ChanceToReverse;
        _chanceToSkip        = wp.ChanceToSkip;

        _elaspedWaitTime = 0f;

        mCurrentWayPoint++;

        _State = eState.CalculatePath;
    }
Beispiel #3
0
    public void FixUp()
    {
        SetPrimarySprite(mModuleData.PrimarySprite);


        //----------------------Way Points---------------------------
        if (mWayPointList == null)
        {
            mWayPointList = new WayPointList();
        }

        mWayPointList = mModuleData.WayPointList;

        mMaxWayPointCount = mWayPointList.NumPointsUsed;

        //mWayPointList.DebugPrintList ("####  BEFORE  ####");

        Vector3 startingWayPoint = mWayPointList.GetVector3AtIndex(0);

        WayPointOffset = _startPosition - startingWayPoint;

        //debug
        //startingOffset.x = -2f;
        //startingOffset.y = -2f;

        //startingOffset.z = 0f;
        //mWayPointList.AddOffsetToPointList (startingOffset);

        //mWayPointList.DebugPrintList ("####  AFTER  ####");



        //------------------------Color-----------------------
        if (mColorSet == null)
        {
            mColorSet = new ColorSet();
        }

        mColorSet = mModuleData.ColorSet;
        SetPrimarySpriteColor(mColorSet.PrimaryColour);
    }
Beispiel #4
0
    private static void EditSelectedWayPoint()
    {
        GameObject selectedGameObject = Selection.activeGameObject;

        Debug.Log("selectedGameObject = " + selectedGameObject.name);

        //this is the WayPointList
        WayPointList wpList = selectedGameObject.GetComponent <WayPointList> ();


        //this is the WayPointManager
        GameObject      WayPointManagerObject = GameObject.Find("WayPointManager");
        WayPointManager wpManager             = WayPointManagerObject.GetComponent <WayPointManager> ();
        string          pName     = wpManager.PrefabName;
        int             numPoints = wpList.NumPointsUsed;
        bool            HasData   = wpList.HasData;

        wpManager.PrefabName    = wpList.PrefabName;
        wpManager.NumPointsUsed = wpList.NumPointsUsed;
        wpManager.HasData       = wpList.HasData;

        Debug.Log("EditSelectedWayPoint : numPoints = " + numPoints);
        for (int i = 0; i < numPoints; i++)
        {
            Vector3 vec = wpList.GetVector3AtIndex(i);
            WayPointManager.Instance.mWayPointEditList [i].transform.position = new Vector3(vec.x, vec.y, vec.z);

            if (HasData == true)
            {
                WayPoint wp = wpList.GetWayPointDataAtIndex(i);
                WayPointManager.Instance.mWayPointEditStructs [i] = wp;
            }
        }

        Debug.Log("wpManager pName = " + pName);
    }