Exemple #1
0
    public GameObject enterMechTooltipToHide;     // ignored if null for levels besides #1

    void Awake()
    {
        slopeWalker         = GetComponent <SlopeWalker>();
        slopeWalker.enabled = false;

        Assert.IsNotNull(audioEvent);

        firstIcon  = GameObject.Find("Main UI/Icon Turret").GetComponent <AbilityIcon>();
        secondIcon = GameObject.Find("Main UI/Icon Thrusters").GetComponent <AbilityIcon>();

        mechOnlyMask = LayerMask.GetMask("Mechs");
        playerBody   = GetComponent <Rigidbody2D>();

        spriteRenderer = GetComponent <SpriteRenderer>();
        mainCam        = Camera.main;
        camScript      = mainCam.GetComponent <MainCamera>();

        cursor = UIResourceManager.MouseCursor; // NOTE: ai bots use this class but do not use mouse cursor

        _state = PlayerState.outOfMech;         //default player state, switches between in and out of mech

        jetpack = GetComponent <Jetpack>();

        if (weaponEquipped)   // sanity check: some bots don't have this?
        {
            weapon = weaponEquipped.GetComponent <PlayerMachineGun>();
            weaponManager.GiveWeapon(weapon);
        }

        isAiPlayer = GetComponent <AI>() != null;

        EnableWeapons(true);

        Invoke("SetDefaultIcons", 0.1f);
    }
Exemple #2
0
    void Awake()
    {
        slopeWalker         = GetComponent <SlopeWalker>();
        slopeWalker.enabled = false;

        anim = GetComponentInChildren <Animator>();

        Assert.IsNotNull(ui);
        Assert.IsNotNull(explosion);
        Assert.IsNotNull(audioEvent);
        ui.SetName(mechName);

        hp            = GetComponent <HP>();
        weaponManager = GetComponent <WeaponManager>();
        mechRigidbody = GetComponent <Rigidbody2D>();

        string sceneName = SceneManager.GetActiveScene().name;

        if (sceneName.Contains("Space"))
        {
            isAffectedByGravity = false;
        }

        if (sceneName.Contains("Base"))
        {
            canExplodeIn3D = false;
        }

        mechBodyParts = GetComponentInChildren <MechBodyParts>();
        mechBodyParts.canExplodeIn3D      = canExplodeIn3D;
        mechBodyParts.isAffectedByGravity = isAffectedByGravity;

        thrusterFuelCurrent = thrusterFuelMax;

        anim.enabled = false;
    }