示例#1
0
    public void ChangeComponent(SubEngineType _engineType)
    {
        GameObject _tempEngine = null;

        Destroy(currentSubBehaviour.EngineObject.gameObject);
        engineType = _engineType;
        switch (_engineType)
        {
        case SubEngineType.None:
            break;

        case SubEngineType.Light:
            _tempEngine = Instantiate(lightEngine, currentSubBehaviour.GetEnginePlace.transform.position, Quaternion.identity, currentSub.transform);
            break;

        case SubEngineType.Medium:
            _tempEngine = Instantiate(mediumEngine, currentSubBehaviour.GetEnginePlace.transform.position, Quaternion.identity, currentSub.transform);
            break;

        case SubEngineType.Heavy:
            _tempEngine = Instantiate(heavyEngine, currentSubBehaviour.GetEnginePlace.transform.position, Quaternion.identity, currentSub.transform);
            break;

        default:
            break;
        }
        currentSubBehaviour.EngineObject = _tempEngine;
    }
示例#2
0
 public static SubEnineSettings GetEngineSettings(SubEngineType _type)
 {
     if (subEngineSettings.TryGetValue(_type, out SubEnineSettings value))
     {
         return(value);
     }
     Debug.LogError("Subengine values not found");
     return(new SubEnineSettings(0, 0));
 }
示例#3
0
    public void CreateObject(SubCreatorUIManager _manager, string _title, string _description, string _leveltxt, Sprite _img, SubEngineType _engine)
    {
        manager                = _manager;
        objectTitle.text       = _title;
        objectDescription.text = _description;
        objectLevelText.text   = _leveltxt;
        previewImage.sprite    = _img;

        engineType = _engine;
    }
示例#4
0
    /*
     *  [Header("Special Prefabs:")]
     *  public GameObject temp;*/


    public void CreateSubOnBoot()
    {
        baseType    = (SubBaseType)GameManager.SP.playerData.subBaseSelected;
        engineType  = (SubEngineType)GameManager.SP.playerData.subEngineSelected;
        cannonType  = (SubCannonType)GameManager.SP.playerData.subCannonSelected;
        specialType = (SubSpecialType)GameManager.SP.playerData.subSpecialSelected;

        currentSub = CreateSub(baseType, engineType, cannonType, specialType);
        SetMeshPosition(new Vector3(5.6f, 3.1f, 0));

        DontDestroyOnLoad(currentSub);

        Debug.Log("Creating sub on boot");
    }
示例#5
0
    private SubObjectData CreateSubObject(string title, string desc, string level, Sprite img, SubEngineType _type)
    {
        GameObject    temp  = Instantiate(objectPrefab.gameObject, subObjectParent.transform.position, Quaternion.identity, subObjectParent.transform);//create ui object
        SubObjectData _data = temp.GetComponent <SubObjectData>();

        _data.CreateObject(this, title, desc, level, img, _type);
        return(_data);
    }
示例#6
0
    public GameObject CreateSub(SubBaseType _base, SubEngineType _engine, SubCannonType _cannon, SubSpecialType _special)
    {
        baseType    = _base;
        engineType  = _engine;
        cannonType  = _cannon;
        specialType = _special;

        GameObject _tempBase   = null;
        GameObject _tempEngine = null;
        GameObject _tempCannon = null;

        switch (_base)
        {
        case SubBaseType.None:
            Debug.LogError("No base selected");

            break;

        case SubBaseType.Medium:
            _tempBase = Instantiate(mediumBase, transform.position, Quaternion.identity);
            break;

        case SubBaseType.Heavy:
            _tempBase = Instantiate(heavyBase, transform.position, Quaternion.identity);
            break;

        case SubBaseType.Light:
            _tempBase = Instantiate(lightBase, transform.position, Quaternion.identity);
            break;

        default:
            break;
        }

        currentSubBehaviour = _tempBase.GetComponent <SubBaseBehaviour>();

        switch (_engine)
        {
        case SubEngineType.None:
            break;

        case SubEngineType.Light:
            _tempEngine = Instantiate(lightEngine, currentSubBehaviour.GetEnginePlace.transform.position, Quaternion.identity, _tempBase.transform);
            break;

        case SubEngineType.Medium:
            _tempEngine = Instantiate(mediumEngine, currentSubBehaviour.GetEnginePlace.transform.position, Quaternion.identity, _tempBase.transform);
            break;

        case SubEngineType.Heavy:
            _tempEngine = Instantiate(heavyEngine, currentSubBehaviour.GetEnginePlace.transform.position, Quaternion.identity, _tempBase.transform);
            break;

        default:
            break;
        }

        switch (_cannon)
        {
        case SubCannonType.None:
            break;

        case SubCannonType.Torpedo:
            _tempCannon = Instantiate(torpedoCannon, currentSubBehaviour.GetCannonPlace.transform.position, Quaternion.identity, _tempBase.transform);
            break;

        case SubCannonType.Minigun:
            _tempCannon = Instantiate(minigunCannon, currentSubBehaviour.GetCannonPlace.transform.position, Quaternion.identity, _tempBase.transform);
            break;

        case SubCannonType.Ram:
            _tempCannon = Instantiate(ramCannon, currentSubBehaviour.GetCannonPlace.transform.position, Quaternion.identity, _tempBase.transform);
            break;

        default:
            break;
        }
        currentSubBehaviour.CannonObject = _tempCannon;
        currentSubBehaviour.EngineObject = _tempEngine;

        //_tempBase.transform.position = new Vector3(-4.55f,0.25f,-0.4f);
        currentSubBehaviour.transform.Rotate(90, 0, 0);
        return(currentSubBehaviour.gameObject);
    }